[boost-users] msvc operator error.

k lets say i have the following snippet of code typedef boost::operators<T> operatorsT; template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base_of<operatorT, T>::value)); // bunch of code after... } on my compiler it generates this error. :/boost_msvc/include\boost/operators.hpp(283) : error C2803: 'operator --' must have at least one formal parameter of class type C:/boost_msvc/include\boost/operators.hpp(268) : see reference to class template instantiation 'boost::decrementable<T,B>' being compiled with [ T=int, B=boost::detail::empty_base<int> ] C:/boost_msvc/include\boost/operators.hpp(284) : error C2146: syntax error : missing ';' before identifier 'nrv' C:/boost_msvc/include\boost/operators.hpp(284) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:/boost_msvc/include\boost/operators.hpp(284) : error C2061: syntax error : identifier 'x' C:/boost_msvc/include\boost/operators.hpp(284) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:/boost_msvc/include\boost/operators.hpp(284) : fatal error C1903: unable to recover from previous error(s); stopping compilation

chun ping wang wrote:
k lets say i have the following snippet of code
typedef boost::operators<T> operatorsT;
Um, what's the intent of this line? Is there a definition of a specific type T somewhere in scope? Given that myFunc() contains a similar typedef, could this outer one be removed? This set of questions may be a total red herring, but even if the outer typdef doesn't confuse MSVC, it confuses me.
template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base_of<operatorT, T>::value)); // bunch of code after... }
on my compiler it generates this error. [snip]

sorry, that should have been deleted.. the real code is this..
template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base
_of<operatorT, T>::value));
// bunch of code after... }
On 9/21/07, Nat Goodspeed <nat@lindenlab.com> wrote:
chun ping wang wrote:
k lets say i have the following snippet of code
typedef boost::operators<T> operatorsT;
Um, what's the intent of this line? Is there a definition of a specific type T somewhere in scope? Given that myFunc() contains a similar typedef, could this outer one be removed? This set of questions may be a total red herring, but even if the outer typdef doesn't confuse MSVC, it confuses me.
template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base_of<operatorT, T>::value)); // bunch of code after... }
on my compiler it generates this error. [snip]
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

the problem occurs if i pass a primtive type into T. If i actually have class X : boost::operators<X> { // ... }; and than using X as a template parameter it works. However it doesn't seem to accept primitive type because of the following reasons... error C2803: 'operator --' must have at least one formal parameter of class type On 9/21/07, chun ping wang <cablepuff@gmail.com> wrote:
sorry, that should have been deleted.. the real code is this..
template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base
_of<operatorT, T>::value));
// bunch of code after... }
On 9/21/07, Nat Goodspeed <nat@lindenlab.com> wrote:
chun ping wang wrote:
k lets say i have the following snippet of code
typedef boost::operators<T> operatorsT;
Um, what's the intent of this line? Is there a definition of a specific type T somewhere in scope? Given that myFunc() contains a similar typedef, could this outer one be removed? This set of questions may be a total red herring, but even if the outer typdef doesn't confuse MSVC, it confuses me.
template <class T> void myFunc(const T&) { typedef boost::operators<T> operatorT; BOOST_STATIC_ASSERT((is_base_of<operatorT, T>::value)); // bunch of code after... }
on my compiler it generates this error. [snip]
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

on Mon Sep 24 2007, "chun ping wang" <cablepuff-AT-gmail.com> wrote:
the problem occurs if i pass a primtive type into T. If i actually have
class X : boost::operators<X> { // ... };
and than using X as a template parameter it works.
However it doesn't seem to accept primitive type because of the following reasons... error C2803: 'operator --' must have at least one formal parameter of class type
operators is not supposed to be used that way. The only right way to use operators<X> is to have X be a class derived from operators<X>. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
participants (3)
-
chun ping wang
-
David Abrahams
-
Nat Goodspeed