Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-09 21:09:01


Matthias Schabel <boost_at_[hidden]> writes:

> Should the following code compile? I think so, based on your
> suggestion, but gcc 3.3 fails (I'm running on
> Mac OS 10.3) at the static assert...

Always post complete error messages. However, in this case your
mistake is pretty obvious.

> #include <boost/static_assert.hpp>
> #include <boost/type_traits.hpp>
>
> #include <boost/mpl/equal.hpp>
> #include <boost/mpl/insert_range.hpp>
> #include <boost/mpl/list.hpp>
>
> struct t1 { };
> struct t2 { };
> struct t3 { };
> struct t4 { };
>
> template<class S1,class S2>
> struct append :
> public boost::mpl::insert_range<S1,boost::mpl::end<S1>,S2>
"::type" is missing---------------------------------------^
> { };
>
> int main()
> {
> typedef boost::mpl::list<t1,t2,t3,t4> l1;
> typedef boost::mpl::list<t4,t3,t2,t1> l2;
>
> typedef append<l1,l2>::type ap1;
>
> typedef boost::mpl::list<t1,t2,t3,t4,t4,t3,t2,t1> l3;
>
> typedef boost::mpl::equal<ap1,l3>::type b1;
>
> BOOST_STATIC_ASSERT((boost::is_same<b1,boost::mpl::true_>::value
> == true));
>
> return 0;
> }

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk