user
user

Reputation: 7333

template typedef c++0x

I have found several questions asking about template typedefs in C++0x, which are resolved with the using keyword; however, with GCC 4.6.1 (running g++ -std=c++0x), I get the following error:

error: expected unqualified-id before ‘using’

Can you help me find where I'm going wrong? I've been trying to solve this for hours...

Code:

#include <map>

template<typename INDEX, typename VALUE>
class GenericSparseVector
{
protected:
  std::map<INDEX, VALUE> indices_to_values;
};

template <typename VALUE>
using StandardSparseVector = GenericSparseVector<int, VALUE>;

Upvotes: 4

Views: 1806

Answers (1)

ergosys
ergosys

Reputation: 49019

Template aliases are supported starting in gcc 4.7.

Upvotes: 7

Related Questions