Hello,
I'm completely newbie, I used pairs from <utylity>, but now I'm in need of something like "thirds", so I decided to create a template. I started with:
template <class T1, class T2, class T3> struct thirds
{
typedef T1 first_type;
typedef T2 second_type;
typedef T3 third_type;
T1 first;
T2 second;
T3 third;
thirds() : first(T1()), second(T2()), third(T3()) {}
thirds(const T1& x, const T2& y, const T3& z) : first(x), second(y), third(z) {}
thirds <T1, T2, T3> make_thirds(const T1& x, const T2& y, const T3& z)
{
return ( thirds<T1,T2,T3>(x,y,z));
};
template <class U, class V, class F>
thirds (const thirds<U,V,F> &p) : first(p.first), second(p.second), third(p.third) { }
};
And this seems to work, but when I am trying to do sth like:
thirds <int,int,int> trojka;
and than
trojka= thirds::make_thirds (1,2,3);
I got three errors:
1>.\main.cpp(43) : error C2955: 'thirds' : use of class template requires template argument list
1> .\main.cpp(16) : see declaration of 'thirds'
1>.\main.cpp(43) : error C2955: 'thirds' : use of class template requires template argument list
1> .\main.cpp(16) : see declaration of 'thirds'
1>.\main.cpp(43) : error C2352: 'thirds<T1,T2,T3>::make_thirds' : illegal call of non-static member function
1> .\main.cpp(27) : see declaration of 'thirds<T1,T2,T3>::make_thirds'
Im using Visual Studio 2008.
Please give me an advice how to solve this problem.
Mike (: