mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-13 04:26:30 +02:00
Compare commits
22 Commits
svn-branch
...
boost-1.40
Author | SHA1 | Date | |
---|---|---|---|
24de9d9fa3 | |||
ea5ea7f001 | |||
df633002dd | |||
d726756148 | |||
efcab8aae4 | |||
5dff610007 | |||
d004046aa5 | |||
a046e43990 | |||
b1ebdd60a6 | |||
0b58f052b3 | |||
36736edec5 | |||
57725cb393 | |||
099deb4385 | |||
d150ba8498 | |||
df2abdab6b | |||
780b8bc1b0 | |||
813930aee6 | |||
9e8d8b1871 | |||
4a29dd2a7c | |||
7bd2fd716d | |||
d57e8cfe9e | |||
ed9cb87ac3 |
@ -1,3 +1,9 @@
|
||||
#
|
||||
# Copyright Troy D. Straszheim
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# See http://www.boost.org/LICENSE_1_0.txt
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# This file was automatically generated from the original CMakeLists.txt file
|
||||
# Add a variable to hold the headers for the library
|
||||
|
@ -9,6 +9,8 @@ project boost/libs/fusion/doc ;
|
||||
import boostbook : boostbook ;
|
||||
using quickbook ;
|
||||
|
||||
path-constant images_location : html ;
|
||||
|
||||
boostbook quickbook
|
||||
:
|
||||
fusion.qbk
|
||||
@ -21,5 +23,9 @@ boostbook quickbook
|
||||
<xsl:param>toc.section.depth=3
|
||||
<xsl:param>toc.max.depth=3
|
||||
<xsl:param>generate.section.toc.level=4
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/fusion/doc/html
|
||||
<format>pdf:<xsl:param>img.src.path=$(images_location)/
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
@ -28,13 +28,7 @@ namespace boost { namespace fusion
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::at<typename Sequence::types, N> element;
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<Sequence>
|
||||
, detail::cref_result<element>
|
||||
, detail::ref_result<element>
|
||||
>::type
|
||||
type;
|
||||
typedef typename detail::ref_result<element>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
@ -42,6 +36,19 @@ namespace boost { namespace fusion
|
||||
return v.at_impl(N());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sequence, typename N>
|
||||
struct apply <Sequence const, N>
|
||||
{
|
||||
typedef mpl::at<typename Sequence::types, N> element;
|
||||
typedef typename detail::cref_result<element>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence const& v)
|
||||
{
|
||||
return v.at_impl(N());
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
@ -25,11 +25,12 @@
|
||||
#include <boost/fusion/container/vector/vector50.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/distance.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -38,40 +39,23 @@ namespace boost { namespace fusion
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct get_vector_n;
|
||||
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
|
||||
struct vector_n_chooser
|
||||
{
|
||||
typedef BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE)<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct get_vector_n<0>
|
||||
struct vector_n_chooser<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, void_ BOOST_PP_INTERCEPT)>
|
||||
{
|
||||
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
|
||||
struct call
|
||||
{
|
||||
typedef vector0 type;
|
||||
};
|
||||
typedef vector0 type;
|
||||
};
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/container/vector/detail/vector_n_chooser.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
|
||||
#define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_DEC(FUSION_MAX_VECTOR_SIZE))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
|
||||
struct vector_n_chooser
|
||||
{
|
||||
typedef
|
||||
mpl::BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE)
|
||||
<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>
|
||||
input;
|
||||
|
||||
typedef typename mpl::begin<input>::type begin;
|
||||
typedef typename mpl::find<input, void_>::type end;
|
||||
typedef typename mpl::distance<begin, end>::type size;
|
||||
|
||||
typedef typename get_vector_n<size::value>::template
|
||||
call<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
|
||||
type;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@ -85,14 +69,12 @@ namespace boost { namespace fusion { namespace detail
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template <>
|
||||
struct get_vector_n<N>
|
||||
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
|
||||
struct vector_n_chooser<
|
||||
BOOST_PP_ENUM_PARAMS(N, T)
|
||||
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(FUSION_MAX_VECTOR_SIZE, N), void_ BOOST_PP_INTERCEPT)>
|
||||
{
|
||||
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
|
||||
struct call
|
||||
{
|
||||
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
|
||||
};
|
||||
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
|
||||
};
|
||||
|
||||
#undef N
|
||||
|
@ -91,14 +91,14 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
at_c(Sequence& seq)
|
||||
{
|
||||
return at<mpl::int_<N> >(seq);
|
||||
return fusion::at<mpl::int_<N> >(seq);
|
||||
}
|
||||
|
||||
template <int N, typename Sequence>
|
||||
inline typename result_of::at_c<Sequence const, N>::type
|
||||
at_c(Sequence const& seq)
|
||||
{
|
||||
return at<mpl::int_<N> >(seq);
|
||||
return fusion::at<mpl::int_<N> >(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
|
@ -7,12 +7,8 @@
|
||||
#if !defined(FUSION_ACCESS_04182005_0737)
|
||||
#define FUSION_ACCESS_04182005_0737
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
@ -33,22 +29,35 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct non_ref_parameter
|
||||
struct call_param
|
||||
{
|
||||
typedef typename boost::remove_cv<T>::type const& type;
|
||||
typedef T const& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_param
|
||||
struct call_param<T &>
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_reference<T>
|
||||
, mpl::identity<T>
|
||||
, non_ref_parameter<T>
|
||||
>::type
|
||||
type;
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_param<T const>
|
||||
{
|
||||
typedef T const& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_param<T volatile>
|
||||
{
|
||||
typedef T const& type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_param<T const volatile>
|
||||
{
|
||||
typedef T const& type;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
1
module.cmake
Normal file
1
module.cmake
Normal file
@ -0,0 +1 @@
|
||||
boost_module (fusion DEPENDS function_types)
|
@ -1,29 +0,0 @@
|
||||
#=============================================================================
|
||||
# Copyright (c) 2008 Dan Marsden
|
||||
#
|
||||
# Use modification and distribution are subject to 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).
|
||||
#==============================================================================
|
||||
|
||||
CXX=g++
|
||||
CXXFLAGS=-I$(BOOST_ROOT)
|
||||
|
||||
TEST_SRCS=\
|
||||
vector_construction.cpp\
|
||||
vector_iteration.cpp\
|
||||
vector_intrinsic.cpp\
|
||||
fold.cpp\
|
||||
transform.cpp
|
||||
|
||||
TEST_OBJS=$(TEST_SRCS:.cpp=.o)
|
||||
|
||||
TEST_TARGETS=$(TEST_SRCS:.cpp=.test)
|
||||
|
||||
all: $(TEST_TARGETS)
|
||||
|
||||
%.test : %.cpp
|
||||
time $(CXX) $(CXXFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(TEST_TARGETS) $(TEST_OBJS)
|
@ -1,75 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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).
|
||||
==============================================================================*/
|
||||
|
||||
#if !defined(BOOST_FUSION_COMPILE_TIME_DRIVER)
|
||||
#define BOOST_FUSION_COMPILE_TIME_DRIVER
|
||||
|
||||
int main()
|
||||
{
|
||||
test<0>();
|
||||
test<1>();
|
||||
test<2>();
|
||||
test<3>();
|
||||
test<4>();
|
||||
|
||||
test<5>();
|
||||
test<6>();
|
||||
test<7>();
|
||||
test<8>();
|
||||
test<9>();
|
||||
|
||||
test<10>();
|
||||
test<11>();
|
||||
test<12>();
|
||||
test<13>();
|
||||
test<14>();
|
||||
|
||||
test<15>();
|
||||
test<16>();
|
||||
test<17>();
|
||||
test<18>();
|
||||
test<19>();
|
||||
|
||||
test<20>();
|
||||
test<21>();
|
||||
test<22>();
|
||||
test<23>();
|
||||
test<24>();
|
||||
|
||||
test<25>();
|
||||
test<26>();
|
||||
test<27>();
|
||||
test<28>();
|
||||
test<29>();
|
||||
|
||||
test<30>();
|
||||
test<31>();
|
||||
test<32>();
|
||||
test<33>();
|
||||
test<34>();
|
||||
|
||||
test<35>();
|
||||
test<36>();
|
||||
test<37>();
|
||||
test<38>();
|
||||
test<39>();
|
||||
|
||||
test<40>();
|
||||
test<41>();
|
||||
test<42>();
|
||||
test<43>();
|
||||
test<44>();
|
||||
|
||||
test<45>();
|
||||
test<46>();
|
||||
test<47>();
|
||||
test<48>();
|
||||
test<49>();
|
||||
}
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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 <boost/fusion/include/fold.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
struct f
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
template<int n, int batch>
|
||||
int operator()(distinct<n, batch> const& d, int state) const
|
||||
{
|
||||
return state + n;
|
||||
}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
fusion::fold(v, 0, f());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
@ -1,55 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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 <boost/fusion/include/transform.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{
|
||||
static const int value = n;
|
||||
};
|
||||
|
||||
struct f
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
template<typename T>
|
||||
result_type operator()(T const& t) const
|
||||
{
|
||||
return T::value;
|
||||
}
|
||||
};
|
||||
|
||||
struct touch
|
||||
{
|
||||
template<typename T>
|
||||
void operator()(T const&) const
|
||||
{}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
// We're testing transform really
|
||||
// for_each call is to force iteration through the lazy
|
||||
// transform, otherwise very little will happen.
|
||||
fusion::for_each(fusion::transform(v, f()), touch());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
@ -1,28 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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 <boost/fusion/include/vector.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
@ -1,59 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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 <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/intrinsic.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
typedef fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v_type;
|
||||
|
||||
v_type v;
|
||||
|
||||
fusion::at_c<0>(v);
|
||||
fusion::at_c<1>(v);
|
||||
fusion::at_c<2>(v);
|
||||
fusion::at_c<3>(v);
|
||||
fusion::at_c<4>(v);
|
||||
|
||||
fusion::at_c<5>(v);
|
||||
fusion::at_c<6>(v);
|
||||
fusion::at_c<7>(v);
|
||||
fusion::at_c<8>(v);
|
||||
fusion::at_c<9>(v);
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 0>::type va0;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 1>::type va1;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 2>::type va2;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 3>::type va3;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 4>::type va4;
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 5>::type va5;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 6>::type va6;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 7>::type va7;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 8>::type va8;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 9>::type va9;
|
||||
|
||||
fusion::begin(v);
|
||||
fusion::end(v);
|
||||
fusion::size(v);
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
@ -1,38 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2008 Dan Marsden
|
||||
|
||||
Use modification and distribution are subject to 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 <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
namespace
|
||||
{
|
||||
template<int n, int batch>
|
||||
struct distinct
|
||||
{};
|
||||
|
||||
struct null_op
|
||||
{
|
||||
template<typename T>
|
||||
void operator()(T const& t) const
|
||||
{}
|
||||
};
|
||||
|
||||
template<int batch>
|
||||
void test()
|
||||
{
|
||||
fusion::vector<
|
||||
distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
|
||||
distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
|
||||
|
||||
fusion::for_each(v, null_op());
|
||||
}
|
||||
}
|
||||
|
||||
#include "./driver.hpp"
|
Reference in New Issue
Block a user