From: Manfred Doudar on 4 Feb 2007 15:07 Hi All, I am hoping somewhat might enlighten me as to what exactly is wrong with the code snippet below, I can't see anything syntactically wrong with it but GCC-4.03 is not happy; and the last thing I want is blame the compiler. #ifndef NICTA_SEQCONTAINER_BACKINSERTER_0_H #define NICTA_SEQCONTAINER_BACKINSERTER_0_H #include "sbi_headers.h" #include "NictaSmartPtr/shared_ptr.h" #include "NictaSmartPtr/weak_ptr.h" #include <boost/utility.hpp> #include <algorithm> #include <deque> #include <memory> #include <string> template < typename T , template <typename Y_> class NodePtrType , template <typename T_, typename A_ = std::allocator<T_> > class SeqContainer = std::deque , template <typename Y_> class SharedPtrType = nicta::shared_ptr , template <typename Y_> class WeakPtrType = nicta::weak_ptr , template < typename T_ , template <typename _Y> class NodePtrType_ , template <typename _T, typename _A = std::allocator<_T> > class SeqContainer_ , template <typename _Y> class SharedPtrType_ , template <typename _Y> class WeakPtrType_ > class NodeContainer = nicta::ste::NodeStack , typename Predicate = std::equal<typename NodeContainer< T , NodePtrType , SeqContainer , SharedPtrType , WeakPtrType >::type::iterator> > class seqcontainer_backinserter : boost::noncopyable { // ... }; #endif When compiling, the first of the errors are the following, (with the remainder of errors trimmed off): .../include/seqcontainer_backinserter_0.h:39: error: expected type-specifier .../include/seqcontainer_backinserter_0.h:39: error: expected `>' Where Line 39 is in the above, the following: , typename Predicate = std::equal<typename NodeContainer< T All help appreciated. Cheers, -- Manfred Doudar - Research Engineer National ICT Australia - Canberra Research Lab | www.nicta.com.au Research School of Information Sciences and Engineering (RSISE) The Australian National University - Canberra, ACT 0200 AUSTRALIA [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Greg Herlihy on 5 Feb 2007 00:33 On Feb 5, 12:07 am, Manfred Doudar <manfred.dou...(a)rsise.anu.edu.au> wrote: > Hi All, > > I am hoping somewhat might enlighten me as to what exactly is wrong > with the code snippet below, I can't see anything syntactically > wrong with it but GCC-4.03 is not happy; and the last thing I want is > blame the compiler. > > ...[incredibly complicated class template omitted] > > When compiling, the first of the errors are the following, (with the > remainder of errors trimmed off): > > ../include/seqcontainer_backinserter_0.h:39: error: expected type-specifier > ../include/seqcontainer_backinserter_0.h:39: error: expected `>' > > Where Line 39 is in the above, the following: > > , typename Predicate = std::equal<typename NodeContainer< T I would say that this is one of those errors that just "leaps off of the page." :-) There is of course no "std::equal" function object. No doubt it's a typo for the "std::equal_to" function object - which does exist. If I may make a suggestion: I would re-evaluate whether this class template really needs so many template parameters. (Even counting them is tricky, I think I counted 11 - nearly all of them template template parameters). The fact that so many of the arguments do have default type arguments suggests that there may be an opportunity for simplification here. Greg -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: BinaryPredicate Question Next: Can I have Pure Virtual Destructor? |