template<class Container>
class F
{
public:
typedef typename Container::iterator iterator;
};
template <class Type, std::size_t Size>
class my_container : private F<my_container<Type,Size> >
{
public:
typedef Type* iterator;
};
Need to make this lazy
Ok, I'm taking the risk to look stupid (who cares anyway)
Why not just:
By no means do I consider myself a template guru (I hate templates :P)
Why not just:
template <class Type, std::size_t Size>class my_container{public: typedef Type* iterator;};
By no means do I consider myself a template guru (I hate templates :P)
Strange...I compiled this on VC++ 2005 and Dev-C++ and they both compile fine.
Maybe try this...
Maybe try this...
template <class Type, std::size_t Size>class my_container : private F{public: typedef Type* iterator;};
Quote:Original post by MoonshoeMake sure you actually instantiate the template.
Strange...I compiled this on VC++ 2005 and Dev-C++ and they both compile fine.
E.g. my_container<int,42> test;
You could add the iterator type as another argument of the F template:
template<class T, class I>class F{public: typedef I iterator;};template <class Type, std::size_t Size>class my_container : private F<my_container<Type,Size>,Type*> { typedef F<my_container<Type,Size>,Type*> F;public: using F::iterator;};
Quote:Original post by HodgmanQuote:Original post by MoonshoeMake sure you actually instantiate the template.
Strange...I compiled this on VC++ 2005 and Dev-C++ and they both compile fine.
E.g. my_container<int,42> test;
Oh yeah, thanks.
I'm seeing the errors now. :/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement