nonboost bug: visual c++ 7.1 error: too few template arugments error.

is there any work around against too few template arguments error. template <typename T, template <typename ELEM, typename = std::allocator<ELEM> > class CONT
CONT<T> someFunc() { } this gives an error in visual c++ yet it works perfectly fine in devc++ 4.9.9.2 is vc++ 7.1 too old?

DevC++ uses GCC, and 4.0.0 seems to grok that, although I might be instantiating it differently (since you didn't post the line triggering the error).

the error is on "CONT<T> someFunc()"... On 5/18/06, Michael Rickert <pandamojo@gmail.com> wrote:
DevC++ uses GCC, and 4.0.0 seems to grok that, although I might be instantiating it differently (since you didn't post the line triggering the error).
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

AFAIK, VC7 does not fill in the default argument for templated types. I remember a solution posted by Dave Abrahams in some(?) forum, wherein he used one of boost library to acheive this, but I don't remember the exact solution and library. I used an extra level of indirection, but I can not assure you if this is anywhere near standard practices only the gurus can... Here is what I did: //////////////////////////////////////////////////////////////// BOOST_MPL_HAS_XXX_TRAIT_DEF(ctype) ///// SomeFunc function/////////////// template <typename T, class Cont> typename Cont::ctype somefunc(T a, typename p_enable_if<has_ctype<Cont>, typename Cont::ctype > *p =0) { Cont::ctype c; c.push_back(a); return c; } //////Container wrap template < typename _elem, template< typename Elem, typename Alloc=std::allocator<Elem> > class cont, typename Alloc=std::allocator<_elem>
struct _container { typedef cont<_elem,Alloc> ctype; }; int _tmain(int argc, _TCHAR* argv[]) { ... std::vector<char> cd = somefoo<char, _container<char,std::vector> >('a'); ... } On 5/18/06, chun ping wang <cablepuff@gmail.com > wrote:
the error is on "CONT<T> someFunc()"...
On 5/18/06, Michael Rickert < pandamojo@gmail.com> wrote:
DevC++ uses GCC, and 4.0.0 seems to grok that, although I might be instantiating it differently (since you didn't post the line triggering the error).
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- "Civilization is the limitless multiplication of unnecessary necessities." -- Mark Twain
participants (3)
-
chun ping wang
-
Michael Rickert
-
Parag Gadkari