I am trying to port my game to Symbian and to do this I made a small STL implementation. I now have a problem with my basic_string implementation. It works great when I use the MS compiler but GCC doesn't seem to get it.
Here is a code snippet:
GCC then gives me the following error:
string:323: `StoragePolicy::iterator' is not a valid declarator
string:323: perhaps you want `typename StoragePolicy::iterator' to make it a type.
So I change to the following:
This gives me the same error though.
Any C++ guru here that can tell me what to do?
I beleive that GCC just isn't capable enough and maybe I shall remove the StoragePolicy solution (STL doesn't use this), but I think it was rather elegant!
Here is a code snippet:
- Code:
template <class charT, class Traits=char_traits<charT>,class StoragePolicy=SimpleStringStorage<charT,Traits> >
class basic_string :public StoragePolicy
{
public:
typedef size_t size_type;
typedef charT value_type;
typedef charT & reference;
typedef const charT& const_reference;
typedef StoragePolicy::iterator iterator;
typedef StoragePolicy::const_iterator const_iterator;
...
...
};
GCC then gives me the following error:
string:323: `StoragePolicy::iterator' is not a valid declarator
string:323: perhaps you want `typename StoragePolicy::iterator' to make it a type.
So I change to the following:
- Code:
template <class charT, class Traits=char_traits<charT>,class StoragePolicy=SimpleStringStorage<charT,Traits> >
class basic_string :public StoragePolicy
{
public:
typename StoragePolicy::iterator;
typename StoragePolicy::reverse_iterator;
typedef size_t size_type;
typedef charT value_type;
typedef charT & reference;
typedef const charT& const_reference;
typedef StoragePolicy::iterator iterator;
typedef StoragePolicy::const_iterator const_iterator;
...
...
};
This gives me the same error though.
Any C++ guru here that can tell me what to do?
I beleive that GCC just isn't capable enough and maybe I shall remove the StoragePolicy solution (STL doesn't use this), but I think it was rather elegant!