mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-01 05:44:37 +02:00
Merge cherry-picked changes from develop.
This commit is contained in:
@@ -123,7 +123,7 @@ typedef <a href="./next.html" class="identifier">next</a><i<sub>n</sub>>::
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Postcondition:</th><td class="field-body"><p class="first">Equivalent to</p>
|
||||
<pre class="last literal-block">
|
||||
<a href="./for-each.html" class="identifier">for_each</a>< tranform_view<s,op> >( f );
|
||||
<a href="./for-each.html" class="identifier">for_each</a>< <a href="./transform-view.html" class="identifier">transform_view</a><s,op> >( f );
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -141,7 +141,7 @@ struct value_printer
|
||||
{
|
||||
template< typename U > void operator()(U x)
|
||||
{
|
||||
std::cout << x << 'n';
|
||||
std::cout << x << '\n';
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -142,7 +142,7 @@ of <tt class="literal"><span class="pre">l</span></tt> in the same order; see
|
||||
<h3><a class="subsection-title" href="#example" name="example">Example</a></h3>
|
||||
<pre class="literal-block">
|
||||
typedef <a href="./list.html" class="identifier">list</a><float,double,long double> floats;
|
||||
typedef <a href="./push-front.html" class="identifier">push_front</a><floating_types,int>::type types;
|
||||
typedef <a href="./push-front.html" class="identifier">push_front</a><floats,int>::type types;
|
||||
|
||||
<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./front.html" class="identifier">front</a><types>::type, int > ));
|
||||
</pre>
|
||||
|
@@ -102,7 +102,7 @@ Example
|
||||
.. parsed-literal::
|
||||
|
||||
typedef list<float,double,long double> floats;
|
||||
typedef push_front<floating_types,int>::type types;
|
||||
typedef push_front<floats,int>::type types;
|
||||
|
||||
BOOST_MPL_ASSERT(( is_same< front<types>::type, int > ));
|
||||
|
||||
|
@@ -78,7 +78,7 @@ one.</p>
|
||||
</ol>
|
||||
<p>To get a detailed picture of the new apply/lambda semantics, please
|
||||
see the test case at
|
||||
<a class="reference" href="http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/apply.cpp?view=markup" target="_top">http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/apply.cpp?view=markup</a>
|
||||
<a class="reference" href="../../test/apply.cpp" target="_top">libs/mpl/test/apply.cpp</a>
|
||||
and the corresponding sections of the MPL <a class="reference" href="./reference-manual.html">reference manual</a>.</p>
|
||||
<table class="footnote" frame="void" id="id21" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
|
@@ -24,7 +24,7 @@ arguments of different types, and the result will yield the
|
||||
largest/most general of the argument types. The infrastructure
|
||||
allows user-defined numeric types to be freely intermixed with
|
||||
predefined library types. See
|
||||
<a class="reference" href="http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/numeric_ops.cpp?view=markup" target="_top">http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/numeric_ops.cpp?view=markup</a>
|
||||
<a class="reference" href="../../test/numeric_ops.cpp" target="_top">libs/mpl/test/numeric_ops.cpp</a>
|
||||
for an illustrative example, and the <a class="reference" href="./reference-manual.html">reference manual</a> for
|
||||
the formal infrastructure specification.</p>
|
||||
<p>If you were using MPL numeric metafunctions on your own integral
|
||||
|
@@ -14,7 +14,7 @@
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/aux_/preprocessor/def_params_tail.hpp>
|
||||
#include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/aux_/arity_spec.hpp>
|
||||
|
||||
@@ -23,8 +23,7 @@ namespace boost { namespace mpl {
|
||||
template< typename Value > struct always
|
||||
{
|
||||
template<
|
||||
typename T
|
||||
BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(1, typename T, na)
|
||||
BOOST_MPL_PP_DEFAULT_PARAMS(BOOST_MPL_LIMIT_METAFUNCTION_ARITY, typename T, na)
|
||||
>
|
||||
struct apply
|
||||
{
|
||||
@@ -32,7 +31,7 @@ template< typename Value > struct always
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_ARITY_SPEC(1, always)
|
||||
BOOST_MPL_AUX_ARITY_SPEC(0, always)
|
||||
|
||||
}}
|
||||
|
||||
|
@@ -4,8 +4,8 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
@@ -43,7 +43,7 @@ struct eval_if
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,eval_if,(C,F1,F2))
|
||||
};
|
||||
|
||||
// (almost) copy & paste in order to save one more
|
||||
// (almost) copy & paste in order to save one more
|
||||
// recursively nested template instantiation to user
|
||||
template<
|
||||
bool C
|
||||
|
@@ -108,7 +108,9 @@ template<
|
||||
inline
|
||||
void for_each(F f, Sequence* = 0)
|
||||
{
|
||||
for_each<Sequence, identity<> >(f);
|
||||
// jfalcou: fully qualifying this call so it doesnt clash with phoenix::for_each
|
||||
// ons ome compilers -- done on 02/28/2011
|
||||
boost::mpl::for_each<Sequence, identity<> >(f);
|
||||
}
|
||||
|
||||
}}
|
||||
|
@@ -290,18 +290,24 @@ struct trait \
|
||||
# if !defined(BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES)
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
|
||||
# define BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES 1
|
||||
# else
|
||||
# define BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION)
|
||||
# if (defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS))
|
||||
# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 1
|
||||
# else
|
||||
# define BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE)
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
|
||||
# define BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE 1
|
||||
# else
|
||||
# define BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
@@ -32,7 +32,7 @@ struct s_item
|
||||
typedef s_item<T,Base> item_;
|
||||
typedef void_ last_masked_;
|
||||
typedef T item_type_;
|
||||
typedef Base base;
|
||||
typedef typename Base::item_ base;
|
||||
|
||||
typedef typename next< typename Base::size >::type size;
|
||||
typedef typename next< typename Base::order >::type order;
|
||||
@@ -55,7 +55,7 @@ struct s_mask
|
||||
typedef s_mask<T,Base> item_;
|
||||
typedef T last_masked_;
|
||||
typedef void_ item_type_;
|
||||
typedef Base base;
|
||||
typedef typename Base::item_ base;
|
||||
typedef typename prior< typename Base::size >::type size;
|
||||
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper<T>* );
|
||||
@@ -69,7 +69,7 @@ struct s_unmask
|
||||
typedef s_unmask<T,Base> item_;
|
||||
typedef void_ last_masked_;
|
||||
typedef T item_type_;
|
||||
typedef Base base;
|
||||
typedef typename Base::item_ base;
|
||||
typedef typename next< typename Base::size >::type size;
|
||||
|
||||
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper<T>* );
|
||||
|
@@ -22,6 +22,8 @@ MPL_TEST_CASE()
|
||||
{
|
||||
typedef always<true_> always_true;
|
||||
|
||||
MPL_ASSERT(( apply< always_true > ));
|
||||
MPL_ASSERT(( apply0< always_true > ));
|
||||
MPL_ASSERT(( apply1< always_true,false_ > ));
|
||||
MPL_ASSERT(( apply2< always_true,false_,false_ > ));
|
||||
MPL_ASSERT(( apply3< always_true,false_,false_,false_ > ));
|
||||
@@ -31,11 +33,15 @@ MPL_TEST_CASE()
|
||||
MPL_TEST_CASE()
|
||||
{
|
||||
typedef always< int_<10> > always_10;
|
||||
|
||||
|
||||
typedef apply< always_10 >::type res;
|
||||
typedef apply0< always_10 >::type res0;
|
||||
typedef apply1< always_10,int_<0> >::type res1;
|
||||
typedef apply2< always_10,int_<0>,int_<0> >::type res2;
|
||||
typedef apply3< always_10,int_<0>,int_<0>,int_<0> >::type res3;
|
||||
|
||||
|
||||
MPL_ASSERT_RELATION( res::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res0::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res1::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res2::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res3::value, ==, 10 );
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <boost/mpl/set_c.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
|
||||
#include <boost/mpl/aux_/test.hpp>
|
||||
|
||||
@@ -59,6 +60,18 @@ MPL_TEST_CASE()
|
||||
MPL_ASSERT(( is_same< test::at_c<s1,false>::type, void_ > ));
|
||||
MPL_ASSERT(( is_same< test::at_c<s2,true>::type, void_ > ));
|
||||
#endif
|
||||
|
||||
typedef begin<s1>::type first1;
|
||||
typedef end<s1>::type last1;
|
||||
MPL_ASSERT_RELATION( (distance<first1, last1>::value), ==, 1 );
|
||||
|
||||
typedef begin<s2>::type first2;
|
||||
typedef end<s2>::type last2;
|
||||
MPL_ASSERT_RELATION( (distance<first2, last2>::value), ==, 1 );
|
||||
|
||||
typedef begin<s3>::type first3;
|
||||
typedef end<s3>::type last3;
|
||||
MPL_ASSERT_RELATION( (distance<first3, last3>::value), ==, 2 );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -82,4 +95,12 @@ MPL_TEST_CASE()
|
||||
MPL_ASSERT(( is_same< test::at_c<s1,'z'>::type, void_ > ));
|
||||
MPL_ASSERT(( is_same< test::at_c<s2,'k'>::type, void_ > ));
|
||||
#endif
|
||||
|
||||
typedef begin<s1>::type first1;
|
||||
typedef end<s1>::type last1;
|
||||
MPL_ASSERT_RELATION( (distance<first1, last1>::value), ==, 1 );
|
||||
|
||||
typedef begin<s2>::type first2;
|
||||
typedef end<s2>::type last2;
|
||||
MPL_ASSERT_RELATION( (distance<first2, last2>::value), ==, 8 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user