diff --git a/include/boost/fusion/sequence/intrinsic/size.hpp b/include/boost/fusion/sequence/intrinsic/size.hpp index 1119980d..97aa3ef9 100644 --- a/include/boost/fusion/sequence/intrinsic/size.hpp +++ b/include/boost/fusion/sequence/intrinsic/size.hpp @@ -49,10 +49,10 @@ namespace boost { namespace fusion template struct apply : Sequence::template size {}; }; - + template <> struct size_impl; - + template <> struct size_impl; @@ -67,14 +67,10 @@ namespace boost { namespace fusion { template struct size - : extension::size_impl::type>:: - template apply - - { - typedef typename extension::size_impl::type>:: - template apply::type size_application; - BOOST_STATIC_CONSTANT(int, value = size_application::value); - }; + : mpl::int_< + extension::size_impl::type> + ::template apply::type::value + > {}; } template diff --git a/test/Jamfile b/test/Jamfile index e74b7a95..f28589b7 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -161,6 +161,8 @@ project [ run sequence/ref_vector.cpp : : : : ] [ run sequence/flatten_view.cpp : : : : ] + [ compile sequence/size.cpp : : : : ] + [ run functional/fused.cpp : : : : ] [ run functional/fused_function_object.cpp : : : : ] [ run functional/fused_procedure.cpp : : : : ] diff --git a/test/sequence/size.cpp b/test/sequence/size.cpp new file mode 100644 index 00000000..f8254dad --- /dev/null +++ b/test/sequence/size.cpp @@ -0,0 +1,101 @@ +/*============================================================================= + Copyright (c) 2014 Kohei Takahashi + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +#include +#include +#endif + +template +void check_(LHS const&, RHS const&) +{ + BOOST_MPL_ASSERT((boost::is_same)); +} + +template +void check() +{ + check_( + boost::fusion::result_of::size::type::value + , boost::fusion::result_of::size::value + ); +} + +void test() +{ + { + check >(); + check >(); + check >(); + check >(); + } + + { + check >(); + check >(); + check >(); + check >(); + } + + { + check >(); + check >(); + check >(); + check >(); + } + + { + check >(); + check >(); + check >(); + check >(); + } + + { + check >(); + check > >(); + check , boost::fusion::pair > >(); + check , boost::fusion::pair , boost::fusion::pair > >(); + } + + { + check >(); + check >(); + check >(); + } + + { + check >(); + check >(); + check >(); + check >(); + } + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) + { + check >(); + check >(); + check >(); + check >(); + } +#endif +} +