mirror of
https://github.com/boostorg/mpl.git
synced 2026-08-04 04:34:09 +02:00
Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0341108f6b | |||
| 2b6fba6f6c | |||
| e6bca9d8fc | |||
| 0b6167c840 | |||
| f976861e13 | |||
| ed58434c88 | |||
| 1f482c4fa1 | |||
| d032c78c1d | |||
| e5e30a45a4 | |||
| 7f823bec1c | |||
| cafafafea3 | |||
| de26efa6ea | |||
| 04d02649d8 | |||
| db7e720ce1 | |||
| 51b8f0e100 | |||
| 77651e4aa1 | |||
| 0be4fc4b34 | |||
| 858652cd0d | |||
| 8a2e64723c | |||
| 27815b8d37 | |||
| ea6c446ad6 | |||
| bf895af8f7 | |||
| d1a05aed0a | |||
| 2d3c8f076d | |||
| 94154603ec | |||
| 74fef329d4 | |||
| 3bf644fc10 | |||
| 8886e3d7da | |||
| e174e49e32 | |||
| 11b9928353 | |||
| 4cee88eae9 | |||
| acdd0e5a92 | |||
| ec73776cbd | |||
| cccddd65c7 | |||
| 3e3b4aeef2 | |||
| 2c77a2b9c1 | |||
| c77da6a6da | |||
| eccea8a324 | |||
| 553aa2e52f | |||
| f580ae3b0a | |||
| b519e4b12b | |||
| d6d7e5abe0 | |||
| 2a61f750a9 | |||
| 9b42f0453e | |||
| 61d75128b4 | |||
| d2fcd238d6 | |||
| 27b31c31be | |||
| 8143a00562 | |||
| 18d0db5b5c | |||
| 76dab04fa9 | |||
| 50865751ae | |||
| 83d7bb938f | |||
| 310ab7a6ce | |||
| 403aea61fe | |||
| 3b026baefe | |||
| 76a5c4cf54 | |||
| cefaca1789 | |||
| de207e3775 | |||
| 8951fa2a3b | |||
| 67f5d73999 | |||
| 50f26179f6 | |||
| 0e065bc65a | |||
| d6c3a16e1e | |||
| aa8e43a017 | |||
| 7d2a04eea3 | |||
| f8e9b04e6a | |||
| de377710d4 | |||
| fc13a7ac60 | |||
| 7cd1d88886 | |||
| 08c6156599 | |||
| 2a2c4d2895 | |||
| 6f63e9d0c6 | |||
| 45d0bcadc2 | |||
| ff2df79e35 | |||
| a5ba971297 | |||
| 360322e894 | |||
| 52d8442055 | |||
| b6e98cdd5a | |||
| cc82b7a924 | |||
| 4678423fee | |||
| 38e0d6157f | |||
| 9e7f06d29b | |||
| ae88433250 | |||
| b74cf94d04 | |||
| d38f271fae | |||
| c1de64359f |
@@ -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)
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// 'or' and 'and' macros, see http://tinyurl.com/3et69; 'defined(and)'
|
||||
// has to be checked in a separate condition, otherwise GCC complains
|
||||
// about 'and' being an alternative token
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(and)
|
||||
# pragma push_macro("and")
|
||||
@@ -41,7 +41,7 @@
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER and.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(and)
|
||||
# pragma pop_macro("and")
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/mpl/aux_/config/dtp.hpp>
|
||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
#include <boost/mpl/aux_/config/pp_counter.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
@@ -55,7 +56,7 @@
|
||||
// and GCC (which issues "unused variable" warnings when static constants are used
|
||||
// at a function scope)
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|
||||
|| (BOOST_MPL_CFG_GCC != 0)
|
||||
|| (BOOST_MPL_CFG_GCC != 0) || (BOOST_MPL_CFG_GPU != 0)
|
||||
# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
|
||||
#else
|
||||
# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) BOOST_STATIC_CONSTANT(T, expr)
|
||||
@@ -134,7 +135,7 @@ template< assert_::relations r, long x, long y > struct assert_relation {};
|
||||
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1700)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1700)
|
||||
|
||||
template<class Pred>
|
||||
struct extract_assert_pred;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED
|
||||
|
||||
// Copyright Eric Niebler 2014
|
||||
//
|
||||
// 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.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_GPU_ENABLED) \
|
||||
|
||||
# define BOOST_MPL_CFG_GPU_ENABLED BOOST_GPU_ENABLED
|
||||
|
||||
#endif
|
||||
|
||||
#if defined __CUDACC__
|
||||
|
||||
# define BOOST_MPL_CFG_GPU 1
|
||||
|
||||
#else
|
||||
|
||||
# define BOOST_MPL_CFG_GPU 0
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED
|
||||
@@ -24,6 +24,7 @@
|
||||
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 245) \
|
||||
|| BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \
|
||||
|| BOOST_WORKAROUND(__NVCC__, BOOST_TESTED_AT(1)) \
|
||||
)
|
||||
|
||||
# define BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING
|
||||
|
||||
@@ -77,7 +77,7 @@ struct AUX_WRAPPER_NAME
|
||||
// functions that return objects of both arithmetic ('int', 'long',
|
||||
// 'double', etc.) and wrapped integral types (for an example, see
|
||||
// "mpl/example/power.cpp")
|
||||
operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast<AUX_WRAPPER_VALUE_TYPE>(this->value); }
|
||||
BOOST_CONSTEXPR operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast<AUX_WRAPPER_VALUE_TYPE>(this->value); }
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
// $Revision$
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
|
||||
namespace boost { namespace mpl { namespace aux {
|
||||
|
||||
template< typename F >
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
inline
|
||||
F& unwrap(F& f, long)
|
||||
{
|
||||
@@ -27,6 +29,7 @@ F& unwrap(F& f, long)
|
||||
}
|
||||
|
||||
template< typename F >
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
inline
|
||||
F&
|
||||
unwrap(reference_wrapper<F>& f, int)
|
||||
@@ -35,6 +38,7 @@ unwrap(reference_wrapper<F>& f, int)
|
||||
}
|
||||
|
||||
template< typename F >
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
inline
|
||||
F&
|
||||
unwrap(reference_wrapper<F> const& f, int)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// macros, see http://tinyurl.com/ycwdxco; 'defined(bitand)'
|
||||
// has to be checked in a separate condition, otherwise GCC complains
|
||||
// about 'bitand' being an alternative token
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(bitand)
|
||||
# pragma push_macro("bitand")
|
||||
@@ -34,7 +34,7 @@
|
||||
#define AUX778076_OP_TOKEN &
|
||||
#include <boost/mpl/aux_/arithmetic_op.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(bitand)
|
||||
# pragma pop_macro("bitand")
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// macros, see http://tinyurl.com/ycwdxco; 'defined(bitor)'
|
||||
// has to be checked in a separate condition, otherwise GCC complains
|
||||
// about 'bitor' being an alternative token
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(bitor)
|
||||
# pragma push_macro("bitor")
|
||||
@@ -34,7 +34,7 @@
|
||||
#define AUX778076_OP_TOKEN |
|
||||
#include <boost/mpl/aux_/arithmetic_op.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(bitor)
|
||||
# pragma pop_macro("bitor")
|
||||
|
||||
@@ -26,7 +26,7 @@ template< bool C_ > struct bool_
|
||||
typedef integral_c_tag tag;
|
||||
typedef bool_ type;
|
||||
typedef bool value_type;
|
||||
operator bool() const { return this->value; }
|
||||
BOOST_CONSTEXPR operator bool() const { return this->value; }
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
#include <boost/mpl/aux_/unwrap.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -40,6 +41,7 @@ struct for_each_impl
|
||||
, typename TransformFunc
|
||||
, typename F
|
||||
>
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
static void execute(
|
||||
Iterator*
|
||||
, LastIterator*
|
||||
@@ -59,6 +61,7 @@ struct for_each_impl<false>
|
||||
, typename TransformFunc
|
||||
, typename F
|
||||
>
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
static void execute(
|
||||
Iterator*
|
||||
, LastIterator*
|
||||
@@ -89,6 +92,7 @@ template<
|
||||
, typename TransformOp
|
||||
, typename F
|
||||
>
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
inline
|
||||
void for_each(F f, Sequence* = 0, TransformOp* = 0)
|
||||
{
|
||||
@@ -105,10 +109,13 @@ template<
|
||||
typename Sequence
|
||||
, typename F
|
||||
>
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
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);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -155,10 +155,11 @@ template<> struct trait<T> \
|
||||
// SFINAE-based implementations below are derived from a USENET newsgroup's
|
||||
// posting by Rani Sharoni (comp.lang.c++.moderated, 2002-03-17 07:45:09 PST)
|
||||
|
||||
# elif BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|
||||
# elif BOOST_WORKAROUND(BOOST_MSVC, <= 1400) \
|
||||
|| (BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1800)) && defined(__CUDACC__)) \
|
||||
|| BOOST_WORKAROUND(__IBMCPP__, <= 700)
|
||||
|
||||
// MSVC 7.1+ & VACPP
|
||||
// MSVC 7.1 & MSVC 8.0 & VACPP
|
||||
|
||||
// agurt, 15/jun/05: replace overload-based SFINAE implementation with SFINAE
|
||||
// applied to partial specialization to fix some apparently random failures
|
||||
@@ -290,18 +291,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
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// 'or' and 'and' macros, see http://tinyurl.com/3et69; 'defined(or)'
|
||||
// has to be checked in a separate condition, otherwise GCC complains
|
||||
// about 'or' being an alternative token
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(or)
|
||||
# pragma push_macro("or")
|
||||
@@ -42,7 +42,7 @@
|
||||
# define BOOST_MPL_PREPROCESSED_HEADER or.hpp
|
||||
# include <boost/mpl/aux_/include_preprocessed.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#ifndef __GCCXML__
|
||||
#if defined(or)
|
||||
# pragma pop_macro("or")
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace aux {
|
||||
static const unsigned value = 1;
|
||||
};
|
||||
#endif
|
||||
} // namespace aux
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template <class T>
|
||||
struct print
|
||||
@@ -47,7 +46,9 @@ struct print
|
||||
, aux::print_base
|
||||
#endif
|
||||
{
|
||||
#if defined(BOOST_MSVC)
|
||||
#if defined(__clang__)
|
||||
const int m_x = 1 / (sizeof(T) - sizeof(T));
|
||||
#elif defined(BOOST_MSVC)
|
||||
enum { n = sizeof(T) + -1 };
|
||||
#elif defined(__MWERKS__)
|
||||
void f(int);
|
||||
|
||||
@@ -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>* );
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
#include <boost/predef/other/endian.h>
|
||||
#include <boost/mpl/limits/string.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/char.hpp>
|
||||
@@ -59,7 +59,7 @@ namespace boost { namespace mpl
|
||||
#define BOOST_MPL_MULTICHAR_LENGTH(c) \
|
||||
(std::size_t)((c<CHAR_MIN) ? 4 : ((c>0xffffff)+(c>0xffff)+(c>0xff)+1))
|
||||
|
||||
#if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC)
|
||||
#if defined(BOOST_ENDIAN_LITTLE_BYTE) && defined(__SUNPRO_CC)
|
||||
|
||||
#define BOOST_MPL_MULTICHAR_AT(c,i) \
|
||||
(char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i))))
|
||||
|
||||
+9
-3
@@ -1,8 +1,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.
|
||||
@@ -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_ > ));
|
||||
@@ -30,12 +32,16 @@ MPL_TEST_CASE()
|
||||
|
||||
MPL_TEST_CASE()
|
||||
{
|
||||
typedef always< int_<10> > always_10;
|
||||
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 );
|
||||
|
||||
+6
-6
@@ -37,9 +37,9 @@ MPL_TEST_CASE()
|
||||
MPL_ASSERT_RELATION( (bitor_<_0,_0>::value), ==, 0 );
|
||||
MPL_ASSERT_RELATION( (bitor_<_1,_0>::value), ==, 1 );
|
||||
MPL_ASSERT_RELATION( (bitor_<_0,_1>::value), ==, 1 );
|
||||
MPL_ASSERT_RELATION( (bitor_<_0,_ffffffff>::value), ==, 0xffffffff );
|
||||
MPL_ASSERT_RELATION( (bitor_<_1,_ffffffff>::value), ==, 0xffffffff );
|
||||
MPL_ASSERT_RELATION( (bitor_<_8,_ffffffff>::value), ==, 0xffffffff );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitor_<_0,_ffffffff>::value), ==, static_cast<long>(0xffffffff) );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitor_<_1,_ffffffff>::value), ==, static_cast<long>(0xffffffff) );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitor_<_8,_ffffffff>::value), ==, static_cast<long>(0xffffffff) );
|
||||
}
|
||||
|
||||
MPL_TEST_CASE()
|
||||
@@ -47,9 +47,9 @@ MPL_TEST_CASE()
|
||||
MPL_ASSERT_RELATION( (bitxor_<_0,_0>::value), ==, 0 );
|
||||
MPL_ASSERT_RELATION( (bitxor_<_1,_0>::value), ==, 1 );
|
||||
MPL_ASSERT_RELATION( (bitxor_<_0,_1>::value), ==, 1 );
|
||||
MPL_ASSERT_RELATION( (bitxor_<_0,_ffffffff>::value), ==, (0xffffffff ^ 0) );
|
||||
MPL_ASSERT_RELATION( (bitxor_<_1,_ffffffff>::value), ==, (0xffffffff ^ 1) );
|
||||
MPL_ASSERT_RELATION( (bitxor_<_8,_ffffffff>::value), ==, (0xffffffff ^ 8) );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitxor_<_0,_ffffffff>::value), ==, static_cast<long>(0xffffffff ^ 0) );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitxor_<_1,_ffffffff>::value), ==, static_cast<long>(0xffffffff ^ 1) );
|
||||
MPL_ASSERT_RELATION( static_cast<long>(bitxor_<_8,_ffffffff>::value), ==, static_cast<long>(0xffffffff ^ 8) );
|
||||
}
|
||||
|
||||
MPL_TEST_CASE()
|
||||
|
||||
@@ -16,11 +16,18 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
#define CONSTEXPR_BOOL_TEST(c)
|
||||
#else
|
||||
#define CONSTEXPR_BOOL_TEST(c) { static_assert(bool_<c>() == c, "Constexpr for bool_ failed"); }
|
||||
#endif
|
||||
|
||||
#define BOOL_TEST(c) \
|
||||
{ MPL_ASSERT(( is_same< bool_<c>::value_type, bool > )); } \
|
||||
{ MPL_ASSERT(( is_same< bool_<c>, c##_ > )); } \
|
||||
{ MPL_ASSERT(( is_same< bool_<c>::type, bool_<c> > )); } \
|
||||
{ MPL_ASSERT_RELATION( bool_<c>::value, ==, c ); } \
|
||||
CONSTEXPR_BOOL_TEST(c) \
|
||||
BOOST_TEST( bool_<c>() == c ); \
|
||||
/**/
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
/**/
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
#define CONSTEXPR_INTEGRAL_TEST(T, i)
|
||||
#else
|
||||
#define CONSTEXPR_INTEGRAL_TEST(T, i) { static_assert(T() == i, "Constexpr for integral constant failed"); }
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
|
||||
// agurt 20/nov/06: see http://article.gmane.org/gmane.comp.lib.boost.devel/151065
|
||||
#define INTEGRAL_WRAPPER_TEST(unused1, i, T) \
|
||||
@@ -39,6 +45,7 @@
|
||||
{ MPL_ASSERT(( is_same< next< borland_tested_type >::type, WRAPPER(T,i+1) > )); } \
|
||||
{ MPL_ASSERT(( is_same< prior< borland_tested_type >::type, WRAPPER(T,i-1) > )); } \
|
||||
{ MPL_ASSERT_RELATION( (borland_tested_type::value), ==, i ); } \
|
||||
CONSTEXPR_INTEGRAL_TEST(borland_tested_type, i) \
|
||||
INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
||||
} \
|
||||
/**/
|
||||
@@ -49,6 +56,7 @@
|
||||
{ MPL_ASSERT(( is_same< next< WRAPPER(T,i) >::type, WRAPPER(T,i+1) > )); } \
|
||||
{ MPL_ASSERT(( is_same< prior< WRAPPER(T,i) >::type, WRAPPER(T,i-1) > )); } \
|
||||
{ MPL_ASSERT_RELATION( (WRAPPER(T,i)::value), ==, i ); } \
|
||||
CONSTEXPR_INTEGRAL_TEST(WRAPPER(T,i), i) \
|
||||
INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
||||
/**/
|
||||
#endif
|
||||
|
||||
@@ -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