forked from boostorg/fusion
Initial move from Spirit CVS
[SVN r34896]
This commit is contained in:
96
.gitattributes
vendored
Normal file
96
.gitattributes
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
* text=auto !eol svneol=native#text/plain
|
||||
*.gitattributes text svneol=native#text/plain
|
||||
|
||||
# Scriptish formats
|
||||
*.bat text svneol=native#text/plain
|
||||
*.bsh text svneol=native#text/x-beanshell
|
||||
*.cgi text svneol=native#text/plain
|
||||
*.cmd text svneol=native#text/plain
|
||||
*.js text svneol=native#text/javascript
|
||||
*.php text svneol=native#text/x-php
|
||||
*.pl text svneol=native#text/x-perl
|
||||
*.pm text svneol=native#text/x-perl
|
||||
*.py text svneol=native#text/x-python
|
||||
*.sh eol=lf svneol=LF#text/x-sh
|
||||
configure eol=lf svneol=LF#text/x-sh
|
||||
|
||||
# Image formats
|
||||
*.bmp binary svneol=unset#image/bmp
|
||||
*.gif binary svneol=unset#image/gif
|
||||
*.ico binary svneol=unset#image/ico
|
||||
*.jpeg binary svneol=unset#image/jpeg
|
||||
*.jpg binary svneol=unset#image/jpeg
|
||||
*.png binary svneol=unset#image/png
|
||||
*.tif binary svneol=unset#image/tiff
|
||||
*.tiff binary svneol=unset#image/tiff
|
||||
*.svg text svneol=native#image/svg%2Bxml
|
||||
|
||||
# Data formats
|
||||
*.pdf binary svneol=unset#application/pdf
|
||||
*.avi binary svneol=unset#video/avi
|
||||
*.doc binary svneol=unset#application/msword
|
||||
*.dsp text svneol=crlf#text/plain
|
||||
*.dsw text svneol=crlf#text/plain
|
||||
*.eps binary svneol=unset#application/postscript
|
||||
*.gz binary svneol=unset#application/gzip
|
||||
*.mov binary svneol=unset#video/quicktime
|
||||
*.mp3 binary svneol=unset#audio/mpeg
|
||||
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
|
||||
*.ps binary svneol=unset#application/postscript
|
||||
*.psd binary svneol=unset#application/photoshop
|
||||
*.rdf binary svneol=unset#text/rdf
|
||||
*.rss text svneol=unset#text/xml
|
||||
*.rtf binary svneol=unset#text/rtf
|
||||
*.sln text svneol=native#text/plain
|
||||
*.swf binary svneol=unset#application/x-shockwave-flash
|
||||
*.tgz binary svneol=unset#application/gzip
|
||||
*.vcproj text svneol=native#text/xml
|
||||
*.vcxproj text svneol=native#text/xml
|
||||
*.vsprops text svneol=native#text/xml
|
||||
*.wav binary svneol=unset#audio/wav
|
||||
*.xls binary svneol=unset#application/vnd.ms-excel
|
||||
*.zip binary svneol=unset#application/zip
|
||||
|
||||
# Text formats
|
||||
.htaccess text svneol=native#text/plain
|
||||
*.bbk text svneol=native#text/xml
|
||||
*.cmake text svneol=native#text/plain
|
||||
*.css text svneol=native#text/css
|
||||
*.dtd text svneol=native#text/xml
|
||||
*.htm text svneol=native#text/html
|
||||
*.html text svneol=native#text/html
|
||||
*.ini text svneol=native#text/plain
|
||||
*.log text svneol=native#text/plain
|
||||
*.mak text svneol=native#text/plain
|
||||
*.qbk text svneol=native#text/plain
|
||||
*.rst text svneol=native#text/plain
|
||||
*.sql text svneol=native#text/x-sql
|
||||
*.txt text svneol=native#text/plain
|
||||
*.xhtml text svneol=native#text/xhtml%2Bxml
|
||||
*.xml text svneol=native#text/xml
|
||||
*.xsd text svneol=native#text/xml
|
||||
*.xsl text svneol=native#text/xml
|
||||
*.xslt text svneol=native#text/xml
|
||||
*.xul text svneol=native#text/xul
|
||||
*.yml text svneol=native#text/plain
|
||||
boost-no-inspect text svneol=native#text/plain
|
||||
CHANGES text svneol=native#text/plain
|
||||
COPYING text svneol=native#text/plain
|
||||
INSTALL text svneol=native#text/plain
|
||||
Jamfile text svneol=native#text/plain
|
||||
Jamroot text svneol=native#text/plain
|
||||
Jamfile.v2 text svneol=native#text/plain
|
||||
Jamrules text svneol=native#text/plain
|
||||
Makefile* text svneol=native#text/plain
|
||||
README text svneol=native#text/plain
|
||||
TODO text svneol=native#text/plain
|
||||
|
||||
# Code formats
|
||||
*.c text svneol=native#text/plain
|
||||
*.cpp text svneol=native#text/plain
|
||||
*.h text svneol=native#text/plain
|
||||
*.hpp text svneol=native#text/plain
|
||||
*.ipp text svneol=native#text/plain
|
||||
*.tpp text svneol=native#text/plain
|
||||
*.jam text svneol=native#text/plain
|
||||
*.java text svneol=native#text/plain
|
15
include/boost/fusion/algorithm.hpp
Normal file
15
include/boost/fusion/algorithm.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALGORITHM_10022005_0549)
|
||||
#define FUSION_ALGORITHM_10022005_0549
|
||||
|
||||
#include <boost/fusion/algorithm/iteration.hpp>
|
||||
#include <boost/fusion/algorithm/query.hpp>
|
||||
#include <boost/fusion/algorithm/transformation.hpp>
|
||||
|
||||
#endif
|
15
include/boost/fusion/algorithm/iteration.hpp
Normal file
15
include/boost/fusion/algorithm/iteration.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALGORITHM_ITERATION_10022005_0549)
|
||||
#define FUSION_ALGORITHM_ITERATION_10022005_0549
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||
|
||||
#endif
|
66
include/boost/fusion/algorithm/iteration/accumulate.hpp
Normal file
66
include/boost/fusion/algorithm/iteration/accumulate.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ACCUMULATE_09172005_1032)
|
||||
#define FUSION_ACCUMULATE_09172005_1032
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename State, typename F>
|
||||
struct accumulate
|
||||
{
|
||||
typedef typename
|
||||
detail::static_fold<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename State, typename F>
|
||||
inline typename result_of::accumulate<Sequence, State, F>::type
|
||||
accumulate(Sequence& seq, State const& state, F const& f)
|
||||
{
|
||||
return detail::fold(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>()
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename State, typename F>
|
||||
inline typename result_of::accumulate<Sequence const, State, F>::type
|
||||
accumulate(Sequence const& seq, State const& state, F const& f)
|
||||
{
|
||||
return detail::fold(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename result_of::begin<Sequence const>::type
|
||||
, typename result_of::end<Sequence const>::type>()
|
||||
);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
99
include/boost/fusion/algorithm/iteration/detail/fold.hpp
Normal file
99
include/boost/fusion/algorithm/iteration/detail/fold.hpp
Normal file
@ -0,0 +1,99 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FOLD_05052005_1211)
|
||||
#define FUSION_FOLD_05052005_1211
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
// Unary arguments version
|
||||
|
||||
template <typename F>
|
||||
struct apply_fold_result
|
||||
{
|
||||
template <typename Value, typename State>
|
||||
struct apply
|
||||
{
|
||||
typedef typename F::template result<Value, State>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Iterator, typename State, typename F>
|
||||
struct fold_apply
|
||||
: mpl::apply<apply_fold_result<F>, typename result_of::value_of<Iterator>::type, State>
|
||||
{};
|
||||
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
struct static_fold;
|
||||
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
struct next_result_of_fold
|
||||
{
|
||||
typedef typename
|
||||
static_fold<
|
||||
typename result_of::next<First>::type
|
||||
, Last
|
||||
, typename fold_apply<First, State, F>::type
|
||||
, F
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
struct static_fold
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
result_of::equal_to<First, Last>
|
||||
, mpl::identity<State>
|
||||
, next_result_of_fold<First, Last, State, F>
|
||||
>::type
|
||||
result;
|
||||
|
||||
typedef typename result::type type;
|
||||
};
|
||||
|
||||
// terminal case
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
inline State const&
|
||||
fold(First const&, Last const&, State const& state, F const&, mpl::true_)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
// non-terminal case
|
||||
template <typename First, typename Last, typename State, typename F>
|
||||
inline typename static_fold<First, Last, State, F>::type
|
||||
fold(
|
||||
First const& first
|
||||
, Last const& last
|
||||
, State const& state
|
||||
, F const& f
|
||||
, mpl::false_)
|
||||
{
|
||||
return detail::fold(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f(*first, state)
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>()
|
||||
);
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
35
include/boost/fusion/algorithm/iteration/detail/for_each.hpp
Normal file
35
include/boost/fusion/algorithm/iteration/detail/for_each.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FOR_EACH_05052005_1028)
|
||||
#define FUSION_FOR_EACH_05052005_1028
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline void
|
||||
for_each(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline void
|
||||
for_each(First const& first, Last const& last, F const& f, mpl::false_)
|
||||
{
|
||||
f(*first);
|
||||
detail::for_each(fusion::next(first), last, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
67
include/boost/fusion/algorithm/iteration/fold.hpp
Normal file
67
include/boost/fusion/algorithm/iteration/fold.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FOLD_05052005_1214)
|
||||
#define FUSION_FOLD_05052005_1214
|
||||
|
||||
#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename State, typename F>
|
||||
struct fold
|
||||
{
|
||||
typedef typename
|
||||
detail::static_fold<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, State
|
||||
, F
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename State, typename F>
|
||||
inline typename result_of::fold<Sequence, State, F>::type
|
||||
fold(Sequence& seq, State const& state, F const& f)
|
||||
{
|
||||
return detail::fold(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>()
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename State, typename F>
|
||||
inline typename result_of::fold<Sequence const, State, F>::type
|
||||
fold(Sequence const& seq, State const& state, F const& f)
|
||||
{
|
||||
return detail::fold(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename result_of::begin<Sequence const>::type
|
||||
, typename result_of::end<Sequence const>::type>()
|
||||
);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
55
include/boost/fusion/algorithm/iteration/for_each.hpp
Normal file
55
include/boost/fusion/algorithm/iteration/for_each.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FOR_EACH_05052005_1027)
|
||||
#define FUSION_FOR_EACH_05052005_1027
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/detail/for_each.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct for_each
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline void
|
||||
for_each(Sequence& seq, F const& f)
|
||||
{
|
||||
detail::for_each(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline void
|
||||
for_each(Sequence const& seq, F const& f)
|
||||
{
|
||||
detail::for_each(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence const>::type
|
||||
, typename result_of::end<Sequence const>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
19
include/boost/fusion/algorithm/query.hpp
Normal file
19
include/boost/fusion/algorithm/query.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALGORITHM_QUERY_10022005_0549)
|
||||
#define FUSION_ALGORITHM_QUERY_10022005_0549
|
||||
|
||||
#include <boost/fusion/algorithm/query/all.hpp>
|
||||
#include <boost/fusion/algorithm/query/any.hpp>
|
||||
#include <boost/fusion/algorithm/query/count.hpp>
|
||||
#include <boost/fusion/algorithm/query/count_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/find.hpp>
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/none.hpp>
|
||||
|
||||
#endif
|
42
include/boost/fusion/algorithm/query/all.hpp
Normal file
42
include/boost/fusion/algorithm/query/all.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALL_05052005_1238)
|
||||
#define FUSION_ALL_05052005_1238
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/all.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct all
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
all(Sequence const& seq, F f)
|
||||
{
|
||||
return detail::all(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
43
include/boost/fusion/algorithm/query/any.hpp
Normal file
43
include/boost/fusion/algorithm/query/any.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ANY_05052005_1230)
|
||||
#define FUSION_ANY_05052005_1230
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/any.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct any
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
any(Sequence const& seq, F f)
|
||||
{
|
||||
return detail::any(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
46
include/boost/fusion/algorithm/query/count.hpp
Normal file
46
include/boost/fusion/algorithm/query/count.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_COUNT_09162005_0150)
|
||||
#define FUSION_COUNT_09162005_0150
|
||||
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/count.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct count
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
inline int
|
||||
count(Sequence const& seq, T const& x)
|
||||
{
|
||||
detail::count_compare<T> f(x);
|
||||
return detail::count_if(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
42
include/boost/fusion/algorithm/query/count_if.hpp
Normal file
42
include/boost/fusion/algorithm/query/count_if.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_COUNT_IF_09162005_0137)
|
||||
#define FUSION_COUNT_IF_09162005_0137
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct count_if
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline int
|
||||
count_if(Sequence const& seq, F f)
|
||||
{
|
||||
return detail::count_if(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
40
include/boost/fusion/algorithm/query/detail/Attic/none.hpp
Normal file
40
include/boost/fusion/algorithm/query/detail/Attic/none.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NONE_07062005_1126)
|
||||
#define FUSION_NONE_07062005_1126
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
none(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
none(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::deref<First>::type x = *first;
|
||||
return !f(x) &&
|
||||
detail::none(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
40
include/boost/fusion/algorithm/query/detail/all.hpp
Normal file
40
include/boost/fusion/algorithm/query/detail/all.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALL_05052005_1237)
|
||||
#define FUSION_ALL_05052005_1237
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
all(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
all(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::deref<First>::type x = *first;
|
||||
return f(x) &&
|
||||
detail::all(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
41
include/boost/fusion/algorithm/query/detail/any.hpp
Normal file
41
include/boost/fusion/algorithm/query/detail/any.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ANY_05052005_1229)
|
||||
#define FUSION_ANY_05052005_1229
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::deref<First>::type x = *first;
|
||||
return f(x) ||
|
||||
detail::any(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
36
include/boost/fusion/algorithm/query/detail/assoc_find.hpp
Normal file
36
include/boost/fusion/algorithm/query/detail/assoc_find.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ASSOC_FIND_09242005_1133)
|
||||
#define FUSION_ASSOC_FIND_09242005_1133
|
||||
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct assoc_find
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<Sequence>
|
||||
, typename Sequence::template meta_find_impl_const<Key>::type
|
||||
, typename Sequence::template meta_find_impl<Key>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Sequence& s)
|
||||
{
|
||||
return s.find_impl(mpl::identity<Key>());
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
69
include/boost/fusion/algorithm/query/detail/count.hpp
Normal file
69
include/boost/fusion/algorithm/query/detail/count.hpp
Normal file
@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_COUNT_09162005_0158)
|
||||
#define FUSION_COUNT_09162005_0158
|
||||
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <bool is_convertible>
|
||||
struct compare_convertible;
|
||||
|
||||
// T1 is convertible to T2 or vice versa
|
||||
template <>
|
||||
struct compare_convertible<true>
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
static bool
|
||||
call(T1 const& x, T2 const& y)
|
||||
{
|
||||
return x == y;
|
||||
}
|
||||
};
|
||||
|
||||
// T1 is NOT convertible to T2 NOR vice versa
|
||||
template <>
|
||||
struct compare_convertible<false>
|
||||
{
|
||||
template <typename T1, typename T2>
|
||||
static bool
|
||||
call(T1 const&, T2 const&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T1>
|
||||
struct count_compare
|
||||
{
|
||||
typedef typename detail::call_param<T1>::type param;
|
||||
count_compare(param x)
|
||||
: x(x) {}
|
||||
|
||||
template <typename T2>
|
||||
bool
|
||||
operator()(T2 const& y)
|
||||
{
|
||||
return
|
||||
compare_convertible<
|
||||
mpl::or_<
|
||||
is_convertible<T1, T2>
|
||||
, is_convertible<T2, T1>
|
||||
>::value
|
||||
>::call(x, y);
|
||||
}
|
||||
|
||||
param x;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
43
include/boost/fusion/algorithm/query/detail/count_if.hpp
Normal file
43
include/boost/fusion/algorithm/query/detail/count_if.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_COUNT_IF_09162005_0141)
|
||||
#define FUSION_COUNT_IF_09162005_0141
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline int
|
||||
count_if(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline int
|
||||
count_if(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::deref<First>::type x = *first;
|
||||
int n =
|
||||
detail::count_if(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
if (f(x))
|
||||
++n;
|
||||
return n;
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
119
include/boost/fusion/algorithm/query/detail/find_if.hpp
Normal file
119
include/boost/fusion/algorithm/query/detail/find_if.hpp
Normal file
@ -0,0 +1,119 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FIND_IF_05052005_1107)
|
||||
#define FUSION_FIND_IF_05052005_1107
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Iterator, typename Pred>
|
||||
struct apply_filter
|
||||
{
|
||||
typedef typename
|
||||
mpl::apply1<
|
||||
Pred
|
||||
, typename result_of::value_of<Iterator>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct main_find_if;
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct recursive_find_if
|
||||
{
|
||||
typedef typename
|
||||
main_find_if<
|
||||
typename result_of::next<First>::type, Last, Pred
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct main_find_if
|
||||
{
|
||||
typedef mpl::or_<
|
||||
result_of::equal_to<First, Last>
|
||||
, apply_filter<First, Pred> >
|
||||
filter;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
filter
|
||||
, mpl::identity<First>
|
||||
, recursive_find_if<First, Last, Pred>
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct static_find_if
|
||||
{
|
||||
typedef typename
|
||||
main_find_if<
|
||||
First
|
||||
, Last
|
||||
, typename mpl::lambda<Pred>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
template <typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter, mpl::true_)
|
||||
{
|
||||
return iter;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter, mpl::false_)
|
||||
{
|
||||
return call(fusion::next(iter));
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
typedef result_of::equal_to<Iterator, type> found;
|
||||
return call(iter, found());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct static_seq_find_if : static_find_if<First, Last, Pred>
|
||||
{
|
||||
typedef typename static_find_if<First, Last, Pred>::type type;
|
||||
|
||||
template <typename Sequence>
|
||||
static type
|
||||
call(Sequence const& seq)
|
||||
{
|
||||
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
|
||||
}
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/algorithm/query/detail/none.hpp
Normal file
40
include/boost/fusion/algorithm/query/detail/none.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NONE_07062005_1126)
|
||||
#define FUSION_NONE_07062005_1126
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
none(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
none(First const& first, Last const& last, F& f, mpl::false_)
|
||||
{
|
||||
typename result_of::deref<First>::type x = *first;
|
||||
return !f(x) &&
|
||||
detail::none(
|
||||
fusion::next(first)
|
||||
, last
|
||||
, f
|
||||
, result_of::equal_to<typename result_of::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
76
include/boost/fusion/algorithm/query/find.hpp
Normal file
76
include/boost/fusion/algorithm/query/find.hpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FIND_05052005_1107)
|
||||
#define FUSION_FIND_05052005_1107
|
||||
|
||||
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/assoc_find.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/support/is_associative.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct associative_sequence_tag;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <
|
||||
typename Sequence
|
||||
, typename T
|
||||
, bool is_associative_sequence = traits::is_associative<Sequence>::value >
|
||||
struct find;
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
struct find<Sequence, T, false>
|
||||
{
|
||||
typedef
|
||||
detail::static_seq_find_if<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, is_same<mpl::_, T>
|
||||
>
|
||||
filter;
|
||||
|
||||
typedef typename filter::type type;
|
||||
};
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
struct find<Sequence, T, true>
|
||||
{
|
||||
typedef detail::assoc_find<Sequence, T> filter;
|
||||
typedef typename filter::type type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename Sequence>
|
||||
inline typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::find<Sequence, T>
|
||||
>::type
|
||||
find(Sequence& seq)
|
||||
{
|
||||
typedef typename result_of::find<Sequence, T>::filter filter;
|
||||
return filter::call(seq);
|
||||
}
|
||||
|
||||
template <typename T, typename Sequence>
|
||||
inline typename result_of::find<Sequence const, T>::type
|
||||
find(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::find<Sequence const, T>::filter filter;
|
||||
return filter::call(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
70
include/boost/fusion/algorithm/query/find_if.hpp
Normal file
70
include/boost/fusion/algorithm/query/find_if.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FIND_IF_05052005_1108)
|
||||
#define FUSION_FIND_IF_05052005_1108
|
||||
|
||||
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Pred>
|
||||
struct find_if
|
||||
{
|
||||
typedef typename
|
||||
detail::static_find_if<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, Pred
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence>
|
||||
inline typename
|
||||
lazy_disable_if<
|
||||
is_const<Sequence>
|
||||
, result_of::find_if<Sequence, Pred>
|
||||
>::type
|
||||
find_if(Sequence& seq)
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type
|
||||
, Pred
|
||||
>
|
||||
filter;
|
||||
|
||||
return filter::call(fusion::begin(seq));
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence>
|
||||
inline typename result_of::find_if<Sequence const, Pred>::type
|
||||
find_if(Sequence const& seq)
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename result_of::begin<Sequence const>::type
|
||||
, typename result_of::end<Sequence const>::type
|
||||
, Pred
|
||||
>
|
||||
filter;
|
||||
|
||||
return filter::call(fusion::begin(seq));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
42
include/boost/fusion/algorithm/query/none.hpp
Normal file
42
include/boost/fusion/algorithm/query/none.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NONE_07062005_1128)
|
||||
#define FUSION_NONE_07062005_1128
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/algorithm/query/detail/none.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct none
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
none(Sequence const& seq, F f)
|
||||
{
|
||||
return detail::none(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, result_of::equal_to<
|
||||
typename result_of::begin<Sequence>::type
|
||||
, typename result_of::end<Sequence>::type>());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
29
include/boost/fusion/algorithm/transformation.hpp
Normal file
29
include/boost/fusion/algorithm/transformation.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ALGORITHM_TRANSFORMATION_10022005_0551)
|
||||
#define FUSION_ALGORITHM_TRANSFORMATION_10022005_0551
|
||||
|
||||
#include <boost/fusion/algorithm/transformation/clear.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/erase.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/erase_key.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/filter.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/filter_if.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/insert.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/insert_range.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/pop_front.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/push_back.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/push_front.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/remove.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/remove_if.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/replace.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/replace_if.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/reverse.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/transform.hpp>
|
||||
|
||||
#endif
|
33
include/boost/fusion/algorithm/transformation/clear.hpp
Normal file
33
include/boost/fusion/algorithm/transformation/clear.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_CLEAR_09172005_1127)
|
||||
#define FUSION_CLEAR_09172005_1127
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct clear
|
||||
{
|
||||
typedef vector0 type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
inline typename result_of::clear<Sequence const>::type
|
||||
clear(Sequence const& seq)
|
||||
{
|
||||
return vector0();
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REPLACE_08182005_0841)
|
||||
#define FUSION_REPLACE_08182005_0841
|
||||
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <bool is_convertible>
|
||||
struct replacer_helper;
|
||||
|
||||
template <>
|
||||
struct replacer_helper<false>
|
||||
{
|
||||
template <typename U, typename T>
|
||||
static U&
|
||||
call(U& x, T const&, T const&)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct replacer_helper<true>
|
||||
{
|
||||
template <typename U, typename T>
|
||||
static U
|
||||
call(U& x, T const& old_value, T const& new_value)
|
||||
{
|
||||
return (x == old_value) ? new_value : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct replacer
|
||||
{
|
||||
replacer(T const& old_value, T const& new_value)
|
||||
: old_value(old_value), new_value(new_value) {}
|
||||
|
||||
template <typename U>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_helper<is_convertible<T, U>::value>::
|
||||
call(x, old_value, new_value);
|
||||
}
|
||||
|
||||
T old_value;
|
||||
T new_value;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REPLACE_IF_08182005_0946)
|
||||
#define FUSION_REPLACE_IF_08182005_0946
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <bool is_convertible>
|
||||
struct replacer_if_helper;
|
||||
|
||||
template <>
|
||||
struct replacer_if_helper<false>
|
||||
{
|
||||
template <typename U, typename F, typename T>
|
||||
static U&
|
||||
call(U& x, F&, T const&)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct replacer_if_helper<true>
|
||||
{
|
||||
template <typename U, typename F, typename T>
|
||||
static U
|
||||
call(U& x, F& f, T const& new_value)
|
||||
{
|
||||
return f(x) ? new_value : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename F, typename T>
|
||||
struct replacer_if
|
||||
{
|
||||
replacer_if(F f, T const& new_value)
|
||||
: f(f), new_value(new_value) {}
|
||||
|
||||
template <typename U>
|
||||
struct result
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<is_convertible<T, U>, U, U const&>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
typename result<U>::type
|
||||
operator()(U const& x) const
|
||||
{
|
||||
return replacer_if_helper<is_convertible<T, U>::value>::
|
||||
call(x, f, new_value);
|
||||
}
|
||||
|
||||
F f;
|
||||
T new_value;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
108
include/boost/fusion/algorithm/transformation/erase.hpp
Normal file
108
include/boost/fusion/algorithm/transformation/erase.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ERASE_07232005_0534)
|
||||
#define FUSION_ERASE_07232005_0534
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename First>
|
||||
struct compute_erase_last // put this in detail!!!
|
||||
{
|
||||
typedef typename result_of::end<Sequence>::type seq_last_type;
|
||||
typedef typename convert_iterator<First>::type first_type;
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
result_of::equal_to<first_type, seq_last_type>
|
||||
, first_type
|
||||
, typename result_of::next<first_type>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(First const& first, mpl::false_)
|
||||
{
|
||||
return fusion::next(convert_iterator<First>::call(first));
|
||||
}
|
||||
|
||||
static type
|
||||
call(First const& first, mpl::true_)
|
||||
{
|
||||
return convert_iterator<First>::call(first);
|
||||
}
|
||||
|
||||
static type
|
||||
call(First const& first)
|
||||
{
|
||||
return call(first, result_of::equal_to<first_type, seq_last_type>());
|
||||
}
|
||||
};
|
||||
|
||||
template <
|
||||
typename Sequence
|
||||
, typename First
|
||||
, typename Last = typename compute_erase_last<Sequence, First>::type>
|
||||
struct erase
|
||||
{
|
||||
typedef typename result_of::begin<Sequence>::type seq_first_type;
|
||||
typedef typename result_of::end<Sequence>::type seq_last_type;
|
||||
BOOST_STATIC_ASSERT((!result_of::equal_to<seq_first_type, seq_last_type>::value));
|
||||
|
||||
typedef typename convert_iterator<First>::type first_type;
|
||||
typedef typename convert_iterator<Last>::type last_type;
|
||||
typedef iterator_range<seq_first_type, first_type> left_type;
|
||||
typedef iterator_range<last_type, seq_last_type> right_type;
|
||||
typedef joint_view<left_type, right_type> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename First>
|
||||
typename result_of::erase<Sequence const, First>::type
|
||||
erase(Sequence const& seq, First const& first)
|
||||
{
|
||||
typedef result_of::erase<Sequence const, First> result_of;
|
||||
typedef typename result_of::left_type left_type;
|
||||
typedef typename result_of::right_type right_type;
|
||||
typedef typename result_of::type result_type;
|
||||
|
||||
left_type left(
|
||||
fusion::begin(seq)
|
||||
, convert_iterator<First>::call(first));
|
||||
right_type right(
|
||||
fusion::result_of::compute_erase_last<Sequence const, First>::call(first)
|
||||
, fusion::end(seq));
|
||||
return result_type(left, right);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename First, typename Last>
|
||||
typename result_of::erase<Sequence const, First, Last>::type
|
||||
erase(Sequence const& seq, First const& first, Last const& last)
|
||||
{
|
||||
typedef result_of::erase<Sequence const, First, Last> result_of;
|
||||
typedef typename result_of::left_type left_type;
|
||||
typedef typename result_of::right_type right_type;
|
||||
typedef typename result_of::type result_type;
|
||||
|
||||
left_type left(fusion::begin(seq), first);
|
||||
right_type right(last, fusion::end(seq));
|
||||
return result_type(left, right);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
38
include/boost/fusion/algorithm/transformation/erase_key.hpp
Normal file
38
include/boost/fusion/algorithm/transformation/erase_key.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ERASE_KEY_10022005_1851)
|
||||
#define FUSION_ERASE_KEY_10022005_1851
|
||||
|
||||
#include <boost/fusion/algorithm/query/detail/assoc_find.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/erase.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct erase_key
|
||||
{
|
||||
typedef detail::assoc_find<Sequence, Key> filter;
|
||||
typedef typename erase<Sequence, typename filter::type>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Key, typename Sequence>
|
||||
inline typename result_of::erase_key<Sequence const, Key>::type
|
||||
erase_key(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::erase_key<Sequence const, Key>::filter filter;
|
||||
return erase(seq, filter::call(seq));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
35
include/boost/fusion/algorithm/transformation/filter.hpp
Normal file
35
include/boost/fusion/algorithm/transformation/filter.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FILTER_02122005_1839)
|
||||
#define FUSION_FILTER_02122005_1839
|
||||
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct filter
|
||||
{
|
||||
typedef filter_view<Sequence, is_same<mpl::_, T> > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename Sequence>
|
||||
inline typename result_of::filter<Sequence const, T>::type
|
||||
filter(Sequence const& seq)
|
||||
{
|
||||
return filter_view<const Sequence, is_same<mpl::_, T> >(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
33
include/boost/fusion/algorithm/transformation/filter_if.hpp
Normal file
33
include/boost/fusion/algorithm/transformation/filter_if.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FILTER_IF_07172005_0818)
|
||||
#define FUSION_FILTER_IF_07172005_0818
|
||||
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Pred>
|
||||
struct filter_if
|
||||
{
|
||||
typedef filter_view<Sequence, Pred> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence>
|
||||
inline typename result_of::filter_if<Sequence const, Pred>::type
|
||||
filter_if(Sequence const& seq)
|
||||
{
|
||||
return filter_view<Sequence const, Pred>(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
63
include/boost/fusion/algorithm/transformation/insert.hpp
Normal file
63
include/boost/fusion/algorithm/transformation/insert.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_INSERT_07222005_0730)
|
||||
#define FUSION_INSERT_07222005_0730
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/single_view.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Position, typename T>
|
||||
struct insert
|
||||
{
|
||||
typedef typename detail::as_fusion_element<T>::type element_type;
|
||||
typedef typename convert_iterator<Position>::type pos_type;
|
||||
typedef typename result_of::begin<Sequence>::type first_type;
|
||||
typedef typename result_of::end<Sequence>::type last_type;
|
||||
|
||||
typedef iterator_range<first_type, pos_type> left_type;
|
||||
typedef iterator_range<pos_type, last_type> right_type;
|
||||
typedef single_view<element_type> single_view;
|
||||
typedef joint_view<left_type, single_view const> left_insert_type;
|
||||
typedef joint_view<left_insert_type, right_type> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename Position, typename T>
|
||||
inline typename result_of::insert<
|
||||
Sequence const, Position, T>::type
|
||||
insert(Sequence const& seq, Position const& pos, T const& x)
|
||||
{
|
||||
typedef result_of::insert<
|
||||
Sequence const, Position, T>
|
||||
result_of;
|
||||
typedef typename result_of::left_type left_type;
|
||||
typedef typename result_of::right_type right_type;
|
||||
typedef typename result_of::single_view single_view;
|
||||
typedef typename result_of::left_insert_type left_insert_type;
|
||||
typedef typename result_of::type result;
|
||||
|
||||
left_type left(fusion::begin(seq), convert_iterator<Position>::call(pos));
|
||||
right_type right(convert_iterator<Position>::call(pos), fusion::end(seq));
|
||||
single_view insert(x);
|
||||
left_insert_type left_insert(left, insert);
|
||||
return result(left_insert, right);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,55 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_INSERT_RANGE_009172005_1147)
|
||||
#define FUSION_INSERT_RANGE_009172005_1147
|
||||
|
||||
#include <boost/fusion/sequence/container/vector/vector10.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Position, typename Range>
|
||||
struct insert_range
|
||||
{
|
||||
typedef typename convert_iterator<Position>::type pos_type;
|
||||
typedef typename result_of::begin<Sequence>::type first_type;
|
||||
typedef typename result_of::end<Sequence>::type last_type;
|
||||
|
||||
typedef iterator_range<first_type, pos_type> left_type;
|
||||
typedef iterator_range<pos_type, last_type> right_type;
|
||||
typedef joint_view<left_type, Range> left_insert_type;
|
||||
typedef joint_view<left_insert_type, right_type> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename Position, typename Range>
|
||||
inline typename result_of::insert_range<Sequence const, Position, Range const>::type
|
||||
insert_range(Sequence const& seq, Position const& pos, Range const& range)
|
||||
{
|
||||
typedef result_of::insert_range<Sequence const, Position, Range const> result_of;
|
||||
typedef typename result_of::left_type left_type;
|
||||
typedef typename result_of::right_type right_type;
|
||||
typedef typename result_of::left_insert_type left_insert_type;
|
||||
typedef typename result_of::type result;
|
||||
|
||||
left_type left(fusion::begin(seq), convert_iterator<Position>::call(pos));
|
||||
right_type right(convert_iterator<Position>::call(pos), fusion::end(seq));
|
||||
left_insert_type left_insert(left, range);
|
||||
return result(left_insert, right);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
34
include/boost/fusion/algorithm/transformation/join.hpp
Normal file
34
include/boost/fusion/algorithm/transformation/join.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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(FUSION_JOIN_200601222109)
|
||||
#define FUSION_JOIN_200601222109
|
||||
|
||||
#include <boost/fusion/sequence/view/joint_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template<typename LhSequence, typename RhSequence>
|
||||
struct join
|
||||
{
|
||||
typedef joint_view<LhSequence, RhSequence> type;
|
||||
};
|
||||
}
|
||||
|
||||
template<typename LhSequence, typename RhSequence>
|
||||
inline typename result_of::join<LhSequence const, RhSequence const>::type
|
||||
join(LhSequence const& lhs, RhSequence const& rhs)
|
||||
{
|
||||
return typename result_of::join<LhSequence const, RhSequence const>::type(
|
||||
lhs, rhs);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
44
include/boost/fusion/algorithm/transformation/pop_back.hpp
Normal file
44
include/boost/fusion/algorithm/transformation/pop_back.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_POP_BACK_09172005_1038)
|
||||
#define FUSION_POP_BACK_09172005_1038
|
||||
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct pop_back
|
||||
{
|
||||
typedef
|
||||
iterator_range<
|
||||
typename begin<Sequence>::type
|
||||
, typename prior<
|
||||
typename end<Sequence>::type
|
||||
>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
inline typename result_of::pop_back<Sequence const>::type
|
||||
pop_back(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::pop_back<Sequence const>::type result;
|
||||
return result(fusion::begin(seq), fusion::prior(fusion::end(seq)));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
44
include/boost/fusion/algorithm/transformation/pop_front.hpp
Normal file
44
include/boost/fusion/algorithm/transformation/pop_front.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_POP_FRONT_09172005_1115)
|
||||
#define FUSION_POP_FRONT_09172005_1115
|
||||
|
||||
#include <boost/fusion/sequence/view/iterator_range/iterator_range.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct pop_front
|
||||
{
|
||||
typedef
|
||||
iterator_range<
|
||||
typename next<
|
||||
typename begin<Sequence>::type
|
||||
>::type
|
||||
, typename end<Sequence>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
inline typename result_of::pop_front<Sequence const>::type
|
||||
pop_front(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::pop_front<Sequence const>::type result;
|
||||
return result(fusion::next(fusion::begin(seq)), fusion::end(seq));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
40
include/boost/fusion/algorithm/transformation/push_back.hpp
Normal file
40
include/boost/fusion/algorithm/transformation/push_back.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_PUSH_BACK_07162005_0235)
|
||||
#define FUSION_PUSH_BACK_07162005_0235
|
||||
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/single_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct push_back
|
||||
{
|
||||
typedef single_view<typename detail::as_fusion_element<T>::type> single_view;
|
||||
typedef joint_view<Sequence, single_view const> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
inline typename result_of::push_back<Sequence const, T>::type
|
||||
push_back(Sequence const& seq, T const& x)
|
||||
{
|
||||
typedef typename result_of::push_back<Sequence const, T> push_back;
|
||||
typedef typename push_back::single_view single_view;
|
||||
typedef typename push_back::type result;
|
||||
single_view x_(x);
|
||||
return result(seq, x_);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
40
include/boost/fusion/algorithm/transformation/push_front.hpp
Normal file
40
include/boost/fusion/algorithm/transformation/push_front.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_PUSH_FRONT_07162005_0749)
|
||||
#define FUSION_PUSH_FRONT_07162005_0749
|
||||
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/sequence/view/joint_view/joint_view.hpp>
|
||||
#include <boost/fusion/sequence/view/single_view/single_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct push_front
|
||||
{
|
||||
typedef single_view<typename detail::as_fusion_element<T>::type> single_view;
|
||||
typedef joint_view<single_view const, Sequence> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
inline typename result_of::push_front<Sequence const, T>::type
|
||||
push_front(Sequence const& seq, T const& x)
|
||||
{
|
||||
typedef typename result_of::push_front<Sequence const, T> push_front;
|
||||
typedef typename push_front::single_view single_view;
|
||||
typedef typename push_front::type result;
|
||||
single_view x_(x);
|
||||
return result(x_, seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
36
include/boost/fusion/algorithm/transformation/remove.hpp
Normal file
36
include/boost/fusion/algorithm/transformation/remove.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REMOVE_07162005_0818)
|
||||
#define FUSION_REMOVE_07162005_0818
|
||||
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct remove
|
||||
{
|
||||
typedef filter_view<Sequence, mpl::not_<is_same<mpl::_, T> > > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename Sequence>
|
||||
inline typename result_of::remove<Sequence const, T>::type
|
||||
remove(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::remove<Sequence const, T>::type result_type;
|
||||
return result_type(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
36
include/boost/fusion/algorithm/transformation/remove_if.hpp
Normal file
36
include/boost/fusion/algorithm/transformation/remove_if.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REMOVE_IF_07162005_0818)
|
||||
#define FUSION_REMOVE_IF_07162005_0818
|
||||
|
||||
#include <boost/fusion/sequence/view/filter_view/filter_view.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename Pred>
|
||||
struct remove_if
|
||||
{
|
||||
typedef filter_view<Sequence, mpl::not_<Pred> > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Pred, typename Sequence>
|
||||
inline typename result_of::remove_if<Sequence const, Pred>::type
|
||||
remove_if(Sequence const& seq)
|
||||
{
|
||||
typedef typename result_of::remove_if<Sequence const, Pred>::type result_type;
|
||||
return result_type(seq);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
36
include/boost/fusion/algorithm/transformation/replace.hpp
Normal file
36
include/boost/fusion/algorithm/transformation/replace.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REPLACE_08182005_0830)
|
||||
#define FUSION_REPLACE_08182005_0830
|
||||
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/detail/replace.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct replace
|
||||
{
|
||||
typedef transform_view<Sequence, detail::replacer<T> > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
inline typename result_of::replace<Sequence const, T>::type
|
||||
replace(Sequence const& seq, T const& old_value, T const& new_value)
|
||||
{
|
||||
typedef typename result_of::replace<Sequence const, T>::type result;
|
||||
detail::replacer<T> f(old_value, new_value);
|
||||
return result(seq, f);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
38
include/boost/fusion/algorithm/transformation/replace_if.hpp
Normal file
38
include/boost/fusion/algorithm/transformation/replace_if.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REPLACE_IF_08182005_0939)
|
||||
#define FUSION_REPLACE_IF_08182005_0939
|
||||
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/detail/replace_if.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename F, typename T>
|
||||
struct replace_if
|
||||
{
|
||||
typedef transform_view<Sequence, detail::replacer_if<F, T> > type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F, typename T>
|
||||
inline typename result_of::replace_if<Sequence const, F, T>::type
|
||||
replace_if(Sequence const& seq, F pred, T const& new_value)
|
||||
{
|
||||
typedef typename result_of::replace_if<Sequence const, F, T>::type result;
|
||||
detail::replacer_if<F, T> f(pred, new_value);
|
||||
return result(seq, f);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
33
include/boost/fusion/algorithm/transformation/reverse.hpp
Normal file
33
include/boost/fusion/algorithm/transformation/reverse.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_REVERSE_07212005_1230)
|
||||
#define FUSION_REVERSE_07212005_1230
|
||||
|
||||
#include <boost/fusion/sequence/view/reverse_view/reverse_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct reverse
|
||||
{
|
||||
typedef reverse_view<Sequence> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence>
|
||||
inline reverse_view<Sequence const>
|
||||
reverse(Sequence const& view)
|
||||
{
|
||||
return reverse_view<Sequence const>(view);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
48
include/boost/fusion/algorithm/transformation/transform.hpp
Normal file
48
include/boost/fusion/algorithm/transformation/transform.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_TRANSFORM_07052005_1057)
|
||||
#define FUSION_TRANSFORM_07052005_1057
|
||||
|
||||
#include <boost/fusion/sequence/view/transform_view/transform_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence1, typename Sequence2, typename F = void_>
|
||||
struct transform
|
||||
{
|
||||
typedef transform_view<Sequence1, Sequence2, F> type;
|
||||
};
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
struct transform<Sequence, F>
|
||||
{
|
||||
typedef transform_view<Sequence, F> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline typename result_of::transform<Sequence const, F>::type
|
||||
transform(Sequence const& seq, F f)
|
||||
{
|
||||
return transform_view<Sequence const, F>(seq, f);
|
||||
}
|
||||
|
||||
template <typename Sequence1, typename Sequence2, typename F>
|
||||
inline typename result_of::transform<Sequence1 const, Sequence2 const, F>::type
|
||||
transform(Sequence1 const& seq1, Sequence2 const& seq2, F f)
|
||||
{
|
||||
return transform_view<Sequence1 const, Sequence2 const, F>(seq1, seq2, f);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
80
include/boost/fusion/algorithm/transformation/zip.hpp
Normal file
80
include/boost/fusion/algorithm/transformation/zip.hpp
Normal file
@ -0,0 +1,80 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_ZIP_HPP_20060125_2058)
|
||||
#define FUSION_ZIP_HPP_20060125_2058
|
||||
|
||||
#include <boost/fusion/sequence/view/zip_view.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl.hpp>
|
||||
#include <boost/fusion/sequence/container/vector.hpp>
|
||||
#include <boost/fusion/sequence/conversion/as_vector.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
|
||||
#if !defined(FUSION_MAX_ZIP_SEQUENCES)
|
||||
#define FUSION_MAX_ZIP_SEQUENCES 10
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct void_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(FUSION_MAX_ZIP_SEQUENCES), typename T, fusion::void_)>
|
||||
struct zip;
|
||||
}
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/algorithm/transformation/zip.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_ZIP_SEQUENCES)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define ZIP_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T) >
|
||||
struct zip< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) >
|
||||
{
|
||||
typedef mpl::vector< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) > sequences;
|
||||
typedef typename mpl::transform<sequences, add_reference<mpl::_> >::type ref_params;
|
||||
typedef zip_view<typename result_of::as_vector<ref_params>::type> type;
|
||||
};
|
||||
}
|
||||
|
||||
#define FUSION_REF_PARAM(z, n, data) const T ## n&
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T)>
|
||||
inline typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type
|
||||
zip(BOOST_PP_ENUM_BINARY_PARAMS(ZIP_ITERATION, T, const& t))
|
||||
{
|
||||
fusion::vector<BOOST_PP_ENUM(ZIP_ITERATION, FUSION_REF_PARAM, _)> seqs(
|
||||
BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, t));
|
||||
return typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type(
|
||||
seqs);
|
||||
}
|
||||
|
||||
#undef FUSION_REF_PARAM
|
||||
#undef ZIP_ITERATION
|
||||
|
||||
#endif
|
20
include/boost/fusion/iterator.hpp
Normal file
20
include/boost/fusion/iterator.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ITERATOR_10022005_0559)
|
||||
#define FUSION_ITERATOR_10022005_0559
|
||||
|
||||
#include <boost/fusion/iterator/advance.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/iterator/mpl.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
|
||||
#endif
|
72
include/boost/fusion/iterator/advance.hpp
Normal file
72
include/boost/fusion/iterator/advance.hpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ADVANCE_09172005_1146)
|
||||
#define FUSION_ADVANCE_09172005_1146
|
||||
|
||||
#include <boost/fusion/iterator/detail/advance.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct advance_impl
|
||||
{
|
||||
// default implementation
|
||||
template <typename Iterator, typename N>
|
||||
struct apply :
|
||||
mpl::if_c<
|
||||
(N::value > 0)
|
||||
, advance_detail::forward<Iterator, N::value>
|
||||
, advance_detail::backward<Iterator, N::value>
|
||||
>::type
|
||||
{
|
||||
typedef typename traits::category_of<Iterator>::type category;
|
||||
BOOST_MPL_ASSERT_NOT((is_same<category, random_access_traversal_tag>));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Iterator, int N>
|
||||
struct advance_c
|
||||
: extension::advance_impl<typename detail::tag_of<Iterator>::type>::template apply<Iterator, mpl::int_<N> >
|
||||
{};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance
|
||||
: extension::advance_impl<typename detail::tag_of<Iterator>::type>::template apply<Iterator, N>
|
||||
{};
|
||||
}
|
||||
|
||||
template <int N, typename Iterator>
|
||||
inline typename result_of::advance_c<Iterator, N>::type
|
||||
advance_c(Iterator const& i)
|
||||
{
|
||||
return result_of::advance_c<Iterator, N>::call(i);
|
||||
}
|
||||
|
||||
template<typename N, typename Iterator>
|
||||
inline typename result_of::advance<Iterator, N>::type
|
||||
advance(Iterator const& i)
|
||||
{
|
||||
return result_of::advance<Iterator, N>::call(i);
|
||||
}
|
||||
|
||||
}} // namespace boost::fusion
|
||||
|
||||
#endif
|
52
include/boost/fusion/iterator/deref.hpp
Normal file
52
include/boost/fusion/iterator/deref.hpp
Normal file
@ -0,0 +1,52 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_DEREF_05042005_1019)
|
||||
#define FUSION_DEREF_05042005_1019
|
||||
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply {};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct deref
|
||||
: extension::deref_impl<typename detail::tag_of<Iterator>::type>::
|
||||
template apply<Iterator>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename result_of::deref<Iterator>::type
|
||||
deref(Iterator const& i)
|
||||
{
|
||||
typedef result_of::deref<Iterator> deref_meta;
|
||||
typename deref_meta::type result(deref_meta::call(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename result_of::deref<Iterator>::type
|
||||
operator*(iterator_base<Iterator> const& i)
|
||||
{
|
||||
return fusion::deref(i.cast());
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
35
include/boost/fusion/iterator/detail/adapt_deref_traits.hpp
Normal file
35
include/boost/fusion/iterator/detail/adapt_deref_traits.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ADAPT_DEREF_TRAITS_05062005_0900)
|
||||
#define FUSION_ADAPT_DEREF_TRAITS_05062005_0900
|
||||
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
struct adapt_deref_traits
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::deref<typename Iterator::first_type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return *i.first;
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
|
29
include/boost/fusion/iterator/detail/adapt_value_traits.hpp
Normal file
29
include/boost/fusion/iterator/detail/adapt_value_traits.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ADAPT_VALUE_TRAITS_05062005_0859)
|
||||
#define FUSION_ADAPT_VALUE_TRAITS_05062005_0859
|
||||
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
struct adapt_value_traits
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::value_of<typename Iterator::first_type>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
|
103
include/boost/fusion/iterator/detail/advance.hpp
Normal file
103
include/boost/fusion/iterator/detail/advance.hpp
Normal file
@ -0,0 +1,103 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ADVANCE_09172005_1149)
|
||||
#define FUSION_ADVANCE_09172005_1149
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace advance_detail
|
||||
{
|
||||
// Default advance implementation, perform next(i)
|
||||
// or prior(i) N times.
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct forward;
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct next_forward
|
||||
{
|
||||
typedef typename
|
||||
forward<
|
||||
typename result_of::next<Iterator>::type
|
||||
, N-1
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct forward
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if_c<
|
||||
(N == 0)
|
||||
, mpl::identity<Iterator>
|
||||
, next_forward<Iterator, N>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type const&
|
||||
call(type const& i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
static type
|
||||
call(I const& i)
|
||||
{
|
||||
return call(fusion::next(i));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct backward;
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct next_backward
|
||||
{
|
||||
typedef typename
|
||||
backward<
|
||||
typename result_of::prior<Iterator>::type
|
||||
, N+1
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename Iterator, int N>
|
||||
struct backward
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if_c<
|
||||
(N == 0)
|
||||
, mpl::identity<Iterator>
|
||||
, next_backward<Iterator, N>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type const&
|
||||
call(type const& i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
static type
|
||||
call(I const& i)
|
||||
{
|
||||
return call(fusion::prior(i));
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
66
include/boost/fusion/iterator/detail/distance.hpp
Normal file
66
include/boost/fusion/iterator/detail/distance.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_DISTANCE_09172005_0730)
|
||||
#define FUSION_DISTANCE_09172005_0730
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace distance_detail
|
||||
{
|
||||
// Default distance implementation, linear
|
||||
// search for the Last iterator.
|
||||
|
||||
template <typename First, typename Last>
|
||||
struct linear_distance;
|
||||
|
||||
template <typename First, typename Last>
|
||||
struct next_distance
|
||||
{
|
||||
typedef typename
|
||||
mpl::next<
|
||||
typename linear_distance<
|
||||
typename result_of::next<First>::type
|
||||
, Last
|
||||
>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last>
|
||||
struct linear_distance
|
||||
: mpl::eval_if<
|
||||
result_of::equal_to<First, Last>
|
||||
, mpl::identity<mpl::int_<0> >
|
||||
, next_distance<First, Last>
|
||||
>::type
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
result_of::equal_to<First, Last>
|
||||
, mpl::identity<mpl::int_<0> >
|
||||
, next_distance<First, Last>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(First const&, Last const&)
|
||||
{
|
||||
static type result;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
58
include/boost/fusion/iterator/distance.hpp
Normal file
58
include/boost/fusion/iterator/distance.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_DISTANCE_09172005_0721)
|
||||
#define FUSION_DISTANCE_09172005_0721
|
||||
|
||||
#include <boost/fusion/iterator/detail/distance.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct distance_impl
|
||||
{
|
||||
// default implementation
|
||||
template <typename First, typename Last>
|
||||
struct apply : distance_detail::linear_distance<First, Last>
|
||||
{
|
||||
typedef typename traits::category_of<First>::type first_category;
|
||||
typedef typename traits::category_of<Last>::type last_category;
|
||||
BOOST_MPL_ASSERT((is_same<first_category, last_category>));
|
||||
BOOST_MPL_ASSERT_NOT((is_same<first_category, random_access_traversal_tag>));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename First, typename Last>
|
||||
struct distance
|
||||
: extension::distance_impl<typename detail::tag_of<First>::type>::
|
||||
template apply<First, Last>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename First, typename Last>
|
||||
inline typename result_of::distance<First, Last>::type
|
||||
distance(First const& a, Last const& b)
|
||||
{
|
||||
return result_of::distance<First, Last>::call(a,b);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
72
include/boost/fusion/iterator/equal_to.hpp
Normal file
72
include/boost/fusion/iterator/equal_to.hpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_EQUAL_TO_05052005_1208)
|
||||
#define FUSION_EQUAL_TO_05052005_1208
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/fusion/support/is_iterator.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct equal_to_impl
|
||||
{
|
||||
// default implementation
|
||||
template <typename I1, typename I2>
|
||||
struct apply
|
||||
: is_same<typename add_const<I1>::type, typename add_const<I2>::type>
|
||||
{};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: extension::equal_to_impl<typename detail::tag_of<I1>::type>::
|
||||
template apply<I1, I2>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace iterator_operators
|
||||
{
|
||||
template <typename Iter1, typename Iter2>
|
||||
inline typename
|
||||
enable_if<
|
||||
mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
|
||||
, bool
|
||||
>::type
|
||||
operator==(Iter1 const&, Iter2 const&)
|
||||
{
|
||||
return result_of::equal_to<Iter1, Iter2>::value;
|
||||
}
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
inline typename
|
||||
enable_if<
|
||||
mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
|
||||
, bool
|
||||
>::type
|
||||
operator!=(Iter1 const&, Iter2 const&)
|
||||
{
|
||||
return !result_of::equal_to<Iter1, Iter2>::value;
|
||||
}
|
||||
}
|
||||
|
||||
using iterator_operators::operator==;
|
||||
using iterator_operators::operator!=;
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
14
include/boost/fusion/iterator/mpl.hpp
Normal file
14
include/boost/fusion/iterator/mpl.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ITERATOR_MPL_10022005_0557)
|
||||
#define FUSION_ITERATOR_MPL_10022005_0557
|
||||
|
||||
#include <boost/fusion/iterator/mpl/convert_iterator.hpp>
|
||||
#include <boost/fusion/iterator/mpl/fusion_iterator.hpp>
|
||||
|
||||
#endif
|
57
include/boost/fusion/iterator/mpl/convert_iterator.hpp
Normal file
57
include/boost/fusion/iterator/mpl/convert_iterator.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_CONVERT_ITERATOR_05062005_1218)
|
||||
#define FUSION_CONVERT_ITERATOR_05062005_1218
|
||||
|
||||
#include <boost/fusion/support/is_iterator.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
// Test T. If it is a fusion iterator, return a reference to it.
|
||||
// else, assume it is an mpl iterator.
|
||||
|
||||
template <typename T>
|
||||
struct convert_iterator
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_fusion_iterator<T>
|
||||
, T
|
||||
, mpl_iterator<T>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static T const&
|
||||
call(T const& x, mpl::true_)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
static mpl_iterator<T>
|
||||
call(T const& x, mpl::false_)
|
||||
{
|
||||
return mpl_iterator<T>();
|
||||
}
|
||||
|
||||
static typename
|
||||
mpl::if_<
|
||||
is_fusion_iterator<T>
|
||||
, T const&
|
||||
, mpl_iterator<T>
|
||||
>::type
|
||||
call(T const& x)
|
||||
{
|
||||
return call(x, is_fusion_iterator<T>());
|
||||
}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
56
include/boost/fusion/iterator/mpl/fusion_iterator.hpp
Normal file
56
include/boost/fusion/iterator/mpl/fusion_iterator.hpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_FUSION_ITERATOR_10012005_1551)
|
||||
#define FUSION_FUSION_ITERATOR_10012005_1551
|
||||
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
#include <boost/fusion/iterator/advance.hpp>
|
||||
#include <boost/fusion/iterator/distance.hpp>
|
||||
#include <boost/mpl/next_prior.hpp>
|
||||
#include <boost/mpl/advance_fwd.hpp>
|
||||
#include <boost/mpl/distance_fwd.hpp>
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct fusion_iterator
|
||||
{
|
||||
typedef typename fusion::result_of::value_of<Iterator>::type type;
|
||||
typedef Iterator iterator;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct next<fusion_iterator<Iterator> >
|
||||
{
|
||||
typedef fusion_iterator<typename fusion::result_of::next<Iterator>::type> type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
struct prior<fusion_iterator<Iterator> >
|
||||
{
|
||||
typedef fusion_iterator<typename fusion::result_of::prior<Iterator>::type> type;
|
||||
};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance<fusion_iterator<Iterator>, N>
|
||||
{
|
||||
typedef fusion_iterator<typename fusion::result_of::advance<Iterator, N>::type> type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last>
|
||||
struct distance<fusion_iterator<First>, fusion_iterator<Last> >
|
||||
: fusion::result_of::distance<First, Last>
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
42
include/boost/fusion/iterator/next.hpp
Normal file
42
include/boost/fusion/iterator/next.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NEXT_05042005_1101)
|
||||
#define FUSION_NEXT_05042005_1101
|
||||
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct next_impl
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply {};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct next
|
||||
: extension::next_impl<typename detail::tag_of<Iterator>::type>::
|
||||
template apply<Iterator>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename result_of::next<Iterator>::type
|
||||
next(Iterator const& i)
|
||||
{
|
||||
return result_of::next<Iterator>::call(i);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
42
include/boost/fusion/iterator/prior.hpp
Normal file
42
include/boost/fusion/iterator/prior.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_PRIOR_05042005_1144)
|
||||
#define FUSION_PRIOR_05042005_1144
|
||||
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct prior_impl
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply {};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct prior
|
||||
: extension::prior_impl<typename detail::tag_of<Iterator>::type>::
|
||||
template apply<Iterator>
|
||||
{};
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename result_of::prior<Iterator>::type
|
||||
prior(Iterator const& i)
|
||||
{
|
||||
return result_of::prior<Iterator>::call(i);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
36
include/boost/fusion/iterator/value_of.hpp
Normal file
36
include/boost/fusion/iterator/value_of.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_VALUE_OF_05052005_1126)
|
||||
#define FUSION_VALUE_OF_05052005_1126
|
||||
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/support/tag_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_of_impl
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply {};
|
||||
};
|
||||
}
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct value_of
|
||||
: extension::value_of_impl<typename detail::tag_of<Iterator>::type>::
|
||||
template apply<Iterator>
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
21
include/boost/fusion/sequence.hpp
Normal file
21
include/boost/fusion/sequence.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_SEQUENCE_10022005_0559)
|
||||
#define FUSION_ITERATOR_10022005_0559
|
||||
|
||||
#include <boost/fusion/sequence/container.hpp>
|
||||
#include <boost/fusion/sequence/comparison.hpp>
|
||||
#include <boost/fusion/sequence/conversion.hpp>
|
||||
#include <boost/fusion/sequence/generation.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/sequence/io.hpp>
|
||||
#include <boost/fusion/sequence/view.hpp>
|
||||
#include <boost/fusion/sequence/adapted.hpp>
|
||||
#include <boost/fusion/sequence/utility.hpp>
|
||||
|
||||
#endif
|
16
include/boost/fusion/sequence/adapted.hpp
Normal file
16
include/boost/fusion/sequence/adapted.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_ADAPTED_30122005_1420)
|
||||
#define BOOST_FUSION_ADAPTED_30122005_1420
|
||||
|
||||
#include <boost/fusion/sequence/adapted/std_pair.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl.hpp>
|
||||
|
||||
#endif
|
23
include/boost/fusion/sequence/adapted/array.hpp
Normal file
23
include/boost/fusion/sequence/adapted/array.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_ARRAY_27122005_1035)
|
||||
#define BOOST_FUSION_ARRAY_27122005_1035
|
||||
|
||||
#include <boost/fusion/sequence/adapted/array/array_iterator.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/tag_of.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/is_view_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/size_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/value_at_impl.hpp>
|
||||
|
||||
#endif
|
@ -0,0 +1,56 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_ARRAY_ITERATOR_26122005_2250)
|
||||
#define BOOST_FUSION_ARRAY_ITERATOR_26122005_2250
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/advance_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/array/detail/equal_to_impl.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_iterator_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template<typename Array, std::size_t Pos>
|
||||
struct array_iterator
|
||||
: iterator_base<array_iterator<Array, Pos> >
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION(Pos,>=,0);
|
||||
BOOST_MPL_ASSERT_RELATION(Pos,<=,std::size_t(Array::static_size));
|
||||
|
||||
typedef mpl::size_t<Pos> index;
|
||||
typedef array_iterator_tag ftag;
|
||||
typedef random_access_traversal_tag category;
|
||||
typedef Array array_type;
|
||||
typedef array_iterator<
|
||||
typename add_const<Array>::type, Pos> identity;
|
||||
|
||||
array_iterator(Array& a)
|
||||
: array(a) {}
|
||||
|
||||
Array& array;
|
||||
private:
|
||||
array_iterator<Array, Pos> operator=(const array_iterator<Array, Pos>&);
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_ADVANCE_IMPL_27122005_0938)
|
||||
#define BOOST_FUSION_ADVANCE_IMPL_27122005_0938
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_iterator_tag;
|
||||
|
||||
template<typename Array, std::size_t Pos>
|
||||
struct array_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct advance_impl;
|
||||
|
||||
template<>
|
||||
struct advance_impl<array_iterator_tag>
|
||||
{
|
||||
template<typename Iterator, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::array_type array_type;
|
||||
typedef array_iterator<array_type, index::value + N::value> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.array);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_AT_IMPL_27122005_1241)
|
||||
#define BOOST_FUSION_AT_IMPL_27122005_1241
|
||||
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct at_impl;
|
||||
|
||||
template<>
|
||||
struct at_impl<array_tag>
|
||||
{
|
||||
template<typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>,
|
||||
typename Sequence::const_reference,
|
||||
typename Sequence::reference>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence& seq)
|
||||
{
|
||||
return seq[N::value];
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_BEGIN_IMPL_27122005_1117)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_27122005_1117
|
||||
|
||||
#include <boost/fusion/sequence/adapted/array/array_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<array_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef array_iterator<Sequence, 0> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_CATEGORY_OF_IMPL_27122005_1044)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_27122005_1044
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<array_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply
|
||||
{
|
||||
typedef random_access_traversal_tag type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,49 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_DEREF_IMPL_27122005_0951)
|
||||
#define BOOST_FUSION_DEREF_IMPL_27122005_0951
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_iterator_tag;
|
||||
|
||||
template<typename Array, std::size_t Pos>
|
||||
struct array_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template<>
|
||||
struct deref_impl<array_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::array_type array_type;
|
||||
typedef typename mpl::if_<
|
||||
is_const<array_type>,
|
||||
typename array_type::const_reference,
|
||||
typename array_type::reference>::type type;
|
||||
|
||||
static type
|
||||
call(Iterator const & it)
|
||||
{
|
||||
return it.array[Iterator::index::value];
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_DISTANCE_IMPL_27122005_1016)
|
||||
#define BOOST_FUSION_DISTANCE_IMPL_27122005_1016
|
||||
|
||||
#include <boost/mpl/minus.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct distance_impl;
|
||||
|
||||
template <>
|
||||
struct distance_impl<array_iterator_tag>
|
||||
{
|
||||
template <typename First, typename Last>
|
||||
struct apply : mpl::minus<typename Last::index, typename First::index>
|
||||
{
|
||||
static typename mpl::minus<
|
||||
typename Last::index, typename First::index>::type
|
||||
|
||||
call(First const&, Last const&)
|
||||
{
|
||||
static typename mpl::minus<
|
||||
typename Last::index, typename First::index>::type
|
||||
result;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_END_IMPL_27122005_1120)
|
||||
#define BOOST_FUSION_END_IMPL_27122005_1120
|
||||
|
||||
#include <boost/fusion/sequence/adapted/array/array_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<array_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef array_iterator<Sequence, Sequence::static_size> type;
|
||||
|
||||
static type
|
||||
call(Sequence& v)
|
||||
{
|
||||
return type(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_EQUAL_TO_IMPL_27122005_1020)
|
||||
#define BOOST_FUSION_EQUAL_TO_IMPL_27122005_1020
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct equal_to_impl;
|
||||
|
||||
template <>
|
||||
struct equal_to_impl<array_iterator_tag>
|
||||
{
|
||||
template <typename I1, typename I2>
|
||||
struct apply
|
||||
: is_same<
|
||||
typename I1::identity
|
||||
, typename I2::identity
|
||||
>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_IS_SEQUENCE_IMPL_27122005_1648)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1648
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<array_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_IS_VIEW_IMPL_27042006_2221)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2221
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<array_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::false_
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NEXT_IMPL_27122005_0927)
|
||||
#define FUSION_NEXT_IMPL_27122005_0927
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_iterator_tag;
|
||||
|
||||
template<typename Array, std::size_t Pos>
|
||||
struct array_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct next_impl;
|
||||
|
||||
template<>
|
||||
struct next_impl<array_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::array_type array_type;
|
||||
typedef typename Iterator::index index;
|
||||
static int const index_val = index::value;
|
||||
typedef array_iterator<array_type, index_val + 1> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.array);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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(FUSION_PRIOR_IMPL_27122005_0935)
|
||||
#define FUSION_PRIOR_IMPL_27122005_0935
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_iterator_tag;
|
||||
|
||||
template<typename Array, std::size_t Pos>
|
||||
struct array_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct prior_impl;
|
||||
|
||||
template<>
|
||||
struct prior_impl<array_iterator_tag>
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::array_type array_type;
|
||||
typedef typename Iterator::index index;
|
||||
static int const index_val = index::value;
|
||||
typedef array_iterator<array_type, index_val - 1> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.array);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_SIZE_IMPL_27122005_1251)
|
||||
#define BOOST_FUSION_SIZE_IMPL_27122005_1251
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct size_impl;
|
||||
|
||||
template<>
|
||||
struct size_impl<array_tag>
|
||||
{
|
||||
template<typename Sequence>
|
||||
struct apply : mpl::int_<Sequence::static_size> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_VALUE_AT_IMPL_27122005_1256)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_27122005_1256
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct array_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename T>
|
||||
struct value_at_impl;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<array_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Sequence::value_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_VALUE_OF_IMPL_27122005_1011)
|
||||
#define BOOST_FUSION_VALUE_OF_IMPL_27122005_1011
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_of_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_impl<array_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::array_type array_type;
|
||||
typedef typename array_type::value_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
36
include/boost/fusion/sequence/adapted/array/tag_of.hpp
Normal file
36
include/boost/fusion/sequence/adapted/array/tag_of.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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(FUSION_SEQUENCE_TAG_OF_27122005_1030)
|
||||
#define FUSION_SEQUENCE_TAG_OF_27122005_1030
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T, std::size_t N>
|
||||
class array;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct array_tag;
|
||||
|
||||
namespace traits
|
||||
{
|
||||
template<typename T, std::size_t N>
|
||||
struct tag_of<boost::array<T,N> >
|
||||
{
|
||||
typedef array_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
23
include/boost/fusion/sequence/adapted/mpl.hpp
Normal file
23
include/boost/fusion/sequence/adapted/mpl.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_MPL_31122005_1152)
|
||||
#define BOOST_FUSION_MPL_31122005_1152
|
||||
|
||||
#include <boost/fusion/sequence/adapted/mpl/tag_of.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/size_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/value_at_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/has_key_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/category_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/is_view_impl.hpp>
|
||||
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_ADVANCE_IMPL_09232005_2324)
|
||||
#define FUSION_ADVANCE_IMPL_09232005_2324
|
||||
|
||||
#include <boost/mpl/advance.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
template <typename Iterator>
|
||||
struct mpl_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct advance_impl;
|
||||
|
||||
template <>
|
||||
struct advance_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename Iterator, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl_iterator<
|
||||
typename mpl::advance<typename Iterator::iterator_type, N>::type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
static type result;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
41
include/boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp
Normal file
41
include/boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_AT_IMPL_31122005_1642)
|
||||
#define BOOST_FUSION_AT_IMPL_31122005_1642
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct at_impl;
|
||||
|
||||
template <>
|
||||
struct at_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::at<Sequence, N>::type type;
|
||||
|
||||
static type
|
||||
call(Sequence)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_BEGIN_IMPL_31122005_1209)
|
||||
#define BOOST_FUSION_BEGIN_IMPL_31122005_1209
|
||||
|
||||
#include <boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::begin<
|
||||
typename remove_const<Sequence>::type
|
||||
>::type iterator;
|
||||
typedef mpl_iterator<iterator> type;
|
||||
|
||||
static type
|
||||
call(Sequence)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,58 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_CATEGORY_OF_IMPL_20060217_2141)
|
||||
#define BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141
|
||||
|
||||
#include <boost/fusion/support/detail/iterator_to_sequence_category.hpp>
|
||||
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
struct mpl_sequence_category_of
|
||||
{
|
||||
// assumes T is an mpl sequence
|
||||
// there should be no way this will ever be
|
||||
// called where T is an mpl iterator
|
||||
|
||||
BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value);
|
||||
typedef typename
|
||||
iterator_to_sequence_category<
|
||||
typename mpl_iterator_category<
|
||||
typename mpl::begin<T>::type::category
|
||||
>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<mpl_sequence_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply
|
||||
: detail::mpl_sequence_category_of<T>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_DEREF_IMPL_05052005_0733)
|
||||
#define FUSION_DEREF_IMPL_05052005_0733
|
||||
|
||||
#include <boost/mpl/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::deref<
|
||||
typename Iterator::iterator_type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_DISTANCE_IMPL_09232005_2303)
|
||||
#define FUSION_DISTANCE_IMPL_09232005_2303
|
||||
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/distance.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct distance_impl;
|
||||
|
||||
template <>
|
||||
struct distance_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename First, typename Last>
|
||||
struct apply
|
||||
: mpl::distance<
|
||||
typename First::iterator_type
|
||||
, typename Last::iterator_type>
|
||||
{
|
||||
static typename mpl::distance<
|
||||
typename First::iterator_type
|
||||
, typename Last::iterator_type>::type
|
||||
call(First const&, Last const&)
|
||||
{
|
||||
static typename mpl::distance<
|
||||
typename First::iterator_type
|
||||
, typename Last::iterator_type>::type
|
||||
result;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_EMPTY_IMPL_31122005_1554)
|
||||
#define BOOST_FUSION_EMPTY_IMPL_31122005_1554
|
||||
|
||||
#include <boost/mpl/empty.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <>
|
||||
struct empty_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : mpl::empty<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,46 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_END_IMPL_31122005_1237)
|
||||
#define BOOST_FUSION_END_IMPL_31122005_1237
|
||||
|
||||
#include <boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp>
|
||||
#include <boost/mpl/end.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::end<
|
||||
typename remove_const<Sequence>::type
|
||||
>::type iterator;
|
||||
typedef mpl_iterator<iterator> type;
|
||||
|
||||
static type
|
||||
call(Sequence)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,41 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_EQUAL_TO_IMPL_05232005_0621)
|
||||
#define FUSION_EQUAL_TO_IMPL_05232005_0621
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct equal_to_impl;
|
||||
|
||||
template <>
|
||||
struct equal_to_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename I1, typename I2>
|
||||
struct apply
|
||||
: is_same<
|
||||
typename remove_const<typename I1::iterator_type>::type
|
||||
, typename remove_const<typename I2::iterator_type>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_HAS_KEY_IMPL_31122005_1647)
|
||||
#define BOOST_FUSION_HAS_KEY_IMPL_31122005_1647
|
||||
|
||||
#include <boost/mpl/has_key.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct has_key_impl;
|
||||
|
||||
template <>
|
||||
struct has_key_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence, typename Key>
|
||||
struct apply : mpl::has_key<Sequence, Key> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_IS_SEQUENCE_IMPL_31122005_1505)
|
||||
#define BOOST_FUSION_IS_SEQUENCE_IMPL_31122005_1505
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<mpl_sequence_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::true_ {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_IS_VIEW_IMPL_03202006_0048)
|
||||
#define BOOST_FUSION_IS_VIEW_IMPL_03202006_0048
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<mpl_sequence_tag>
|
||||
{
|
||||
template<typename T>
|
||||
struct apply : mpl::true_
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_NEXT_IMPL_05052005_0733)
|
||||
#define FUSION_NEXT_IMPL_05052005_0733
|
||||
|
||||
#include <boost/mpl/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
template <typename Iterator>
|
||||
struct mpl_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct next_impl;
|
||||
|
||||
template <>
|
||||
struct next_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl_iterator<
|
||||
typename mpl::next<typename Iterator::iterator_type>::type
|
||||
> type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_PRIOR_IMPL_05202005_0930)
|
||||
#define FUSION_PRIOR_IMPL_05202005_0930
|
||||
|
||||
#include <boost/mpl/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
template <typename Iterator>
|
||||
struct mpl_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct prior_impl;
|
||||
|
||||
template <>
|
||||
struct prior_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl_iterator<
|
||||
typename mpl::prior<typename Iterator::iterator_type>::type
|
||||
> type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
static type result;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_SIZE_IMPL_31122005_1508)
|
||||
#define BOOST_FUSION_SIZE_IMPL_31122005_1508
|
||||
|
||||
#include <boost/mpl/size.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename Tag>
|
||||
struct size_impl;
|
||||
|
||||
template <>
|
||||
struct size_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : mpl::size<Sequence> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is 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_VALUE_AT_IMPL_31122005_1621)
|
||||
#define BOOST_FUSION_VALUE_AT_IMPL_31122005_1621
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_sequence_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_at_impl;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<mpl_sequence_tag>
|
||||
{
|
||||
template <typename Sequence, typename N>
|
||||
struct apply : mpl::at<Sequence, N> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_VALUE_OF_TRAITS_05052005_0734)
|
||||
#define FUSION_VALUE_OF_TRAITS_05052005_0734
|
||||
|
||||
#include <boost/mpl/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_of_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_impl<mpl_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::deref<
|
||||
typename Iterator::iterator_type>::type
|
||||
type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
40
include/boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp
Normal file
40
include/boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
Use, modification and distribution is 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(FUSION_MPL_ITERATOR_05052005_0731)
|
||||
#define FUSION_MPL_ITERATOR_05052005_0731
|
||||
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/support/detail/mpl_iterator_category.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/next_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/prior_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/value_of_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/equal_to_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/distance_impl.hpp>
|
||||
#include <boost/fusion/sequence/adapted/mpl/detail/advance_impl.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct mpl_iterator_tag;
|
||||
|
||||
template <typename Iterator>
|
||||
struct mpl_iterator
|
||||
: iterator_base<mpl_iterator<Iterator> >
|
||||
{
|
||||
typedef mpl_iterator_tag ftag;
|
||||
typedef typename detail::mpl_iterator_category<
|
||||
typename Iterator::category>::type
|
||||
category;
|
||||
typedef typename remove_const<Iterator>::type iterator_type;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user