
I'm trying to static assert the value of a sequence. I've got the syntax slightly wrong, but I can't quite figure it out. Here's what my code looks like: ========================== template<typename SEQ, int SIZE> void assertSeqSize() { BOOST_STATIC_ASSERT(( boost::equal_to<boost::mpl::size<SEQ>::type, boost::mpl::int_<SIZE> > )) && "You have attempted to invoke a functor with the incorrect number of Arguments."; } ========================== The compiler (gcc 3.3.1) tells me: ../../c++/include/functors/ArgList.h: In function `void SAGE::FUNCTORS::assertSeqSize()': ../../c++/include/functors/ArgList.h:46: error: parse error before `>' token ../../c++/include/functors/ArgList.h:46: error: template argument 1 is invalid ../../c++/include/functors/ArgList.h:46: error: parse error before `&&' token Can anyone tell me my mistake? Did I stick an extra '::type' where I didn't need one? Thanks, --Steve Stephen Gross Case Western School of Medicine Cleveland, OH "By Grabthar's hammer, by the sons of Worvan, you shall be avenged." - Dr. Lazarus

I believe it's because you can't && an expression to be used within a static assert. How about the following: ======================== struct attempt_to_invoke_functor_with_incorrect_number_of_arguments : mpl::int_<1> { }; template<typename SEQ, int SIZE> void assertSeqSize() { BOOST_STATIC_ASSERT(( mpl::and_< boost::equal_to<boost::mpl::size<SEQ>::type, boost::mpl::int_<SIZE>
, attempt_to_invoke_functor_with_incorrect_number_of_arguments )); } ======================== HTH Pablo "Stephen Gross" <sgross@darwin.epbi.cwru.edu> wrote in message news:004d01c5a4f4$9cbf10b0$8df51681@sgross...
I'm trying to static assert the value of a sequence. I've got the syntax slightly wrong, but I can't quite figure it out. Here's what my code looks like:
========================== template<typename SEQ, int SIZE> void assertSeqSize() { BOOST_STATIC_ASSERT(( boost::equal_to<boost::mpl::size<SEQ>::type, boost::mpl::int_<SIZE> > )) && "You have attempted to invoke a functor with the incorrect number of Arguments."; } ==========================
[snip]
--Steve
Stephen Gross Case Western School of Medicine Cleveland, OH
"By Grabthar's hammer, by the sons of Worvan, you shall be avenged." - Dr. Lazarus
participants (2)
-
Pablo Aguilar
-
Stephen Gross