Browse Source

GCC 4.4 compatibility: worked around "Sorry, not implemented" error.

New function declaration syntax for deduced return types doesn't work
here fully yet.
Vladimír Vondruš 14 years ago
parent
commit
4e847b7fcc
  1. 4
      src/MeshTools/CompressIndices.h
  2. 12
      src/SizeTraits.h

4
src/MeshTools/CompressIndices.h

@ -38,7 +38,11 @@ class CompressIndices {
CompressIndices(const std::vector<unsigned int>& indices): indices(indices) {}
inline std::tuple<size_t, Type, char*> operator()() const {
#ifndef MAGNUM_GCC44_COMPATIBILITY
return SizeBasedCall<Compressor>(*std::max_element(indices.begin(), indices.end()))(indices);
#else
return SizeBasedCall<std::tuple<size_t, Type, char*>, Compressor>(*std::max_element(indices.begin(), indices.end()))(indices);
#endif
}
void operator()(IndexedMesh* mesh, Buffer::Usage usage) const {

12
src/SizeTraits.h

@ -101,7 +101,11 @@ based on data size:
bar = SizeBasedCall<Foo>(dataSize)(arg1, arg2, ...);
@endcode
*/
#ifndef MAGNUM_GCC44_COMPATIBILITY
template<class Base> struct SizeBasedCall: public Base {
#else
template<class Return, class Base> struct SizeBasedCall: public Base {
#endif
/**
* @brief Constructor
* @param size Data size
@ -120,7 +124,11 @@ template<class Base> struct SizeBasedCall: public Base {
#ifndef MAGNUM_GCC45_COMPATIBILITY
template<typename ...Args> auto operator()(Args&&... arguments) -> decltype(Base::template run<GLubyte>(std::forward<Args>(arguments)...)) {
#else
#ifdef MAGNUM_GCC44_COMPATIBILITY
template<typename Args> Return operator()(Args&& arguments) {
#else
template<typename Args> auto operator()(Args&& arguments) -> decltype(Base::template run<GLubyte>(std::forward<Args>(arguments))) {
#endif
#endif
switch(Math::log(256, size)) {
case 0:
@ -148,8 +156,12 @@ template<class Base> struct SizeBasedCall: public Base {
#ifndef MAGNUM_GCC45_COMPATIBILITY
return decltype(Base::template run<GLubyte>(std::forward<Args>(arguments)...))();
#else
#ifdef MAGNUM_GCC44_COMPATIBILITY
return Return();
#else
return decltype(Base::template run<GLubyte>(std::forward<Args>(arguments)))();
#endif
#endif
}
private:

Loading…
Cancel
Save