"typedef typename" equivalent in C++03

Asked

Viewed 19 times

0

Good morning. I’m having problems with a library code I want to add to my project. I use Visual Studio 10, which is a bit old, with a C++ version even more. The library code follows the format:

struct MyStruct
    {
        private:
            typedef typename std::map< int, std::string > Type;

            Type m_Variable;
        public:
            typedef typename Type::const_iterator const_iterator;

            inline const_iterator begin() const { return m_Variable.begin(); }
            inline const_iterator end() const   { return m_Variable.end(); }

    };

When compiling, the following error appears:

error C2899: typename cannot be used Outside a template declaration

Since there is no possibility to update the language in this case, it would have some equivalent way to declare Container and const_iterator?

Thank you in advance.

  • 1

    And why not update the VS?

  • The headache of doing this for all employees does not compensate for the effort. This considering that there would be compatibility problems.

  • 1

    Does the headache of wearing something with 20 years of lag make up for it? So that’s OK.

  • Cara vc have to update the compiler, these are features of c++ 11/17, without updating the compiler there is no magic pass.

1 answer

0

Guy even activating all the features of your compiler the visual studio 2010 has no support for typename, because it is a Feature of c++11.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.