commit 75b9d13a88cb94142441adcc0889cf937edba57b Author: Joel de Guzman Date: Wed Aug 16 16:50:52 2006 +0000 Initial move from Spirit CVS [SVN r34896] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..3e84d7c7 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/include/boost/fusion/algorithm.hpp b/include/boost/fusion/algorithm.hpp new file mode 100644 index 00000000..4f822b63 --- /dev/null +++ b/include/boost/fusion/algorithm.hpp @@ -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 +#include +#include + +#endif diff --git a/include/boost/fusion/algorithm/iteration.hpp b/include/boost/fusion/algorithm/iteration.hpp new file mode 100644 index 00000000..9adf406c --- /dev/null +++ b/include/boost/fusion/algorithm/iteration.hpp @@ -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 +#include +#include + +#endif diff --git a/include/boost/fusion/algorithm/iteration/accumulate.hpp b/include/boost/fusion/algorithm/iteration/accumulate.hpp new file mode 100644 index 00000000..2b5cb12d --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/accumulate.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template + struct accumulate + { + typedef typename + detail::static_fold< + typename result_of::begin::type + , typename result_of::end::type + , State + , F + >::type + type; + }; + } + + template + inline typename result_of::accumulate::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::type + , typename result_of::end::type>() + ); + } + + template + inline typename result_of::accumulate::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::type + , typename result_of::end::type>() + ); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/iteration/detail/fold.hpp b/include/boost/fusion/algorithm/iteration/detail/fold.hpp new file mode 100644 index 00000000..ecf23115 --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + // Unary arguments version + + template + struct apply_fold_result + { + template + struct apply + { + typedef typename F::template result::type type; + }; + }; + + template + struct fold_apply + : mpl::apply, typename result_of::value_of::type, State> + {}; + + template + struct static_fold; + + template + struct next_result_of_fold + { + typedef typename + static_fold< + typename result_of::next::type + , Last + , typename fold_apply::type + , F + >::type + type; + }; + + template + struct static_fold + { + typedef typename + mpl::if_< + result_of::equal_to + , mpl::identity + , next_result_of_fold + >::type + result; + + typedef typename result::type type; + }; + + // terminal case + template + inline State const& + fold(First const&, Last const&, State const& state, F const&, mpl::true_) + { + return state; + } + + // non-terminal case + template + inline typename static_fold::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::type, Last>() + ); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/iteration/detail/for_each.hpp b/include/boost/fusion/algorithm/iteration/detail/for_each.hpp new file mode 100644 index 00000000..5271517e --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/detail/for_each.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline void + for_each(First const&, Last const&, F const&, mpl::true_) + { + } + + template + 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::type, Last>()); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/iteration/fold.hpp b/include/boost/fusion/algorithm/iteration/fold.hpp new file mode 100644 index 00000000..2189203b --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/fold.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template + struct fold + { + typedef typename + detail::static_fold< + typename result_of::begin::type + , typename result_of::end::type + , State + , F + >::type + type; + }; + } + + template + inline typename result_of::fold::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::type + , typename result_of::end::type>() + ); + } + + template + inline typename result_of::fold::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::type + , typename result_of::end::type>() + ); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/iteration/for_each.hpp b/include/boost/fusion/algorithm/iteration/for_each.hpp new file mode 100644 index 00000000..4609bd2b --- /dev/null +++ b/include/boost/fusion/algorithm/iteration/for_each.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct for_each + { + typedef void type; + }; + } + + template + 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::type + , typename result_of::end::type>()); + } + + template + 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::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query.hpp b/include/boost/fusion/algorithm/query.hpp new file mode 100644 index 00000000..7b826f6f --- /dev/null +++ b/include/boost/fusion/algorithm/query.hpp @@ -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 +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/algorithm/query/all.hpp b/include/boost/fusion/algorithm/query/all.hpp new file mode 100644 index 00000000..bd974f99 --- /dev/null +++ b/include/boost/fusion/algorithm/query/all.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct all + { + typedef bool type; + }; + } + + template + 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::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/any.hpp b/include/boost/fusion/algorithm/query/any.hpp new file mode 100644 index 00000000..fed72a58 --- /dev/null +++ b/include/boost/fusion/algorithm/query/any.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct any + { + typedef bool type; + }; + } + + template + 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::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/count.hpp b/include/boost/fusion/algorithm/query/count.hpp new file mode 100644 index 00000000..19ca5766 --- /dev/null +++ b/include/boost/fusion/algorithm/query/count.hpp @@ -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 +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct count + { + typedef int type; + }; + } + + template + inline int + count(Sequence const& seq, T const& x) + { + detail::count_compare f(x); + return detail::count_if( + fusion::begin(seq) + , fusion::end(seq) + , f + , result_of::equal_to< + typename result_of::begin::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/count_if.hpp b/include/boost/fusion/algorithm/query/count_if.hpp new file mode 100644 index 00000000..6c1221c4 --- /dev/null +++ b/include/boost/fusion/algorithm/query/count_if.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct count_if + { + typedef int type; + }; + } + + template + 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::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/Attic/none.hpp b/include/boost/fusion/algorithm/query/detail/Attic/none.hpp new file mode 100644 index 00000000..dfe2d1d3 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/Attic/none.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline bool + none(First const&, Last const&, F const&, mpl::true_) + { + return true; + } + + template + inline bool + none(First const& first, Last const& last, F& f, mpl::false_) + { + typename result_of::deref::type x = *first; + return !f(x) && + detail::none( + fusion::next(first) + , last + , f + , result_of::equal_to::type, Last>()); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/all.hpp b/include/boost/fusion/algorithm/query/detail/all.hpp new file mode 100644 index 00000000..96101027 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/all.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline bool + all(First const&, Last const&, F const&, mpl::true_) + { + return true; + } + + template + inline bool + all(First const& first, Last const& last, F& f, mpl::false_) + { + typename result_of::deref::type x = *first; + return f(x) && + detail::all( + fusion::next(first) + , last + , f + , result_of::equal_to::type, Last>()); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/any.hpp b/include/boost/fusion/algorithm/query/detail/any.hpp new file mode 100644 index 00000000..2cbdcdd6 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/any.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline bool + any(First const&, Last const&, F const&, mpl::true_) + { + return false; + } + + template + inline bool + any(First const& first, Last const& last, F& f, mpl::false_) + { + typename result_of::deref::type x = *first; + return f(x) || + detail::any( + fusion::next(first) + , last + , f + , result_of::equal_to::type, Last>()); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/assoc_find.hpp b/include/boost/fusion/algorithm/query/detail/assoc_find.hpp new file mode 100644 index 00000000..8e4e4920 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/assoc_find.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct assoc_find + { + typedef typename + mpl::if_< + is_const + , typename Sequence::template meta_find_impl_const::type + , typename Sequence::template meta_find_impl::type + >::type + type; + + static type + call(Sequence& s) + { + return s.find_impl(mpl::identity()); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/algorithm/query/detail/count.hpp b/include/boost/fusion/algorithm/query/detail/count.hpp new file mode 100644 index 00000000..e9060044 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/count.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct compare_convertible; + + // T1 is convertible to T2 or vice versa + template <> + struct compare_convertible + { + template + 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 + { + template + static bool + call(T1 const&, T2 const&) + { + return false; + } + }; + + template + struct count_compare + { + typedef typename detail::call_param::type param; + count_compare(param x) + : x(x) {} + + template + bool + operator()(T2 const& y) + { + return + compare_convertible< + mpl::or_< + is_convertible + , is_convertible + >::value + >::call(x, y); + } + + param x; + }; +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/count_if.hpp b/include/boost/fusion/algorithm/query/detail/count_if.hpp new file mode 100644 index 00000000..bd9fdf44 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/count_if.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline int + count_if(First const&, Last const&, F const&, mpl::true_) + { + return 0; + } + + template + inline int + count_if(First const& first, Last const& last, F& f, mpl::false_) + { + typename result_of::deref::type x = *first; + int n = + detail::count_if( + fusion::next(first) + , last + , f + , result_of::equal_to::type, Last>()); + if (f(x)) + ++n; + return n; + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/detail/find_if.hpp b/include/boost/fusion/algorithm/query/detail/find_if.hpp new file mode 100644 index 00000000..1707b37d --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/find_if.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct apply_filter + { + typedef typename + mpl::apply1< + Pred + , typename result_of::value_of::type + >::type + type; + }; + + template + struct main_find_if; + + template + struct recursive_find_if + { + typedef typename + main_find_if< + typename result_of::next::type, Last, Pred + >::type + type; + }; + + template + struct main_find_if + { + typedef mpl::or_< + result_of::equal_to + , apply_filter > + filter; + + typedef typename + mpl::eval_if< + filter + , mpl::identity + , recursive_find_if + >::type + type; + }; + + template + struct static_find_if + { + typedef typename + main_find_if< + First + , Last + , typename mpl::lambda::type + >::type + type; + + template + static type + call(Iterator const& iter, mpl::true_) + { + return iter; + } + + template + static type + call(Iterator const& iter, mpl::false_) + { + return call(fusion::next(iter)); + } + + template + static type + call(Iterator const& iter) + { + typedef result_of::equal_to found; + return call(iter, found()); + } + }; + + template + struct static_seq_find_if : static_find_if + { + typedef typename static_find_if::type type; + + template + static type + call(Sequence const& seq) + { + return static_find_if::call(fusion::begin(seq)); + } + + template + static type + call(Sequence& seq) + { + return static_find_if::call(fusion::begin(seq)); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/algorithm/query/detail/none.hpp b/include/boost/fusion/algorithm/query/detail/none.hpp new file mode 100644 index 00000000..dfe2d1d3 --- /dev/null +++ b/include/boost/fusion/algorithm/query/detail/none.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + inline bool + none(First const&, Last const&, F const&, mpl::true_) + { + return true; + } + + template + inline bool + none(First const& first, Last const& last, F& f, mpl::false_) + { + typename result_of::deref::type x = *first; + return !f(x) && + detail::none( + fusion::next(first) + , last + , f + , result_of::equal_to::type, Last>()); + } +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/find.hpp b/include/boost/fusion/algorithm/query/find.hpp new file mode 100644 index 00000000..7bb74413 --- /dev/null +++ b/include/boost/fusion/algorithm/query/find.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct associative_sequence_tag; + + namespace result_of + { + template < + typename Sequence + , typename T + , bool is_associative_sequence = traits::is_associative::value > + struct find; + + template + struct find + { + typedef + detail::static_seq_find_if< + typename result_of::begin::type + , typename result_of::end::type + , is_same + > + filter; + + typedef typename filter::type type; + }; + + template + struct find + { + typedef detail::assoc_find filter; + typedef typename filter::type type; + }; + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::find + >::type + find(Sequence& seq) + { + typedef typename result_of::find::filter filter; + return filter::call(seq); + } + + template + inline typename result_of::find::type + find(Sequence const& seq) + { + typedef typename result_of::find::filter filter; + return filter::call(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/find_if.hpp b/include/boost/fusion/algorithm/query/find_if.hpp new file mode 100644 index 00000000..05da4bfb --- /dev/null +++ b/include/boost/fusion/algorithm/query/find_if.hpp @@ -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 +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct find_if + { + typedef typename + detail::static_find_if< + typename result_of::begin::type + , typename result_of::end::type + , Pred + >::type + type; + }; + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::find_if + >::type + find_if(Sequence& seq) + { + typedef + detail::static_find_if< + typename result_of::begin::type + , typename result_of::end::type + , Pred + > + filter; + + return filter::call(fusion::begin(seq)); + } + + template + inline typename result_of::find_if::type + find_if(Sequence const& seq) + { + typedef + detail::static_find_if< + typename result_of::begin::type + , typename result_of::end::type + , Pred + > + filter; + + return filter::call(fusion::begin(seq)); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/query/none.hpp b/include/boost/fusion/algorithm/query/none.hpp new file mode 100644 index 00000000..15483d36 --- /dev/null +++ b/include/boost/fusion/algorithm/query/none.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct none + { + typedef bool type; + }; + } + + template + 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::type + , typename result_of::end::type>()); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation.hpp b/include/boost/fusion/algorithm/transformation.hpp new file mode 100644 index 00000000..da76e995 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/algorithm/transformation/clear.hpp b/include/boost/fusion/algorithm/transformation/clear.hpp new file mode 100644 index 00000000..f35232cc --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/clear.hpp @@ -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 + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct clear + { + typedef vector0 type; + }; + } + + template + inline typename result_of::clear::type + clear(Sequence const& seq) + { + return vector0(); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/detail/replace.hpp b/include/boost/fusion/algorithm/transformation/detail/replace.hpp new file mode 100644 index 00000000..816ca027 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/detail/replace.hpp @@ -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 +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct replacer_helper; + + template <> + struct replacer_helper + { + template + static U& + call(U& x, T const&, T const&) + { + return x; + } + }; + + template <> + struct replacer_helper + { + template + static U + call(U& x, T const& old_value, T const& new_value) + { + return (x == old_value) ? new_value : x; + } + }; + + template + struct replacer + { + replacer(T const& old_value, T const& new_value) + : old_value(old_value), new_value(new_value) {} + + template + struct result + { + typedef typename + mpl::if_, U, U const&>::type + type; + }; + + template + typename result::type + operator()(U const& x) const + { + return replacer_helper::value>:: + call(x, old_value, new_value); + } + + T old_value; + T new_value; + }; +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp b/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp new file mode 100644 index 00000000..9bd616d8 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/detail/replace_if.hpp @@ -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 +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct replacer_if_helper; + + template <> + struct replacer_if_helper + { + template + static U& + call(U& x, F&, T const&) + { + return x; + } + }; + + template <> + struct replacer_if_helper + { + template + static U + call(U& x, F& f, T const& new_value) + { + return f(x) ? new_value : x; + } + }; + + template + struct replacer_if + { + replacer_if(F f, T const& new_value) + : f(f), new_value(new_value) {} + + template + struct result + { + typedef typename + mpl::if_, U, U const&>::type + type; + }; + + template + typename result::type + operator()(U const& x) const + { + return replacer_if_helper::value>:: + call(x, f, new_value); + } + + F f; + T new_value; + }; +}}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/erase.hpp b/include/boost/fusion/algorithm/transformation/erase.hpp new file mode 100644 index 00000000..091c63b4 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/erase.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct compute_erase_last // put this in detail!!! + { + typedef typename result_of::end::type seq_last_type; + typedef typename convert_iterator::type first_type; + typedef typename + mpl::if_< + result_of::equal_to + , first_type + , typename result_of::next::type + >::type + type; + + static type + call(First const& first, mpl::false_) + { + return fusion::next(convert_iterator::call(first)); + } + + static type + call(First const& first, mpl::true_) + { + return convert_iterator::call(first); + } + + static type + call(First const& first) + { + return call(first, result_of::equal_to()); + } + }; + + template < + typename Sequence + , typename First + , typename Last = typename compute_erase_last::type> + struct erase + { + typedef typename result_of::begin::type seq_first_type; + typedef typename result_of::end::type seq_last_type; + BOOST_STATIC_ASSERT((!result_of::equal_to::value)); + + typedef typename convert_iterator::type first_type; + typedef typename convert_iterator::type last_type; + typedef iterator_range left_type; + typedef iterator_range right_type; + typedef joint_view type; + }; + } + + template + typename result_of::erase::type + erase(Sequence const& seq, First const& first) + { + typedef result_of::erase 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::call(first)); + right_type right( + fusion::result_of::compute_erase_last::call(first) + , fusion::end(seq)); + return result_type(left, right); + } + + template + typename result_of::erase::type + erase(Sequence const& seq, First const& first, Last const& last) + { + typedef result_of::erase 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 + diff --git a/include/boost/fusion/algorithm/transformation/erase_key.hpp b/include/boost/fusion/algorithm/transformation/erase_key.hpp new file mode 100644 index 00000000..ee9ec508 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/erase_key.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct erase_key + { + typedef detail::assoc_find filter; + typedef typename erase::type type; + }; + } + + template + inline typename result_of::erase_key::type + erase_key(Sequence const& seq) + { + typedef typename result_of::erase_key::filter filter; + return erase(seq, filter::call(seq)); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/filter.hpp b/include/boost/fusion/algorithm/transformation/filter.hpp new file mode 100644 index 00000000..235c2e9b --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/filter.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct filter + { + typedef filter_view > type; + }; + } + + template + inline typename result_of::filter::type + filter(Sequence const& seq) + { + return filter_view >(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/filter_if.hpp b/include/boost/fusion/algorithm/transformation/filter_if.hpp new file mode 100644 index 00000000..1f9f9325 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/filter_if.hpp @@ -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 + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct filter_if + { + typedef filter_view type; + }; + } + + template + inline typename result_of::filter_if::type + filter_if(Sequence const& seq) + { + return filter_view(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/insert.hpp b/include/boost/fusion/algorithm/transformation/insert.hpp new file mode 100644 index 00000000..b91e459d --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/insert.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct insert + { + typedef typename detail::as_fusion_element::type element_type; + typedef typename convert_iterator::type pos_type; + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + + typedef iterator_range left_type; + typedef iterator_range right_type; + typedef single_view single_view; + typedef joint_view left_insert_type; + typedef joint_view type; + }; + } + + template + 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::call(pos)); + right_type right(convert_iterator::call(pos), fusion::end(seq)); + single_view insert(x); + left_insert_type left_insert(left, insert); + return result(left_insert, right); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/insert_range.hpp b/include/boost/fusion/algorithm/transformation/insert_range.hpp new file mode 100644 index 00000000..735b8857 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/insert_range.hpp @@ -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 +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct insert_range + { + typedef typename convert_iterator::type pos_type; + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + + typedef iterator_range left_type; + typedef iterator_range right_type; + typedef joint_view left_insert_type; + typedef joint_view type; + }; + } + + template + inline typename result_of::insert_range::type + insert_range(Sequence const& seq, Position const& pos, Range const& range) + { + typedef result_of::insert_range 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::call(pos)); + right_type right(convert_iterator::call(pos), fusion::end(seq)); + left_insert_type left_insert(left, range); + return result(left_insert, right); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/join.hpp b/include/boost/fusion/algorithm/transformation/join.hpp new file mode 100644 index 00000000..4228a77f --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/join.hpp @@ -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 + +namespace boost { namespace fusion { + + namespace result_of + { + template + struct join + { + typedef joint_view type; + }; + } + + template + inline typename result_of::join::type + join(LhSequence const& lhs, RhSequence const& rhs) + { + return typename result_of::join::type( + lhs, rhs); + } +}} + +#endif diff --git a/include/boost/fusion/algorithm/transformation/pop_back.hpp b/include/boost/fusion/algorithm/transformation/pop_back.hpp new file mode 100644 index 00000000..688c36cd --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/pop_back.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct pop_back + { + typedef + iterator_range< + typename begin::type + , typename prior< + typename end::type + >::type + > + type; + }; + } + + template + inline typename result_of::pop_back::type + pop_back(Sequence const& seq) + { + typedef typename result_of::pop_back::type result; + return result(fusion::begin(seq), fusion::prior(fusion::end(seq))); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/pop_front.hpp b/include/boost/fusion/algorithm/transformation/pop_front.hpp new file mode 100644 index 00000000..e9a16d77 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/pop_front.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct pop_front + { + typedef + iterator_range< + typename next< + typename begin::type + >::type + , typename end::type + > + type; + }; + } + + template + inline typename result_of::pop_front::type + pop_front(Sequence const& seq) + { + typedef typename result_of::pop_front::type result; + return result(fusion::next(fusion::begin(seq)), fusion::end(seq)); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/push_back.hpp b/include/boost/fusion/algorithm/transformation/push_back.hpp new file mode 100644 index 00000000..9312b52a --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/push_back.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct push_back + { + typedef single_view::type> single_view; + typedef joint_view type; + }; + } + + template + inline typename result_of::push_back::type + push_back(Sequence const& seq, T const& x) + { + typedef typename result_of::push_back 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 + diff --git a/include/boost/fusion/algorithm/transformation/push_front.hpp b/include/boost/fusion/algorithm/transformation/push_front.hpp new file mode 100644 index 00000000..1a0a343c --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/push_front.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct push_front + { + typedef single_view::type> single_view; + typedef joint_view type; + }; + } + + template + inline typename result_of::push_front::type + push_front(Sequence const& seq, T const& x) + { + typedef typename result_of::push_front 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 + diff --git a/include/boost/fusion/algorithm/transformation/remove.hpp b/include/boost/fusion/algorithm/transformation/remove.hpp new file mode 100644 index 00000000..fce97b70 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/remove.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct remove + { + typedef filter_view > > type; + }; + } + + template + inline typename result_of::remove::type + remove(Sequence const& seq) + { + typedef typename result_of::remove::type result_type; + return result_type(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/remove_if.hpp b/include/boost/fusion/algorithm/transformation/remove_if.hpp new file mode 100644 index 00000000..9660acd6 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/remove_if.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct remove_if + { + typedef filter_view > type; + }; + } + + template + inline typename result_of::remove_if::type + remove_if(Sequence const& seq) + { + typedef typename result_of::remove_if::type result_type; + return result_type(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/replace.hpp b/include/boost/fusion/algorithm/transformation/replace.hpp new file mode 100644 index 00000000..59a851e6 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/replace.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct replace + { + typedef transform_view > type; + }; + } + + template + inline typename result_of::replace::type + replace(Sequence const& seq, T const& old_value, T const& new_value) + { + typedef typename result_of::replace::type result; + detail::replacer f(old_value, new_value); + return result(seq, f); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/replace_if.hpp b/include/boost/fusion/algorithm/transformation/replace_if.hpp new file mode 100644 index 00000000..090f4dbe --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/replace_if.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct replace_if + { + typedef transform_view > type; + }; + } + + template + inline typename result_of::replace_if::type + replace_if(Sequence const& seq, F pred, T const& new_value) + { + typedef typename result_of::replace_if::type result; + detail::replacer_if f(pred, new_value); + return result(seq, f); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/reverse.hpp b/include/boost/fusion/algorithm/transformation/reverse.hpp new file mode 100644 index 00000000..75ecfe6a --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/reverse.hpp @@ -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 + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct reverse + { + typedef reverse_view type; + }; + } + + template + inline reverse_view + reverse(Sequence const& view) + { + return reverse_view(view); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/transform.hpp b/include/boost/fusion/algorithm/transformation/transform.hpp new file mode 100644 index 00000000..c1d56e6b --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/transform.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template + struct transform + { + typedef transform_view type; + }; + + template + struct transform + { + typedef transform_view type; + }; + } + + template + inline typename result_of::transform::type + transform(Sequence const& seq, F f) + { + return transform_view(seq, f); + } + + template + inline typename result_of::transform::type + transform(Sequence1 const& seq1, Sequence2 const& seq2, F f) + { + return transform_view(seq1, seq2, f); + } +}} + +#endif + diff --git a/include/boost/fusion/algorithm/transformation/zip.hpp b/include/boost/fusion/algorithm/transformation/zip.hpp new file mode 100644 index 00000000..a20a6cc3 --- /dev/null +++ b/include/boost/fusion/algorithm/transformation/zip.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(FUSION_MAX_ZIP_SEQUENCES) +#define FUSION_MAX_ZIP_SEQUENCES 10 +#endif + +namespace boost { namespace fusion { + + struct void_; + + namespace result_of + { + template + struct zip; + } + +#define BOOST_PP_FILENAME_1 \ + +#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 >::type ref_params; + typedef zip_view::type> type; + }; + } + +#define FUSION_REF_PARAM(z, n, data) const T ## n& + + template + inline typename result_of::zip::type + zip(BOOST_PP_ENUM_BINARY_PARAMS(ZIP_ITERATION, T, const& t)) + { + fusion::vector seqs( + BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, t)); + return typename result_of::zip::type( + seqs); + } + +#undef FUSION_REF_PARAM +#undef ZIP_ITERATION + +#endif diff --git a/include/boost/fusion/iterator.hpp b/include/boost/fusion/iterator.hpp new file mode 100644 index 00000000..48083ddf --- /dev/null +++ b/include/boost/fusion/iterator.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/iterator/advance.hpp b/include/boost/fusion/iterator/advance.hpp new file mode 100644 index 00000000..8cde48db --- /dev/null +++ b/include/boost/fusion/iterator/advance.hpp @@ -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 +#include + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct random_access_traversal_tag; + + namespace extension + { + template + struct advance_impl + { + // default implementation + template + struct apply : + mpl::if_c< + (N::value > 0) + , advance_detail::forward + , advance_detail::backward + >::type + { + typedef typename traits::category_of::type category; + BOOST_MPL_ASSERT_NOT((is_same)); + }; + }; + } + + namespace result_of + { + template + struct advance_c + : extension::advance_impl::type>::template apply > + {}; + + template + struct advance + : extension::advance_impl::type>::template apply + {}; + } + + template + inline typename result_of::advance_c::type + advance_c(Iterator const& i) + { + return result_of::advance_c::call(i); + } + + template + inline typename result_of::advance::type + advance(Iterator const& i) + { + return result_of::advance::call(i); + } + +}} // namespace boost::fusion + +#endif diff --git a/include/boost/fusion/iterator/deref.hpp b/include/boost/fusion/iterator/deref.hpp new file mode 100644 index 00000000..9819e034 --- /dev/null +++ b/include/boost/fusion/iterator/deref.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct deref_impl + { + template + struct apply {}; + }; + } + + namespace result_of + { + template + struct deref + : extension::deref_impl::type>:: + template apply + {}; + } + + template + typename result_of::deref::type + deref(Iterator const& i) + { + typedef result_of::deref deref_meta; + typename deref_meta::type result(deref_meta::call(i)); + return result; + } + + template + typename result_of::deref::type + operator*(iterator_base const& i) + { + return fusion::deref(i.cast()); + } +}} + +#endif diff --git a/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp b/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp new file mode 100644 index 00000000..1bfe5d63 --- /dev/null +++ b/include/boost/fusion/iterator/detail/adapt_deref_traits.hpp @@ -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 + +namespace boost { namespace fusion { namespace detail +{ + struct adapt_deref_traits + { + template + struct apply + { + typedef typename + result_of::deref::type + type; + + static type + call(Iterator const& i) + { + return *i.first; + } + }; + }; +}}} + +#endif + + diff --git a/include/boost/fusion/iterator/detail/adapt_value_traits.hpp b/include/boost/fusion/iterator/detail/adapt_value_traits.hpp new file mode 100644 index 00000000..60bf9cd3 --- /dev/null +++ b/include/boost/fusion/iterator/detail/adapt_value_traits.hpp @@ -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 + +namespace boost { namespace fusion { namespace detail +{ + struct adapt_value_traits + { + template + struct apply + { + typedef typename + result_of::value_of::type + type; + }; + }; +}}} + +#endif + + diff --git a/include/boost/fusion/iterator/detail/advance.hpp b/include/boost/fusion/iterator/detail/advance.hpp new file mode 100644 index 00000000..37792371 --- /dev/null +++ b/include/boost/fusion/iterator/detail/advance.hpp @@ -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 +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace advance_detail +{ + // Default advance implementation, perform next(i) + // or prior(i) N times. + + template + struct forward; + + template + struct next_forward + { + typedef typename + forward< + typename result_of::next::type + , N-1 + >::type + type; + }; + + template + struct forward + { + typedef typename + mpl::eval_if_c< + (N == 0) + , mpl::identity + , next_forward + >::type + type; + + static type const& + call(type const& i) + { + return i; + } + + template + static type + call(I const& i) + { + return call(fusion::next(i)); + } + }; + + template + struct backward; + + template + struct next_backward + { + typedef typename + backward< + typename result_of::prior::type + , N+1 + >::type + type; + }; + + template + struct backward + { + typedef typename + mpl::eval_if_c< + (N == 0) + , mpl::identity + , next_backward + >::type + type; + + static type const& + call(type const& i) + { + return i; + } + + template + static type + call(I const& i) + { + return call(fusion::prior(i)); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/iterator/detail/distance.hpp b/include/boost/fusion/iterator/detail/distance.hpp new file mode 100644 index 00000000..d41d4c2e --- /dev/null +++ b/include/boost/fusion/iterator/detail/distance.hpp @@ -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 +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace distance_detail +{ + // Default distance implementation, linear + // search for the Last iterator. + + template + struct linear_distance; + + template + struct next_distance + { + typedef typename + mpl::next< + typename linear_distance< + typename result_of::next::type + , Last + >::type + >::type + type; + }; + + template + struct linear_distance + : mpl::eval_if< + result_of::equal_to + , mpl::identity > + , next_distance + >::type + { + typedef typename + mpl::eval_if< + result_of::equal_to + , mpl::identity > + , next_distance + >::type + type; + + static type + call(First const&, Last const&) + { + static type result; + return result; + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/iterator/distance.hpp b/include/boost/fusion/iterator/distance.hpp new file mode 100644 index 00000000..c77a28ab --- /dev/null +++ b/include/boost/fusion/iterator/distance.hpp @@ -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 +#include + +#include +#include +#include + +#include + +namespace boost { namespace fusion +{ + struct random_access_traversal_tag; + + namespace extension + { + template + struct distance_impl + { + // default implementation + template + struct apply : distance_detail::linear_distance + { + typedef typename traits::category_of::type first_category; + typedef typename traits::category_of::type last_category; + BOOST_MPL_ASSERT((is_same)); + BOOST_MPL_ASSERT_NOT((is_same)); + }; + }; + } + + namespace result_of + { + template + struct distance + : extension::distance_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::distance::type + distance(First const& a, Last const& b) + { + return result_of::distance::call(a,b); + } +}} + +#endif diff --git a/include/boost/fusion/iterator/equal_to.hpp b/include/boost/fusion/iterator/equal_to.hpp new file mode 100644 index 00000000..1a559e22 --- /dev/null +++ b/include/boost/fusion/iterator/equal_to.hpp @@ -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 +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct equal_to_impl + { + // default implementation + template + struct apply + : is_same::type, typename add_const::type> + {}; + }; + } + + namespace result_of + { + template + struct equal_to + : extension::equal_to_impl::type>:: + template apply + {}; + } + + namespace iterator_operators + { + template + inline typename + enable_if< + mpl::and_, is_fusion_iterator > + , bool + >::type + operator==(Iter1 const&, Iter2 const&) + { + return result_of::equal_to::value; + } + + template + inline typename + enable_if< + mpl::and_, is_fusion_iterator > + , bool + >::type + operator!=(Iter1 const&, Iter2 const&) + { + return !result_of::equal_to::value; + } + } + + using iterator_operators::operator==; + using iterator_operators::operator!=; +}} + +#endif + diff --git a/include/boost/fusion/iterator/mpl.hpp b/include/boost/fusion/iterator/mpl.hpp new file mode 100644 index 00000000..670a2879 --- /dev/null +++ b/include/boost/fusion/iterator/mpl.hpp @@ -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 +#include + +#endif diff --git a/include/boost/fusion/iterator/mpl/convert_iterator.hpp b/include/boost/fusion/iterator/mpl/convert_iterator.hpp new file mode 100644 index 00000000..fac72e9c --- /dev/null +++ b/include/boost/fusion/iterator/mpl/convert_iterator.hpp @@ -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 +#include +#include +#include + +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 + struct convert_iterator + { + typedef typename + mpl::if_< + is_fusion_iterator + , T + , mpl_iterator + >::type + type; + + static T const& + call(T const& x, mpl::true_) + { + return x; + } + + static mpl_iterator + call(T const& x, mpl::false_) + { + return mpl_iterator(); + } + + static typename + mpl::if_< + is_fusion_iterator + , T const& + , mpl_iterator + >::type + call(T const& x) + { + return call(x, is_fusion_iterator()); + } + }; +}} + +#endif diff --git a/include/boost/fusion/iterator/mpl/fusion_iterator.hpp b/include/boost/fusion/iterator/mpl/fusion_iterator.hpp new file mode 100644 index 00000000..5c655d47 --- /dev/null +++ b/include/boost/fusion/iterator/mpl/fusion_iterator.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct fusion_iterator + { + typedef typename fusion::result_of::value_of::type type; + typedef Iterator iterator; + }; + + template + struct next > + { + typedef fusion_iterator::type> type; + }; + + template + struct prior > + { + typedef fusion_iterator::type> type; + }; + + template + struct advance, N> + { + typedef fusion_iterator::type> type; + }; + + template + struct distance, fusion_iterator > + : fusion::result_of::distance + {}; + +}} + +#endif + + diff --git a/include/boost/fusion/iterator/next.hpp b/include/boost/fusion/iterator/next.hpp new file mode 100644 index 00000000..5cefb9d2 --- /dev/null +++ b/include/boost/fusion/iterator/next.hpp @@ -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 + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct next_impl + { + template + struct apply {}; + }; + } + + namespace result_of + { + template + struct next + : extension::next_impl::type>:: + template apply + {}; + } + + template + typename result_of::next::type + next(Iterator const& i) + { + return result_of::next::call(i); + } +}} + +#endif diff --git a/include/boost/fusion/iterator/prior.hpp b/include/boost/fusion/iterator/prior.hpp new file mode 100644 index 00000000..ddfb15ca --- /dev/null +++ b/include/boost/fusion/iterator/prior.hpp @@ -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 + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct prior_impl + { + template + struct apply {}; + }; + } + + namespace result_of + { + template + struct prior + : extension::prior_impl::type>:: + template apply + {}; + } + + template + typename result_of::prior::type + prior(Iterator const& i) + { + return result_of::prior::call(i); + } +}} + +#endif diff --git a/include/boost/fusion/iterator/value_of.hpp b/include/boost/fusion/iterator/value_of.hpp new file mode 100644 index 00000000..15d2f812 --- /dev/null +++ b/include/boost/fusion/iterator/value_of.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct value_of_impl + { + template + struct apply {}; + }; + } + + namespace result_of + { + template + struct value_of + : extension::value_of_impl::type>:: + template apply + {}; + } +}} + +#endif diff --git a/include/boost/fusion/sequence.hpp b/include/boost/fusion/sequence.hpp new file mode 100644 index 00000000..5b6763c6 --- /dev/null +++ b/include/boost/fusion/sequence.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted.hpp b/include/boost/fusion/sequence/adapted.hpp new file mode 100644 index 00000000..c7181e0d --- /dev/null +++ b/include/boost/fusion/sequence/adapted.hpp @@ -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 +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted/array.hpp b/include/boost/fusion/sequence/adapted/array.hpp new file mode 100644 index 00000000..5b535ce5 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/array_iterator.hpp b/include/boost/fusion/sequence/adapted/array/array_iterator.hpp new file mode 100644 index 00000000..aa6e16a6 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/array_iterator.hpp @@ -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 + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct array_iterator_tag; + struct random_access_traversal_tag; + + template + struct array_iterator + : iterator_base > + { + BOOST_MPL_ASSERT_RELATION(Pos,>=,0); + BOOST_MPL_ASSERT_RELATION(Pos,<=,std::size_t(Array::static_size)); + + typedef mpl::size_t index; + typedef array_iterator_tag ftag; + typedef random_access_traversal_tag category; + typedef Array array_type; + typedef array_iterator< + typename add_const::type, Pos> identity; + + array_iterator(Array& a) + : array(a) {} + + Array& array; + private: + array_iterator operator=(const array_iterator&); + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/advance_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/advance_impl.hpp new file mode 100644 index 00000000..c93133da --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/advance_impl.hpp @@ -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 + struct array_iterator; + + namespace extension + { + template + struct advance_impl; + + template<> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::index index; + typedef typename Iterator::array_type array_type; + typedef array_iterator type; + + static type + call(Iterator const& i) + { + return type(i.array); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/at_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/at_impl.hpp new file mode 100644 index 00000000..a51e25f9 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/at_impl.hpp @@ -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 + +#include + +namespace boost { namespace fusion { + + struct array_tag; + + namespace extension + { + template + struct at_impl; + + template<> + struct at_impl + { + template + struct apply + { + typedef typename mpl::if_< + is_const, + typename Sequence::const_reference, + typename Sequence::reference>::type type; + + static type + call(Sequence& seq) + { + return seq[N::value]; + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/begin_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/begin_impl.hpp new file mode 100644 index 00000000..52f4b784 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/begin_impl.hpp @@ -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 + +namespace boost { namespace fusion { + + struct array_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef array_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/category_of_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/category_of_impl.hpp new file mode 100644 index 00000000..f5069a9e --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/category_of_impl.hpp @@ -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 + +namespace boost { namespace fusion { + + struct array_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/deref_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/deref_impl.hpp new file mode 100644 index 00000000..012d1aaf --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/deref_impl.hpp @@ -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 +#include + +namespace boost { namespace fusion { + + struct array_iterator_tag; + + template + struct array_iterator; + + namespace extension + { + template + struct deref_impl; + + template<> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::array_type array_type; + typedef typename mpl::if_< + is_const, + typename array_type::const_reference, + typename array_type::reference>::type type; + + static type + call(Iterator const & it) + { + return it.array[Iterator::index::value]; + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/distance_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/distance_impl.hpp new file mode 100644 index 00000000..1383e92a --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/distance_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct array_iterator_tag; + + namespace extension + { + template + struct distance_impl; + + template <> + struct distance_impl + { + template + struct apply : mpl::minus + { + 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 diff --git a/include/boost/fusion/sequence/adapted/array/detail/end_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/end_impl.hpp new file mode 100644 index 00000000..233a64ce --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/end_impl.hpp @@ -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 + +namespace boost { namespace fusion { + + struct array_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef array_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/equal_to_impl.hpp new file mode 100644 index 00000000..f395ba5d --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/equal_to_impl.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + struct array_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template <> + struct equal_to_impl + { + template + struct apply + : is_same< + typename I1::identity + , typename I2::identity + > + {}; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/adapted/array/detail/is_sequence_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/is_sequence_impl.hpp new file mode 100644 index 00000000..5a53f775 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/is_sequence_impl.hpp @@ -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 + +namespace boost { namespace fusion { + + struct array_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/is_view_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/is_view_impl.hpp new file mode 100644 index 00000000..fe2c5523 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/is_view_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct array_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::false_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/next_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/next_impl.hpp new file mode 100644 index 00000000..3f6d1df2 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/next_impl.hpp @@ -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 + +namespace boost { namespace fusion { + + struct array_iterator_tag; + + template + struct array_iterator; + + namespace extension + { + template + struct next_impl; + + template<> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::array_type array_type; + typedef typename Iterator::index index; + static int const index_val = index::value; + typedef array_iterator type; + + static type + call(Iterator const& i) + { + return type(i.array); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/prior_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/prior_impl.hpp new file mode 100644 index 00000000..27f4d2e5 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/prior_impl.hpp @@ -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 + struct array_iterator; + + namespace extension + { + template + struct prior_impl; + + template<> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::array_type array_type; + typedef typename Iterator::index index; + static int const index_val = index::value; + typedef array_iterator type; + + static type + call(Iterator const& i) + { + return type(i.array); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/size_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/size_impl.hpp new file mode 100644 index 00000000..69064da7 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/size_impl.hpp @@ -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 + struct size_impl; + + template<> + struct size_impl + { + template + struct apply : mpl::int_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/value_at_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/value_at_impl.hpp new file mode 100644 index 00000000..b70a01c1 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/value_at_impl.hpp @@ -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 + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + typedef typename Sequence::value_type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/detail/value_of_impl.hpp b/include/boost/fusion/sequence/adapted/array/detail/value_of_impl.hpp new file mode 100644 index 00000000..5056ac8b --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/detail/value_of_impl.hpp @@ -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 + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::array_type array_type; + typedef typename array_type::value_type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/array/tag_of.hpp b/include/boost/fusion/sequence/adapted/array/tag_of.hpp new file mode 100644 index 00000000..6e4b1661 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/array/tag_of.hpp @@ -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 + +#include + +namespace boost +{ + template + class array; +} + +namespace boost { namespace fusion +{ + struct array_tag; + + namespace traits + { + template + struct tag_of > + { + typedef array_tag type; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl.hpp b/include/boost/fusion/sequence/adapted/mpl.hpp new file mode 100644 index 00000000..151fe717 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/advance_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/advance_impl.hpp new file mode 100644 index 00000000..5e2c3c06 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/advance_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + template + struct mpl_iterator; + + namespace extension + { + template + struct advance_impl; + + template <> + struct advance_impl + { + template + struct apply + { + typedef mpl_iterator< + typename mpl::advance::type> + type; + + static type + call(Iterator const& i) + { + static type result; + return result; + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp new file mode 100644 index 00000000..cf3a7c8c --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/at_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + typedef typename mpl::at::type type; + + static type + call(Sequence) + { + return type(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp new file mode 100644 index 00000000..5afea50b --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion { + + struct mpl_sequence_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename mpl::begin< + typename remove_const::type + >::type iterator; + typedef mpl_iterator type; + + static type + call(Sequence) + { + return type(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/category_of_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/category_of_impl.hpp new file mode 100644 index 00000000..1cba8043 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/category_of_impl.hpp @@ -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 +#include +#include +#include +#include + +namespace boost { namespace fusion { + + namespace detail + { + template + 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::value); + typedef typename + iterator_to_sequence_category< + typename mpl_iterator_category< + typename mpl::begin::type::category + >::type + >::type + type; + }; + } + + struct mpl_sequence_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + : detail::mpl_sequence_category_of + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/deref_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/deref_impl.hpp new file mode 100644 index 00000000..e692c93b --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/deref_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename mpl::deref< + typename Iterator::iterator_type>::type + type; + + static type + call(Iterator) + { + return type(); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/distance_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/distance_impl.hpp new file mode 100644 index 00000000..efe963fd --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/distance_impl.hpp @@ -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 +#include + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + namespace extension + { + template + struct distance_impl; + + template <> + struct distance_impl + { + template + 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 diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/empty_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/empty_impl.hpp new file mode 100644 index 00000000..9b8e1098 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/empty_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template <> + struct empty_impl + { + template + struct apply : mpl::empty {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp new file mode 100644 index 00000000..ee286dc2 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp @@ -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 +#include +#include + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename mpl::end< + typename remove_const::type + >::type iterator; + typedef mpl_iterator type; + + static type + call(Sequence) + { + return type(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/equal_to_impl.hpp new file mode 100644 index 00000000..25a3e886 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/equal_to_impl.hpp @@ -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 +#include +#include +#include + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template <> + struct equal_to_impl + { + template + struct apply + : is_same< + typename remove_const::type + , typename remove_const::type + > + { + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/has_key_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/has_key_impl.hpp new file mode 100644 index 00000000..5a7c2955 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/has_key_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct has_key_impl; + + template <> + struct has_key_impl + { + template + struct apply : mpl::has_key {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp new file mode 100644 index 00000000..6e2ce7da --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/is_view_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/is_view_impl.hpp new file mode 100644 index 00000000..14bc9dd0 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/is_view_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::true_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/next_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/next_impl.hpp new file mode 100644 index 00000000..6427e283 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/next_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + template + struct mpl_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef mpl_iterator< + typename mpl::next::type + > type; + + static type + call(Iterator) + { + return type(); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/prior_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/prior_impl.hpp new file mode 100644 index 00000000..1626b009 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/prior_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + template + struct mpl_iterator; + + namespace extension + { + template + struct prior_impl; + + template <> + struct prior_impl + { + template + struct apply + { + typedef mpl_iterator< + typename mpl::prior::type + > type; + + static type + call(Iterator) + { + static type result; + return result; + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/size_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/size_impl.hpp new file mode 100644 index 00000000..63213e07 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/size_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : mpl::size {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/value_at_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/value_at_impl.hpp new file mode 100644 index 00000000..d43982fd --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/value_at_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply : mpl::at {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/mpl/detail/value_of_impl.hpp b/include/boost/fusion/sequence/adapted/mpl/detail/value_of_impl.hpp new file mode 100644 index 00000000..3d7c9fff --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/detail/value_of_impl.hpp @@ -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 + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename mpl::deref< + typename Iterator::iterator_type>::type + type; + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp b/include/boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp new file mode 100644 index 00000000..43e589c3 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct mpl_iterator_tag; + + template + struct mpl_iterator + : iterator_base > + { + typedef mpl_iterator_tag ftag; + typedef typename detail::mpl_iterator_category< + typename Iterator::category>::type + category; + typedef typename remove_const::type iterator_type; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/mpl/tag_of.hpp b/include/boost/fusion/sequence/adapted/mpl/tag_of.hpp new file mode 100644 index 00000000..d987c5c2 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/mpl/tag_of.hpp @@ -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_TAG_OF_31122005_1153) +#define BOOST_FUSION_TAG_OF_31122005_1153 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct mpl_sequence_tag; + + namespace traits + { + template + struct tag_of >::type> + { + typedef mpl_sequence_tag type; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair.hpp b/include/boost/fusion/sequence/adapted/std_pair.hpp new file mode 100644 index 00000000..4b5edb52 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair.hpp @@ -0,0 +1,22 @@ +/*============================================================================= + 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_STD_PAIR_24122005_1744) +#define BOOST_FUSION_STD_PAIR_24122005_1744 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/Attic/std_pair_iterator.hpp b/include/boost/fusion/sequence/adapted/std_pair/Attic/std_pair_iterator.hpp new file mode 100644 index 00000000..0a5a1c92 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/Attic/std_pair_iterator.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_STD_PAIR_ITERATOR_09262005_0934) +#define FUSION_STD_PAIR_ITERATOR_09262005_0934 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + struct random_access_traversal_tag; + + template + struct std_pair_iterator_identity; + + template + struct std_pair_iterator + : iterator_base > + { + typedef mpl::int_ index; + typedef std_pair_iterator_tag ftag; + typedef random_access_traversal_tag category; + typedef std_pair_iterator_identity< + typename add_const::type, N> identity; + typedef Pair pair_type; + + std_pair_iterator(Pair& pair) + : pair(pair) {} + Pair& pair; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/std_pair/Attic/tag_of.hpp b/include/boost/fusion/sequence/adapted/std_pair/Attic/tag_of.hpp new file mode 100644 index 00000000..98b5fa8c --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/Attic/tag_of.hpp @@ -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_TAG_OF_24122005_1722) +#define BOOST_FUSION_TAG_OF_24122005_1722 + +#include + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace traits + { + template + struct tag_of > + { + typedef std_pair_tag type; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/at_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/at_impl.hpp new file mode 100644 index 00000000..dce5f86c --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/at_impl.hpp @@ -0,0 +1,71 @@ +/*============================================================================= + 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_24122005_1807) +#define BOOST_FUSION_AT_IMPL_24122005_1807 + +#include +#include +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2)); + typedef typename + mpl::if_c< + (n_value == 0) + , typename Sequence::first_type + , typename Sequence::second_type + > + element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + template + static RT get(Sequence& p, mpl::int_<0>) + { + return p.first; + } + + template + static RT get(Sequence& p, mpl::int_<1>) + { + return p.second; + } + + static type + call(Sequence& p) + { + return get(p, N()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/begin_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/begin_impl.hpp new file mode 100644 index 00000000..493f3f45 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/begin_impl.hpp @@ -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_24122005_1752) +#define BOOST_FUSION_BEGIN_IMPL_24122005_1752 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef std_pair_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/category_of_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/category_of_impl.hpp new file mode 100644 index 00000000..d1c353d3 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/category_of_impl.hpp @@ -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_24122005_1731) +#define BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/end_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/end_impl.hpp new file mode 100644 index 00000000..5e311a28 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/end_impl.hpp @@ -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_24122005_1755) +#define BOOST_FUSION_END_IMPL_24122005_1755 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef std_pair_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_sequence_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_sequence_impl.hpp new file mode 100644 index 00000000..d36180f8 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_sequence_impl.hpp @@ -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_1651) +#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_view_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_view_impl.hpp new file mode 100644 index 00000000..f03fb7eb --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/is_view_impl.hpp @@ -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_2219) +#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2219 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::false_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/size_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/size_impl.hpp new file mode 100644 index 00000000..618408be --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/size_impl.hpp @@ -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_24122005_1759) +#define BOOST_FUSION_SIZE_IMPL_24122005_1759 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : mpl::int_<2> {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/value_at_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/value_at_impl.hpp new file mode 100644 index 00000000..5944ca09 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/Attic/value_at_impl.hpp @@ -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_VALUE_AT_IMPL_24122005_1917) +#define BOOST_FUSION_VALUE_AT_IMPL_24122005_1917 + +#include +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2)); + typedef typename + mpl::if_c< + (n_value == 0) + , typename Sequence::first_type + , typename Sequence::second_type + >::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/advance_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/advance_impl.hpp new file mode 100644 index 00000000..6a883994 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/advance_impl.hpp @@ -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_ADVANCE_IMPL_09302005_1847) +#define FUSION_ADVANCE_IMPL_09302005_1847 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + + template + struct std_pair_iterator; + + namespace extension + { + template + struct advance_impl; + + template <> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::index index; + typedef typename Iterator::pair_type pair_type; + typedef std_pair_iterator type; + BOOST_STATIC_ASSERT( + (index::value+N::value) >= 0 &&(index::value+N::value) < 2); + + static type + call(Iterator const& i) + { + return type(i.vec); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/at_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/at_impl.hpp new file mode 100644 index 00000000..dce5f86c --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/at_impl.hpp @@ -0,0 +1,71 @@ +/*============================================================================= + 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_24122005_1807) +#define BOOST_FUSION_AT_IMPL_24122005_1807 + +#include +#include +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2)); + typedef typename + mpl::if_c< + (n_value == 0) + , typename Sequence::first_type + , typename Sequence::second_type + > + element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + template + static RT get(Sequence& p, mpl::int_<0>) + { + return p.first; + } + + template + static RT get(Sequence& p, mpl::int_<1>) + { + return p.second; + } + + static type + call(Sequence& p) + { + return get(p, N()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/begin_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/begin_impl.hpp new file mode 100644 index 00000000..493f3f45 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/begin_impl.hpp @@ -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_24122005_1752) +#define BOOST_FUSION_BEGIN_IMPL_24122005_1752 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef std_pair_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/category_of_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/category_of_impl.hpp new file mode 100644 index 00000000..d1c353d3 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/category_of_impl.hpp @@ -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_24122005_1731) +#define BOOST_FUSION_CATEGORY_OF_IMPL_24122005_1731 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/deref_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/deref_impl.hpp new file mode 100644 index 00000000..371cf2ce --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/deref_impl.hpp @@ -0,0 +1,74 @@ +/*============================================================================= + 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_09302005_1846) +#define FUSION_DEREF_IMPL_09302005_1846 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::pair_type pair_type; + typedef typename Iterator::index index; + static int const index_val = index::value; + + BOOST_STATIC_ASSERT(index_val >= 0 && index_val <= 2); + typedef typename + mpl::if_c< + (index::value == 0) + , typename pair_type::first_type + , typename pair_type::second_type + > + element; + + typedef typename + mpl::eval_if< + is_const + , fusion::detail::cref_result + , fusion::detail::ref_result + >::type + type; + + template + static RT get(pair_type& p, mpl::int_<0>) + { + return p.first; + } + + template + static RT get(pair_type& p, mpl::int_<1>) + { + return p.second; + } + + static type + call(Iterator const& iter) + { + return get(iter.pair, index()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/distance_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/distance_impl.hpp new file mode 100644 index 00000000..abd873a5 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/distance_impl.hpp @@ -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_DISTANCE_IMPL_09302005_1846) +#define FUSION_DISTANCE_IMPL_09302005_1846 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + + namespace extension + { + template + struct distance_impl; + + template <> + struct distance_impl + { + template + struct apply : mpl::minus + { + 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 diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/end_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/end_impl.hpp new file mode 100644 index 00000000..5e311a28 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/end_impl.hpp @@ -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_24122005_1755) +#define BOOST_FUSION_END_IMPL_24122005_1755 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef std_pair_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/equal_to_impl.hpp new file mode 100644 index 00000000..85088280 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/equal_to_impl.hpp @@ -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_EQUAL_TO_IMPL_09302005_1847) +#define FUSION_EQUAL_TO_IMPL_09302005_1847 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template <> + struct equal_to_impl + { + template + struct apply + : is_same< + typename I1::identity + , typename I2::identity + > + { + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/is_sequence_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/is_sequence_impl.hpp new file mode 100644 index 00000000..d36180f8 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/is_sequence_impl.hpp @@ -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_1651) +#define BOOST_FUSION_IS_SEQUENCE_IMPL_27122005_1651 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/is_view_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/is_view_impl.hpp new file mode 100644 index 00000000..f03fb7eb --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/is_view_impl.hpp @@ -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_2219) +#define BOOST_FUSION_IS_VIEW_IMPL_27042006_2219 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::false_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/next_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/next_impl.hpp new file mode 100644 index 00000000..dc320903 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/next_impl.hpp @@ -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_NEXT_IMPL_09302005_1847) +#define FUSION_NEXT_IMPL_09302005_1847 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + template + struct std_pair_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::pair_type pair_type; + typedef typename Iterator::index index; + static int const index_val = index::value; + typedef std_pair_iterator type; + BOOST_STATIC_ASSERT((index_val+1) >= 0 &&(index_val+1) <= 2); + + static type + call(Iterator const& i) + { + return type(i.pair); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/prior_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/prior_impl.hpp new file mode 100644 index 00000000..fe243185 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/prior_impl.hpp @@ -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_PRIOR_IMPL_09302005_1847) +#define FUSION_PRIOR_IMPL_09302005_1847 + +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + template + struct std_pair_iterator; + + namespace extension + { + template + struct prior_impl; + + template <> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::pair_type pair_type; + typedef typename Iterator::index index; + static int const index_val = index::value; + typedef std_pair_iterator type; + BOOST_STATIC_ASSERT((index_val-1) >= 0 &&(index_val-1) <= 2); + + static type + call(Iterator const& i) + { + return type(i.pair); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/size_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/size_impl.hpp new file mode 100644 index 00000000..618408be --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/size_impl.hpp @@ -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_24122005_1759) +#define BOOST_FUSION_SIZE_IMPL_24122005_1759 + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : mpl::int_<2> {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/value_at_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/value_at_impl.hpp new file mode 100644 index 00000000..5944ca09 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/value_at_impl.hpp @@ -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_VALUE_AT_IMPL_24122005_1917) +#define BOOST_FUSION_VALUE_AT_IMPL_24122005_1917 + +#include +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_STATIC_ASSERT((n_value >= 0 && n_value < 2)); + typedef typename + mpl::if_c< + (n_value == 0) + , typename Sequence::first_type + , typename Sequence::second_type + >::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/detail/value_of_impl.hpp b/include/boost/fusion/sequence/adapted/std_pair/detail/value_of_impl.hpp new file mode 100644 index 00000000..240b56e9 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/detail/value_of_impl.hpp @@ -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_VALUE_OF_IMPL_09302005_1847) +#define FUSION_VALUE_OF_IMPL_09302005_1847 + +#include +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::pair_type pair_type; + typedef typename Iterator::index index; + static int const index_value = index::value; + + BOOST_STATIC_ASSERT(index_value >= 0 && index_value <= 2); + typedef typename + mpl::if_c< + (index_value == 0) + , typename pair_type::first_type + , typename pair_type::second_type + >::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/adapted/std_pair/std_pair_iterator.hpp b/include/boost/fusion/sequence/adapted/std_pair/std_pair_iterator.hpp new file mode 100644 index 00000000..0a5a1c92 --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/std_pair_iterator.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_STD_PAIR_ITERATOR_09262005_0934) +#define FUSION_STD_PAIR_ITERATOR_09262005_0934 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct std_pair_iterator_tag; + struct random_access_traversal_tag; + + template + struct std_pair_iterator_identity; + + template + struct std_pair_iterator + : iterator_base > + { + typedef mpl::int_ index; + typedef std_pair_iterator_tag ftag; + typedef random_access_traversal_tag category; + typedef std_pair_iterator_identity< + typename add_const::type, N> identity; + typedef Pair pair_type; + + std_pair_iterator(Pair& pair) + : pair(pair) {} + Pair& pair; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/adapted/std_pair/tag_of.hpp b/include/boost/fusion/sequence/adapted/std_pair/tag_of.hpp new file mode 100644 index 00000000..98b5fa8c --- /dev/null +++ b/include/boost/fusion/sequence/adapted/std_pair/tag_of.hpp @@ -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_TAG_OF_24122005_1722) +#define BOOST_FUSION_TAG_OF_24122005_1722 + +#include + +#include + +namespace boost { namespace fusion { + + struct std_pair_tag; + + namespace traits + { + template + struct tag_of > + { + typedef std_pair_tag type; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison.hpp b/include/boost/fusion/sequence/comparison.hpp new file mode 100644 index 00000000..e4a6b5d7 --- /dev/null +++ b/include/boost/fusion/sequence/comparison.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + 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_COMPARISON_10022005_0615) +#define FUSION_SEQUENCE_COMPARISON_10022005_0615 + +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp b/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp new file mode 100644 index 00000000..29797ef3 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/enable_comparison.hpp @@ -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_ENABLE_COMPARISON_09232005_1958) +#define FUSION_ENABLE_COMPARISON_09232005_1958 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct enable_equality + : mpl::or_, fusion::traits::is_sequence > + {}; + + template + struct enable_comparison + : mpl::and_< + mpl::or_, fusion::traits::is_sequence >, + mpl::equal_to, result_of::size > > + {}; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/equal_to.hpp b/include/boost/fusion/sequence/comparison/detail/equal_to.hpp new file mode 100644 index 00000000..0b1f4df8 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/equal_to.hpp @@ -0,0 +1,61 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_1142) +#define FUSION_EQUAL_TO_05052005_1142 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_equal_to + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return true; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a == *b + && call(fusion::next(a), fusion::next(b)); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; + + template + struct sequence_equal_to + { + template + static bool + call(I1 const& a, I2 const& b) + { + return false; + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/greater.hpp b/include/boost/fusion/sequence/comparison/detail/greater.hpp new file mode 100644 index 00000000..1f071b73 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/greater.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_GREATER_05052005_1142) +#define FUSION_GREATER_05052005_1142 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_greater + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return false; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a > *b + || !(*b > *a) + && call(fusion::next(a), fusion::next(b)); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp b/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp new file mode 100644 index 00000000..28bb7cc8 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/greater_equal.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_GREATER_EQUAL_05052005_1142) +#define FUSION_GREATER_EQUAL_05052005_1142 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_greater_equal + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return true; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a >= *b + && (!(*b >= *a) || call(fusion::next(a), fusion::next(b))); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/less.hpp b/include/boost/fusion/sequence/comparison/detail/less.hpp new file mode 100644 index 00000000..15db31cb --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/less.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_LESS_05052005_1141) +#define FUSION_LESS_05052005_1141 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_less + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return false; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a < *b + || !(*b < *a) + && call(fusion::next(a), fusion::next(b)); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/less_equal.hpp b/include/boost/fusion/sequence/comparison/detail/less_equal.hpp new file mode 100644 index 00000000..2eff087d --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/less_equal.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_LESS_EQUAL_05052005_1141) +#define FUSION_LESS_EQUAL_05052005_1141 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_less_equal + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return true; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a <= *b + && (!(*b <= *a) || call(fusion::next(a), fusion::next(b))); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp b/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp new file mode 100644 index 00000000..65c124c2 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/detail/not_equal_to.hpp @@ -0,0 +1,61 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_NOT_EQUAL_TO_05052005_1141) +#define FUSION_NOT_EQUAL_TO_05052005_1141 + +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct sequence_not_equal_to + { + typedef typename result_of::end::type end1_type; + typedef typename result_of::end::type end2_type; + + template + static bool + call(I1 const&, I2 const&, mpl::true_) + { + return false; + } + + template + static bool + call(I1 const& a, I2 const& b, mpl::false_) + { + return *a != *b + || call(fusion::next(a), fusion::next(b)); + } + + template + static bool + call(I1 const& a, I2 const& b) + { + typename result_of::equal_to::type eq; + return call(a, b, eq); + } + }; + + template + struct sequence_not_equal_to + { + template + static bool + call(I1 const& a, I2 const& b) + { + return true; + } + }; +}}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/equal_to.hpp b/include/boost/fusion/sequence/comparison/equal_to.hpp new file mode 100644 index 00000000..ee04a24f --- /dev/null +++ b/include/boost/fusion/sequence/comparison/equal_to.hpp @@ -0,0 +1,41 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_0431) +#define FUSION_EQUAL_TO_05052005_0431 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace sequence_operators + { + template + inline typename + enable_if< + detail::enable_equality + , bool + >::type + operator==(Seq1 const& a, Seq2 const& b) + { + return result_of::size::value == result_of::size::value + && detail::sequence_equal_to< + Seq1 const, Seq2 const + , result_of::size::value == result_of::size::value>:: + call(fusion::begin(a), fusion::begin(b)); + } + } + using sequence_operators::operator==; +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/greater.hpp b/include/boost/fusion/sequence/comparison/greater.hpp new file mode 100644 index 00000000..becd6767 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/greater.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_GREATER_05052005_0432) +#define FUSION_GREATER_05052005_0432 + +#include +#include +#include + +#if defined(FUSION_DIRECT_OPERATOR_USAGE) +#include +#else +#include +#endif + +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + detail::enable_comparison + , bool + >::type + operator>(Seq1 const& a, Seq2 const& b) + { +#if defined(FUSION_DIRECT_OPERATOR_USAGE) + return detail::sequence_greater:: + call(fusion::begin(a), fusion::begin(b)); +#else + return (b < a); +#endif + } +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/greater_equal.hpp b/include/boost/fusion/sequence/comparison/greater_equal.hpp new file mode 100644 index 00000000..f73ee64f --- /dev/null +++ b/include/boost/fusion/sequence/comparison/greater_equal.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_GREATER_EQUAL_05052005_0432) +#define FUSION_GREATER_EQUAL_05052005_0432 + +#include +#include +#include + +#if defined(FUSION_DIRECT_OPERATOR_USAGE) +#include +#else +#include +#endif + +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + detail::enable_comparison + , bool + >::type + operator>=(Seq1 const& a, Seq2 const& b) + { +#if defined(FUSION_DIRECT_OPERATOR_USAGE) + return detail::sequence_greater_equal:: + call(fusion::begin(a), fusion::begin(b)); +#else + return !(a < b); +#endif + } +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/less.hpp b/include/boost/fusion/sequence/comparison/less.hpp new file mode 100644 index 00000000..96d13d41 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/less.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_LESS_05052005_0432) +#define FUSION_LESS_05052005_0432 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + detail::enable_comparison + , bool + >::type + operator<(Seq1 const& a, Seq2 const& b) + { + return detail::sequence_less:: + call(fusion::begin(a), fusion::begin(b)); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/less_equal.hpp b/include/boost/fusion/sequence/comparison/less_equal.hpp new file mode 100644 index 00000000..d4b45b2d --- /dev/null +++ b/include/boost/fusion/sequence/comparison/less_equal.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_LESS_EQUAL_05052005_0432) +#define FUSION_LESS_EQUAL_05052005_0432 + +#include +#include +#include + +#if defined(FUSION_DIRECT_OPERATOR_USAGE) +#include +#else +#include +#endif + +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + detail::enable_comparison + , bool + >::type + operator<=(Seq1 const& a, Seq2 const& b) + { +#if defined(FUSION_DIRECT_OPERATOR_USAGE) + return detail::sequence_less_equal:: + call(fusion::begin(a), fusion::begin(b)); +#else + return !(b < a); +#endif + } +}} + +#endif diff --git a/include/boost/fusion/sequence/comparison/not_equal_to.hpp b/include/boost/fusion/sequence/comparison/not_equal_to.hpp new file mode 100644 index 00000000..1464d023 --- /dev/null +++ b/include/boost/fusion/sequence/comparison/not_equal_to.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_NOT_EQUAL_TO_05052005_0431) +#define FUSION_NOT_EQUAL_TO_05052005_0431 + +#include +#include +#include + +#if defined(FUSION_DIRECT_OPERATOR_USAGE) +#include +#else +#include +#endif + +#include +#include + +namespace boost { namespace fusion +{ + namespace sequence_operators + { + template + inline typename + enable_if< + detail::enable_equality + , bool + >::type + operator!=(Seq1 const& a, Seq2 const& b) + { +#if defined(FUSION_DIRECT_OPERATOR_USAGE) + return result_of::size::value != result_of::size::value + || detail::sequence_not_equal_to< + Seq1 const, Seq2 const + , result_of::size::value == result_of::size::value>:: + call(fusion::begin(a), fusion::begin(b)); +#else + return !(a == b); +#endif + } + } + + using sequence_operators::operator!=; +}} + +#endif diff --git a/include/boost/fusion/sequence/container.hpp b/include/boost/fusion/sequence/container.hpp new file mode 100644 index 00000000..c34fc492 --- /dev/null +++ b/include/boost/fusion/sequence/container.hpp @@ -0,0 +1,16 @@ +/*============================================================================= + 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_CLASS_10022005_0614) +#define FUSION_SEQUENCE_CLASS_10022005_0614 + +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/container/list.hpp b/include/boost/fusion/sequence/container/list.hpp new file mode 100644 index 00000000..77426691 --- /dev/null +++ b/include/boost/fusion/sequence/container/list.hpp @@ -0,0 +1,17 @@ +/*============================================================================= + 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_CLASS_LIST_10022005_0605) +#define FUSION_SEQUENCE_CLASS_LIST_10022005_0605 + +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/container/list/cons.hpp b/include/boost/fusion/sequence/container/list/cons.hpp new file mode 100644 index 00000000..d79c379f --- /dev/null +++ b/include/boost/fusion/sequence/container/list/cons.hpp @@ -0,0 +1,136 @@ +/*============================================================================= + Copyright (c) 2005 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_CONS_07172005_0843) +#define FUSION_CONS_07172005_0843 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct cons_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + struct nil : sequence_base + { + typedef mpl::int_<0> size; + typedef cons_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + typedef forward_sequence_tag category; + typedef void_ car_type; + typedef void_ cdr_type; + + nil() {} + + template + nil(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/) + {} + + template + void assign_from_iter(Iterator const& iter) + { + } + }; + + template + struct cons : sequence_base > + { + typedef mpl::int_ size; + typedef cons_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + typedef forward_sequence_tag category; + typedef Car car_type; + typedef Cdr cdr_type; + + cons() + : car(), cdr() {} + + explicit cons(typename detail::call_param::type car) + : car(car), cdr() {} + + cons( + typename detail::call_param::type car + , typename detail::call_param::type cdr) + : car(car), cdr(cdr) {} + + template + cons(cons const& rhs) + : car(rhs.car), cdr(rhs.cdr) {} + + cons(cons const& rhs) + : car(rhs.car), cdr(rhs.cdr) {} + + template + explicit cons( + Sequence const& seq + , typename disable_if >::type* dummy = 0) + : car(*fusion::begin(seq)) + , cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {} + + template + cons(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/) + : car(*iter) + , cdr(fusion::next(iter), mpl::true_()) {} + + template + cons& operator=(cons const& rhs) + { + car = rhs.car; + cdr = rhs.cdr; + return *this; + } + + cons& operator=(cons const& rhs) + { + car = rhs.car; + cdr = rhs.cdr; + return *this; + } + + template + typename disable_if, cons&>::type + operator=(Sequence const& seq) + { + typedef typename result_of::begin::type Iterator; + Iterator iter = fusion::begin(seq); + this->assign_from_iter(iter); + return *this; + } + + template + void assign_from_iter(Iterator const& iter) + { + car = *iter; + cdr.assign_from_iter(fusion::next(iter)); + } + + car_type car; + cdr_type cdr; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/list/cons_iterator.hpp b/include/boost/fusion/sequence/container/list/cons_iterator.hpp new file mode 100644 index 00000000..48a5179a --- /dev/null +++ b/include/boost/fusion/sequence/container/list/cons_iterator.hpp @@ -0,0 +1,86 @@ +/*============================================================================= + Copyright (c) 2005 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_CONS_ITERATOR_07172005_0849) +#define FUSION_CONS_ITERATOR_07172005_0849 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + struct cons_iterator_tag; + struct forward_traversal_tag; + + template + struct cons_iterator_identity; + + template + struct cons_iterator : iterator_base > + { + typedef cons_iterator_tag ftag; + typedef forward_traversal_tag category; + typedef Cons cons_type; + typedef cons_iterator_identity< + typename add_const::type> + identity; + + explicit cons_iterator(cons_type& cons) + : cons(cons) {} + + cons_type& cons; + }; + + struct nil_iterator : iterator_base + { + typedef forward_traversal_tag category; + typedef cons_iterator_tag ftag; + typedef nil cons_type; + typedef cons_iterator_identity< + add_const::type> + identity; + nil_iterator() {} + explicit nil_iterator(nil const&) {} + }; + + template <> + struct cons_iterator : nil_iterator + { + cons_iterator() {} + explicit cons_iterator(nil const&) {} + }; + + template <> + struct cons_iterator : nil_iterator + { + cons_iterator() {} + explicit cons_iterator(nil const&) {} + }; + + template <> + struct cons_iterator > : nil_iterator + { + cons_iterator() {} + explicit cons_iterator(nil const&) {} + }; + + template <> + struct cons_iterator const> : nil_iterator + { + cons_iterator() {} + explicit cons_iterator(nil const&) {} + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/at_impl.hpp b/include/boost/fusion/sequence/container/list/detail/at_impl.hpp new file mode 100644 index 00000000..aae026ad --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/at_impl.hpp @@ -0,0 +1,80 @@ +/*============================================================================= + 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_AT_IMPL_07172005_0726) +#define FUSION_AT_IMPL_07172005_0726 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct cons_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + typedef typename + mpl::eval_if< + is_const + , add_const + , mpl::identity + >::type + cdr_type; + + typedef typename + mpl::eval_if< + mpl::bool_ + , mpl::identity + , apply > + > + element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + template + static type + call(Cons& s, mpl::int_) + { + return call(s.cdr, mpl::int_()); + } + + template + static type + call(Cons& s, mpl::int_<0>) + { + return s.car; + } + + static type + call(Sequence& s) + { + return call(s, mpl::int_()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/begin_impl.hpp b/include/boost/fusion/sequence/container/list/detail/begin_impl.hpp new file mode 100644 index 00000000..72384c93 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/begin_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2005 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_BEGIN_IMPL_07172005_0824) +#define FUSION_BEGIN_IMPL_07172005_0824 + +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + struct cons_tag; + + template + struct cons; + + template + struct cons_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef cons_iterator type; + + static type + call(Sequence& t) + { + return type(t); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/deref_impl.hpp b/include/boost/fusion/sequence/container/list/detail/deref_impl.hpp new file mode 100644 index 00000000..d374a8c0 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/deref_impl.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + Copyright (c) 2005 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_DEREF_IMPL_07172005_0831) +#define FUSION_DEREF_IMPL_07172005_0831 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct cons_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::cons_type cons_type; + typedef typename cons_type::car_type value_type; + + typedef typename mpl::eval_if< + is_const + , add_reference::type> + , add_reference >::type + type; + + static type + call(Iterator const& i) + { + return i.cons.car; + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/container/list/detail/end_impl.hpp b/include/boost/fusion/sequence/container/list/detail/end_impl.hpp new file mode 100644 index 00000000..0aaeaac4 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/end_impl.hpp @@ -0,0 +1,52 @@ +/*============================================================================= + Copyright (c) 2005 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_END_IMPL_07172005_0828) +#define FUSION_END_IMPL_07172005_0828 + +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + struct cons_tag; + + template + struct cons; + + template + struct cons_iterator; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef cons_iterator< + typename mpl::if_, nil const, nil>::type> + type; + + static type + call(Sequence& t) + { + return type(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/container/list/detail/equal_to_impl.hpp new file mode 100644 index 00000000..9c64a47f --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/equal_to_impl.hpp @@ -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_EQUAL_TO_IMPL_09172005_1120) +#define FUSION_EQUAL_TO_IMPL_09172005_1120 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct cons_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template <> + struct equal_to_impl + { + template + struct apply + : is_same< + typename I1::identity + , typename I2::identity + > + { + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/list/detail/list_forward_ctor.hpp b/include/boost/fusion/sequence/container/list/detail/list_forward_ctor.hpp new file mode 100644 index 00000000..541b7513 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/list_forward_ctor.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_LIST_FORWARD_CTOR_07172005_0113) +#define FUSION_LIST_FORWARD_CTOR_07172005_0113 + +#include +#include +#include +#include +#include + +#define FUSION_LIST_CTOR_MAKE_CONS(z, n, type) tie_cons(BOOST_PP_CAT(_, n) +#define FUSION_LIST_CL_PAREN(z, n, type) ) + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE) +#include BOOST_PP_ITERATE() + +#undef FUSION_LIST_CTOR_MAKE_CONS +#undef FUSION_LIST_CL_PAREN + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// +#define N BOOST_PP_ITERATION() + +#if N == 1 + explicit +#endif + list(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : inherited_type(list_to_cons::call(BOOST_PP_ENUM_PARAMS(N, _))) + {} + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/list/detail/list_to_cons.hpp b/include/boost/fusion/sequence/container/list/detail/list_to_cons.hpp new file mode 100644 index 00000000..eba36539 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/list_to_cons.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2005 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_LIST_TO_CONS_07172005_1041) +#define FUSION_LIST_TO_CONS_07172005_1041 + +#include +#include +#include +#include +#include +#include + +#define FUSION_VOID(z, n, _) void_ + +namespace boost { namespace fusion +{ + struct nil; + struct void_; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct list_to_cons + { + typedef T0 head_type; + typedef list_to_cons< + BOOST_PP_ENUM_SHIFTED_PARAMS(FUSION_MAX_LIST_SIZE, T), void_> + tail_list_to_cons; + typedef typename tail_list_to_cons::type tail_type; + + typedef cons type; + + #include + }; + + template <> + struct list_to_cons + { + typedef nil type; + }; +}}} + +#undef FUSION_VOID +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/list_to_cons_call.hpp b/include/boost/fusion/sequence/container/list/detail/list_to_cons_call.hpp new file mode 100644 index 00000000..d0cc1821 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/list_to_cons_call.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_LIST_TO_CONS_CALL_07192005_0138) +#define FUSION_LIST_TO_CONS_CALL_07192005_0138 + +#include +#include +#include + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// +#define N BOOST_PP_ITERATION() + + static type + call(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + { + return type(_0 +#if N > 1 + , tail_list_to_cons::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, _))); +#else + ); +#endif + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/list/detail/next_impl.hpp b/include/boost/fusion/sequence/container/list/detail/next_impl.hpp new file mode 100644 index 00000000..92e5c5bd --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/next_impl.hpp @@ -0,0 +1,60 @@ +/*============================================================================= + Copyright (c) 2005 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_NEXT_IMPL_07172005_0836) +#define FUSION_NEXT_IMPL_07172005_0836 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct cons_iterator_tag; + + template + struct cons_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::cons_type cons_type; + typedef typename cons_type::cdr_type cdr_type; + + typedef cons_iterator< + typename mpl::eval_if< + is_const + , add_const + , mpl::identity + >::type> + type; + + static type + call(Iterator const& i) + { + return type(i.cons.cdr); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/container/list/detail/value_at_impl.hpp b/include/boost/fusion/sequence/container/list/detail/value_at_impl.hpp new file mode 100644 index 00000000..28fd7650 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/value_at_impl.hpp @@ -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_VALUE_AT_IMPL_07172005_0952) +#define FUSION_VALUE_AT_IMPL_07172005_0952 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct cons_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + typedef typename + mpl::eval_if< + mpl::bool_ + , mpl::identity + , apply > + >::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/detail/value_of_impl.hpp b/include/boost/fusion/sequence/container/list/detail/value_of_impl.hpp new file mode 100644 index 00000000..b73c73b4 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/detail/value_of_impl.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2005 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_VALUE_OF_IMPL_07172005_0838) +#define FUSION_VALUE_OF_IMPL_07172005_0838 + +namespace boost { namespace fusion +{ + struct cons_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::cons_type cons_type; + typedef typename cons_type::car_type type; + }; + }; + } + +}} + +#endif + + diff --git a/include/boost/fusion/sequence/container/list/limits.hpp b/include/boost/fusion/sequence/container/list/limits.hpp new file mode 100644 index 00000000..0d591098 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/limits.hpp @@ -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_LIST_LIMITS_07172005_0112) +#define FUSION_LIST_LIMITS_07172005_0112 + +#if !defined(FUSION_MAX_LIST_SIZE) +# define FUSION_MAX_LIST_SIZE 10 +#else +# if FUSION_MAX_LIST_SIZE < 3 +# undef FUSION_MAX_LIST_SIZE +# define FUSION_MAX_LIST_SIZE 10 +# endif +#endif + +#endif diff --git a/include/boost/fusion/sequence/container/list/list.hpp b/include/boost/fusion/sequence/container/list/list.hpp new file mode 100644 index 00000000..d3743d10 --- /dev/null +++ b/include/boost/fusion/sequence/container/list/list.hpp @@ -0,0 +1,69 @@ +/*============================================================================= + Copyright (c) 2005 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_LIST_07172005_1153) +#define FUSION_LIST_07172005_1153 + +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + struct void_; + + template + struct list + : detail::list_to_cons::type + { + private: + typedef + detail::list_to_cons + list_to_cons; + + public: + typedef typename list_to_cons::type inherited_type; + + list() + : inherited_type() {} + + template + list(list const& rhs) + : inherited_type(rhs) {} + + template + explicit list(T const& rhs) + : inherited_type(rhs) {} + + // Expand a couple of forwarding constructors for arguments + // of type (T0), (T0, T1), (T0, T1, T2) etc. Exanple: + // + // list( + // typename detail::call_param::type _0 + // , typename detail::call_param::type _1) + // : inherited_type(list_to_cons::call(_0, _1)) {} + #include + + template + list& + operator=(list const& rhs) + { + inherited_type::operator=(rhs); + return *this; + } + + template + list& + operator=(T const& rhs) + { + inherited_type::operator=(rhs); + return *this; + } + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/list/list_fwd.hpp b/include/boost/fusion/sequence/container/list/list_fwd.hpp new file mode 100644 index 00000000..120f96bc --- /dev/null +++ b/include/boost/fusion/sequence/container/list/list_fwd.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2005 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_LIST_FORWARD_07172005_0224) +#define FUSION_LIST_FORWARD_07172005_0224 + +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_LIST_SIZE, typename T, void_) + > + struct list; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map.hpp b/include/boost/fusion/sequence/container/map.hpp new file mode 100644 index 00000000..72cd4790 --- /dev/null +++ b/include/boost/fusion/sequence/container/map.hpp @@ -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_SEQUENCE_CLASS_MAP_10022005_0606) +#define FUSION_SEQUENCE_CLASS_MAP_10022005_0606 + +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/container/map/detail/at_key_impl.hpp b/include/boost/fusion/sequence/container/map/detail/at_key_impl.hpp new file mode 100644 index 00000000..9fdd7817 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/at_key_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + 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_AT_KEY_IMPL_05222005_0254) +#define FUSION_AT_KEY_IMPL_05222005_0254 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct map_tag; + + namespace extension + { + template + struct at_key_impl; + + template <> + struct at_key_impl + { + template + struct apply + { + typedef typename Sequence::template meta_at_impl element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + static type + call(Sequence& m) + { + return m.at_impl(mpl::identity()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/detail/begin_impl.hpp b/include/boost/fusion/sequence/container/map/detail/begin_impl.hpp new file mode 100644 index 00000000..c2c5fe7a --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_05222005_1108) +#define FUSION_BEGIN_IMPL_05222005_1108 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct map_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename + result_of::begin::type + iterator_type; + + typedef typename + result_of::begin::type + const_iterator_type; + + typedef typename + mpl::eval_if< + is_const + , mpl::identity + , mpl::identity + >::type + type; + + static type + call(Sequence& m) + { + return fusion::begin(m.get_data()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/detail/end_impl.hpp b/include/boost/fusion/sequence/container/map/detail/end_impl.hpp new file mode 100644 index 00000000..9778c502 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/end_impl.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + 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_END_IMPL_05222005_1108) +#define FUSION_END_IMPL_05222005_1108 + +#include + +namespace boost { namespace fusion +{ + struct map_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename + result_of::end::type + iterator_type; + + typedef typename + result_of::end::type + const_iterator_type; + + typedef typename + mpl::eval_if< + is_const + , mpl::identity + , mpl::identity + >::type + type; + + static type + call(Sequence& m) + { + return fusion::end(m.get_data()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/detail/is_associative_impl.hpp b/include/boost/fusion/sequence/container/map/detail/is_associative_impl.hpp new file mode 100644 index 00000000..656d0114 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/is_associative_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + 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(BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2310) +#define BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2310 + +#include + +namespace boost { namespace fusion { + + struct map_tag; + + namespace extension { + template + struct is_associative_impl; + + template<> + struct is_associative_impl + { + template + struct apply + : mpl::true_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/detail/lookup_key.hpp b/include/boost/fusion/sequence/container/map/detail/lookup_key.hpp new file mode 100644 index 00000000..c4d037ec --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/lookup_key.hpp @@ -0,0 +1,100 @@ +/*============================================================================= + 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_LOOKUP_KEY_07222005_1248) +#define FUSION_LOOKUP_KEY_07222005_1248 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct map_data_type + { + typedef typename + add_reference< + typename T::second_type + >::type + type; + }; + + template <> + struct map_data_type + { + typedef void_& type; + }; + + template + struct map_const_data_type + { + typedef typename + add_reference< + typename add_const< + typename T::second_type + >::type + >::type + type; + }; + + template <> + struct map_const_data_type + { + typedef void_ const& type; + }; + + template + struct map_value_type + { + typedef typename T::second_type type; + }; + + template <> + struct map_value_type + { + typedef void_ type; + }; + + template + struct map_key_type + { + typedef typename T::first_type type; + }; + + template + struct map_key_type + { + typedef unknown_key type; + }; + + template + struct map_lookup_key + { + static RT + call(Vector& vec) + { + return vec.at_impl(mpl::int_()).second; + } + }; + + template + struct map_lookup_key, Vector> + { + static void_& + call(Vector& vec); // intentionally undefined + }; +}}} + +#endif + diff --git a/include/boost/fusion/sequence/container/map/detail/map_forward_ctor.hpp b/include/boost/fusion/sequence/container/map/detail/map_forward_ctor.hpp new file mode 100644 index 00000000..b641f31b --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/map_forward_ctor.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAP_FORWARD_CTOR_07222005_0106) +#define FUSION_MAP_FORWARD_CTOR_07222005_0106 + +#include +#include +#include + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + +#if N == 1 + explicit +#endif + map(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + : data(BOOST_PP_ENUM_PARAMS(N, _)) {} + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/map/detail/map_lookup.hpp b/include/boost/fusion/sequence/container/map/detail/map_lookup.hpp new file mode 100644 index 00000000..4557aa2d --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/map_lookup.hpp @@ -0,0 +1,124 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAP_LOOKUP_07212005_1118) +#define FUSION_MAP_LOOKUP_07212005_1118 + +#include +#include +#include +#include +#include + +#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310) +#pragma warning(disable: 4348) // redefinition of default parameter +#endif + + template + struct meta_at_impl + { + typedef void_ type; + }; + + template + struct meta_find_impl + { + typedef vector_iterator type; + }; + + template + struct meta_find_impl_const + { + typedef vector_iterator type; + }; + + template + vector_iterator + find_impl(mpl::identity) const + { + return vector_iterator(data); + } + + template + vector_iterator + find_impl(mpl::identity) + { + return vector_iterator(data); + } + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_DEC(FUSION_MAX_MAP_SIZE)) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template + struct meta_at_impl< + typename detail::map_key_type::type, dummy> + { + typedef typename detail::map_value_type::type type; + }; + + typename detail::map_data_type::type + at_impl(mpl::identity::type>) + { + return detail::map_lookup_key< + N + , typename detail::map_data_type::type + , typename detail::map_key_type::type + , storage_type>::call(data); + } + + typename detail::map_const_data_type::type + at_impl(mpl::identity::type>) const + { + return detail::map_lookup_key< + N + , typename detail::map_const_data_type::type + , typename detail::map_key_type::type + , storage_type const>::call(data); + } + + template + struct meta_find_impl< + typename detail::map_key_type::type, dummy> + { + typedef vector_iterator type; + }; + + template + struct meta_find_impl_const< + typename detail::map_key_type::type, dummy> + { + typedef vector_iterator type; + }; + + vector_iterator + find_impl(mpl::identity::type>) + { + return vector_iterator(data); + } + + vector_iterator + find_impl(mpl::identity::type>) const + { + return vector_iterator(data); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/map/detail/value_at_key_impl.hpp b/include/boost/fusion/sequence/container/map/detail/value_at_key_impl.hpp new file mode 100644 index 00000000..5578de80 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/detail/value_at_key_impl.hpp @@ -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_VALUE_AT_KEY_IMPL_05222005_0325) +#define FUSION_VALUE_AT_KEY_IMPL_05222005_0325 + +namespace boost { namespace fusion +{ + struct map_tag; + + namespace extension + { + template + struct value_at_key_impl; + + template <> + struct value_at_key_impl + { + template + struct apply + { + typedef typename Sequence:: + template meta_at_impl::type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/limits.hpp b/include/boost/fusion/sequence/container/map/limits.hpp new file mode 100644 index 00000000..c7859ba1 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/limits.hpp @@ -0,0 +1,26 @@ +/*============================================================================= + 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_MAP_LIMITS_07212005_1104) +#define FUSION_MAP_LIMITS_07212005_1104 + +#include + +#if !defined(FUSION_MAX_MAP_SIZE) +# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE +#else +# if FUSION_MAX_MAP_SIZE < 3 +# undef FUSION_MAX_MAP_SIZE +# if (FUSION_MAX_VECTOR_SIZE > 10) +# define FUSION_MAX_MAP_SIZE 10 +# else +# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE +# endif +# endif +#endif + +#endif diff --git a/include/boost/fusion/sequence/container/map/map.hpp b/include/boost/fusion/sequence/container/map/map.hpp new file mode 100644 index 00000000..21976dfb --- /dev/null +++ b/include/boost/fusion/sequence/container/map/map.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2005 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_MAP_07212005_1106) +#define FUSION_MAP_07212005_1106 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct map_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + template + struct map : sequence_base > + { + typedef map_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef forward_sequence_tag category; + typedef mpl::false_ is_view; + + typedef vector< + BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> + storage_type; + + typedef typename storage_type::size size; + + map() + : data() {} + + template + explicit map(T const& rhs) + : data(rhs) {} + + #include + #include + + template + map& + operator=(T const& rhs) + { + data = rhs; + return *this; + } + + storage_type& get_data() { return data; } + storage_type const& get_data() const { return data; } + + private: + + storage_type data; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/map/map_fwd.hpp b/include/boost/fusion/sequence/container/map/map_fwd.hpp new file mode 100644 index 00000000..2cbfe8a3 --- /dev/null +++ b/include/boost/fusion/sequence/container/map/map_fwd.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2005 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_MAP_FORWARD_07212005_1105) +#define FUSION_MAP_FORWARD_07212005_1105 + +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_MAP_SIZE, typename T, void_) + > + struct map; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set.hpp b/include/boost/fusion/sequence/container/set.hpp new file mode 100644 index 00000000..477f8ecf --- /dev/null +++ b/include/boost/fusion/sequence/container/set.hpp @@ -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_SEQUENCE_CLASS_SET_10022005_0607) +#define FUSION_SEQUENCE_CLASS_SET_10022005_0607 + +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/container/set/detail/at_key_impl.hpp b/include/boost/fusion/sequence/container/set/detail/at_key_impl.hpp new file mode 100644 index 00000000..42609cf2 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/at_key_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + 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_AT_KEY_IMPL_09162005_1118) +#define FUSION_AT_KEY_IMPL_09162005_1118 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct set_tag; + + namespace extension + { + template + struct at_key_impl; + + template <> + struct at_key_impl + { + template + struct apply + { + typedef typename Sequence::template meta_at_impl element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + static type + call(Sequence& s) + { + return s.at_impl(mpl::identity()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/detail/begin_impl.hpp b/include/boost/fusion/sequence/container/set/detail/begin_impl.hpp new file mode 100644 index 00000000..4535d617 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_09162005_1120) +#define FUSION_BEGIN_IMPL_09162005_1120 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct set_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename + result_of::begin::type + iterator_type; + + typedef typename + result_of::begin::type + const_iterator_type; + + typedef typename + mpl::eval_if< + is_const + , mpl::identity + , mpl::identity + >::type + type; + + static type + call(Sequence& s) + { + return fusion::begin(s.get_data()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/detail/end_impl.hpp b/include/boost/fusion/sequence/container/set/detail/end_impl.hpp new file mode 100644 index 00000000..4e098a15 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/end_impl.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + 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_END_IMPL_09162005_1121) +#define FUSION_END_IMPL_09162005_1121 + +#include + +namespace boost { namespace fusion +{ + struct set_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename + result_of::end::type + iterator_type; + + typedef typename + result_of::end::type + const_iterator_type; + + typedef typename + mpl::eval_if< + is_const + , mpl::identity + , mpl::identity + >::type + type; + + static type + call(Sequence& s) + { + return fusion::end(s.get_data()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/detail/is_associative_impl.hpp b/include/boost/fusion/sequence/container/set/detail/is_associative_impl.hpp new file mode 100644 index 00000000..d167ee63 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/is_associative_impl.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + 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(BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2219) +#define BOOST_FUSION_IS_ASSOCIATIVE_IMPL_20060304_2219 + +#include + +namespace boost { namespace fusion { + + struct set_tag; + + namespace extension { + template + struct is_associative_impl; + + template<> + struct is_associative_impl + { + template + struct apply + : mpl::true_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/detail/lookup_key.hpp b/include/boost/fusion/sequence/container/set/detail/lookup_key.hpp new file mode 100644 index 00000000..23dbfaf1 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/lookup_key.hpp @@ -0,0 +1,94 @@ +/*============================================================================= + 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_LOOKUP_KEY_09162005_1111) +#define FUSION_LOOKUP_KEY_09162005_1111 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct set_data_type + { + typedef typename add_reference::type type; + }; + + template <> + struct set_data_type + { + typedef void_& type; + }; + + template + struct set_const_data_type + { + typedef typename + add_reference< + typename add_const::type + >::type + type; + }; + + template <> + struct set_const_data_type + { + typedef void_ const& type; + }; + + template + struct set_value_type + { + typedef T type; + }; + + template <> + struct set_value_type + { + typedef void_ type; + }; + + template + struct set_key_type + { + typedef T type; + }; + + template + struct set_key_type + { + typedef unknown_key type; + }; + + template + struct set_lookup_key + { + static RT + call(Vector& vec) + { + return vec.at_impl(mpl::int_()); + } + }; + + template + struct set_lookup_key, Vector> + { + static void_& + call(Vector& vec); // intentionally undefined + }; +}}} + +#endif + diff --git a/include/boost/fusion/sequence/container/set/detail/set_forward_ctor.hpp b/include/boost/fusion/sequence/container/set/detail/set_forward_ctor.hpp new file mode 100644 index 00000000..76a89e3a --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/set_forward_ctor.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_SET_FORWARD_CTOR_09162005_1115) +#define FUSION_SET_FORWARD_CTOR_09162005_1115 + +#include +#include +#include + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + +#if N == 1 + explicit +#endif + set(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : data(BOOST_PP_ENUM_PARAMS(N, _)) {} + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/set/detail/set_lookup.hpp b/include/boost/fusion/sequence/container/set/detail/set_lookup.hpp new file mode 100644 index 00000000..2ce15e1c --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/set_lookup.hpp @@ -0,0 +1,124 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_SET_LOOKUP_09162005_1116) +#define FUSION_SET_LOOKUP_09162005_1116 + +#include +#include +#include +#include +#include + +#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310) +#pragma warning(disable: 4348) // redefinition of default parameter +#endif + + template + struct meta_at_impl + { + typedef void_ type; + }; + + template + struct meta_find_impl + { + typedef vector_iterator type; + }; + + template + struct meta_find_impl_const + { + typedef vector_iterator type; + }; + + template + vector_iterator + find_impl(mpl::identity) const + { + return vector_iterator(data); + } + + template + vector_iterator + find_impl(mpl::identity) + { + return vector_iterator(data); + } + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_DEC(FUSION_MAX_SET_SIZE)) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template + struct meta_at_impl< + typename detail::set_key_type::type, dummy> + { + typedef typename detail::set_value_type::type type; + }; + + typename detail::set_data_type::type + at_impl(mpl::identity::type>) + { + return detail::set_lookup_key< + N + , typename detail::set_data_type::type + , typename detail::set_key_type::type + , storage_type>::call(data); + } + + typename detail::set_const_data_type::type + at_impl(mpl::identity::type>) const + { + return detail::set_lookup_key< + N + , typename detail::set_const_data_type::type + , typename detail::set_key_type::type + , storage_type const>::call(data); + } + + template + struct meta_find_impl< + typename detail::set_key_type::type, dummy> + { + typedef vector_iterator type; + }; + + template + struct meta_find_impl_const< + typename detail::set_key_type::type, dummy> + { + typedef vector_iterator type; + }; + + vector_iterator + find_impl(mpl::identity::type>) + { + return vector_iterator(data); + } + + vector_iterator + find_impl(mpl::identity::type>) const + { + return vector_iterator(data); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/set/detail/value_at_key_impl.hpp b/include/boost/fusion/sequence/container/set/detail/value_at_key_impl.hpp new file mode 100644 index 00000000..1755eb6d --- /dev/null +++ b/include/boost/fusion/sequence/container/set/detail/value_at_key_impl.hpp @@ -0,0 +1,36 @@ +/*============================================================================= + 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_VALUE_AT_KEY_IMPL_09162005_1123) +#define FUSION_VALUE_AT_KEY_IMPL_09162005_1123 + +#include + +namespace boost { namespace fusion +{ + struct set_tag; + + namespace extension + { + template + struct value_at_key_impl; + + template <> + struct value_at_key_impl + { + template + struct apply + { + typedef typename Sequence:: + template meta_at_impl::type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/limits.hpp b/include/boost/fusion/sequence/container/set/limits.hpp new file mode 100644 index 00000000..d278ac47 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/limits.hpp @@ -0,0 +1,26 @@ +/*============================================================================= + 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_SET_LIMITS_09162005_1103) +#define FUSION_SET_LIMITS_09162005_1103 + +#include + +#if !defined(FUSION_MAX_SET_SIZE) +# define FUSION_MAX_SET_SIZE FUSION_MAX_VECTOR_SIZE +#else +# if FUSION_MAX_SET_SIZE < 3 +# undef FUSION_MAX_SET_SIZE +# if (FUSION_MAX_VECTOR_SIZE > 10) +# define FUSION_MAX_SET_SIZE 10 +# else +# define FUSION_MAX_SET_SIZE FUSION_MAX_VECTOR_SIZE +# endif +# endif +#endif + +#endif diff --git a/include/boost/fusion/sequence/container/set/set.hpp b/include/boost/fusion/sequence/container/set/set.hpp new file mode 100644 index 00000000..2a47f523 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/set.hpp @@ -0,0 +1,72 @@ +/*============================================================================= + Copyright (c) 2005 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_SET_09162005_1104) +#define FUSION_SET_09162005_1104 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct set_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + template + struct set : sequence_base > + { + typedef set_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef forward_sequence_tag category; + typedef mpl::false_ is_view; + + typedef vector< + BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, T)> + storage_type; + + typedef typename storage_type::size size; + + set() + : data() {} + + template + explicit set(T const& rhs) + : data(rhs) {} + + #include + #include + + template + set& + operator=(T const& rhs) + { + data = rhs; + return *this; + } + + storage_type& get_data() { return data; } + storage_type const& get_data() const { return data; } + + private: + + storage_type data; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/set/set_fwd.hpp b/include/boost/fusion/sequence/container/set/set_fwd.hpp new file mode 100644 index 00000000..610f27a7 --- /dev/null +++ b/include/boost/fusion/sequence/container/set/set_fwd.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2005 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_SET_FORWARD_09162005_1102) +#define FUSION_SET_FORWARD_09162005_1102 + +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_SET_SIZE, typename T, void_) + > + struct set; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector.hpp b/include/boost/fusion/sequence/container/vector.hpp new file mode 100644 index 00000000..100fe118 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector.hpp @@ -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_CLASS_VECTOR_10022005_0602) +#define FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/advance_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/advance_impl.hpp new file mode 100644 index 00000000..24dc4f2d --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/advance_impl.hpp @@ -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_ADVANCE_IMPL_09172005_1156) +#define FUSION_ADVANCE_IMPL_09172005_1156 + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + + template + struct vector_iterator; + + namespace extension + { + template + struct advance_impl; + + template <> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::index index; + typedef typename Iterator::vector vector; + typedef vector_iterator type; + + static type + call(Iterator const& i) + { + return type(i.vec); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/at_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/at_impl.hpp new file mode 100644 index 00000000..b38119a1 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/at_impl.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + 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_AT_IMPL_05042005_0741) +#define FUSION_AT_IMPL_05042005_0741 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace extension + { + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply + { + typedef mpl::at element; + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + static type + call(Sequence& v) + { + return v.at_impl(N()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/begin_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/begin_impl.hpp new file mode 100644 index 00000000..b261968a --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_05042005_1136) +#define FUSION_BEGIN_IMPL_05042005_1136 + +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef vector_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/deref_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/deref_impl.hpp new file mode 100644 index 00000000..25f0d5fe --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/deref_impl.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + 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_05042005_1037) +#define FUSION_DEREF_IMPL_05042005_1037 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::vector vector; + typedef typename Iterator::index index; + typedef typename mpl::at< + typename vector::types, index> + element; + + typedef typename + mpl::eval_if< + is_const + , fusion::detail::cref_result + , fusion::detail::ref_result + >::type + type; + + static type + call(Iterator const& i) + { + return i.vec.at_impl(index()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/distance_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/distance_impl.hpp new file mode 100644 index 00000000..43f2a40e --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/distance_impl.hpp @@ -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_DISTANCE_IMPL_09172005_0751) +#define FUSION_DISTANCE_IMPL_09172005_0751 + +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + + namespace extension + { + template + struct distance_impl; + + template <> + struct distance_impl + { + template + struct apply : mpl::minus + { + 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 diff --git a/include/boost/fusion/sequence/container/vector/detail/end_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/end_impl.hpp new file mode 100644 index 00000000..0d760754 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/end_impl.hpp @@ -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_END_IMPL_05042005_1142) +#define FUSION_END_IMPL_05042005_1142 + +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::size size; + typedef vector_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/equal_to_impl.hpp new file mode 100644 index 00000000..b4971b94 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/equal_to_impl.hpp @@ -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_EQUAL_TO_IMPL_05052005_1215) +#define FUSION_EQUAL_TO_IMPL_05052005_1215 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + + namespace extension + { + template + struct equal_to_impl; + + template <> + struct equal_to_impl + { + template + struct apply + : is_same< + typename I1::identity + , typename I2::identity + > + { + }; + }; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/detail/next_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/next_impl.hpp new file mode 100644 index 00000000..acc7ecf7 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/next_impl.hpp @@ -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_NEXT_IMPL_05042005_1058) +#define FUSION_NEXT_IMPL_05042005_1058 + +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + template + struct vector_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::vector vector; + typedef typename Iterator::index index; + typedef vector_iterator type; + + static type + call(Iterator const& i) + { + return type(i.vec); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/prior_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/prior_impl.hpp new file mode 100644 index 00000000..cf6e80f5 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/prior_impl.hpp @@ -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_PRIOR_IMPL_05042005_1145) +#define FUSION_PRIOR_IMPL_05042005_1145 + +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + template + struct vector_iterator; + + namespace extension + { + template + struct prior_impl; + + template <> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::vector vector; + typedef typename Iterator::index index; + typedef vector_iterator type; + + static type + call(Iterator const& i) + { + return type(i.vec); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/value_at_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/value_at_impl.hpp new file mode 100644 index 00000000..1910400a --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/value_at_impl.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + 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_AT_IMPL_05052005_0232) +#define FUSION_VALUE_AT_IMPL_05052005_0232 + +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + + namespace extension + { + template + struct value_at_impl; + + template <> + struct value_at_impl + { + template + struct apply + { + typedef typename mpl::at::type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/value_of_impl.hpp b/include/boost/fusion/sequence/container/vector/detail/value_of_impl.hpp new file mode 100644 index 00000000..f37e0b5d --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/value_of_impl.hpp @@ -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_IMPL_05052005_1128) +#define FUSION_VALUE_OF_IMPL_05052005_1128 + +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::vector vector; + typedef typename Iterator::index index; + typedef typename mpl::at< + typename vector::types, index>::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/detail/vector_forward_ctor.hpp b/include/boost/fusion/sequence/container/vector/detail/vector_forward_ctor.hpp new file mode 100644 index 00000000..dc5535f1 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/vector_forward_ctor.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_VECTOR_FORWARD_CTOR_07122005_1123) +#define FUSION_VECTOR_FORWARD_CTOR_07122005_1123 + +#include +#include +#include + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + +#if N == 1 + explicit +#endif + vector(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : vec(BOOST_PP_ENUM_PARAMS(N, _)) {} + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/container/vector/detail/vector_n.hpp b/include/boost/fusion/sequence/container/vector/detail/vector_n.hpp new file mode 100644 index 00000000..4d5a965c --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/vector_n.hpp @@ -0,0 +1,143 @@ +/*============================================================================= + 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) +==============================================================================*/ +// No include guard. This file is meant to be included many times + +#if !defined(FUSION_MACRO_05042005) +#define FUSION_MACRO_05042005 + +#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n(T##n()) +#define FUSION_MEMBER_INIT(z, n, _) m##n(_##n) +#define FUSION_COPY_INIT(z, n, _) m##n(other.m##n) +#define FUSION_MEMBER_DECL(z, n, _) T##n m##n; + +#define FUSION_MEMBER_ASSIGN(z, n, _) \ + this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n); + +#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _) \ + this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n); + +#define FUSION_AT_IMPL(z, n, _) \ + typename add_reference::type \ + at_impl(mpl::int_) { return this->m##n; } \ + typename add_reference::type>::type \ + at_impl(mpl::int_) const { return this->m##n; } + +#define FUSION_ITER_DECL_VAR(z, n, _) \ + typedef typename result_of::next< \ + BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \ + BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \ + = fusion::next(BOOST_PP_CAT(i, BOOST_PP_DEC(n))); + +#endif + +#define N BOOST_PP_ITERATION() + + template + struct BOOST_PP_CAT(vector_data, N) : sequence_base + { + BOOST_PP_CAT(vector_data, N)() + : BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {} + + BOOST_PP_CAT(vector_data, N)( + BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {} + + BOOST_PP_CAT(vector_data, N)( + BOOST_PP_CAT(vector_data, N) const& other) + : BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {} + + BOOST_PP_CAT(vector_data, N)& + operator=(BOOST_PP_CAT(vector_data, N) const& vec) + { + BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _) + return *this; + } + + template + static BOOST_PP_CAT(vector_data, N) + init_from_sequence(Sequence const& seq) + { + typedef typename result_of::begin::type I0; + I0 i0 = fusion::begin(seq); + BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _) + return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i)); + } + + BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _) + }; + + template + struct BOOST_PP_CAT(vector, N) + : BOOST_PP_CAT(vector_data, N)< + BOOST_PP_CAT(vector, N) + , BOOST_PP_ENUM_PARAMS(N, T)> + { + typedef BOOST_PP_CAT(vector, N) this_type; + typedef BOOST_PP_CAT(vector_data, N) base_type; + typedef mpl::BOOST_PP_CAT(vector, N) types; + typedef vector_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + typedef random_access_sequence_tag category; + typedef mpl::int_ size; + + BOOST_PP_CAT(vector, N)() {} + + BOOST_PP_CAT(vector, N)( + BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} + + template + BOOST_PP_CAT(vector, N)( + BOOST_PP_CAT(vector, N) const& vec) + : base_type(BOOST_PP_ENUM_PARAMS(N, vec.m)) {} + + template + explicit BOOST_PP_CAT(vector, N)( + Sequence const& seq + , typename disable_if >::type* dummy = 0) + : base_type(base_type::init_from_sequence(seq)) {} + + template + BOOST_PP_CAT(vector, N)& + operator=(BOOST_PP_CAT(vector, N) const& vec) + { + BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _) + return *this; + } + + template + typename disable_if, this_type&>::type + operator=(Sequence const& seq) + { + typedef typename result_of::begin::type I0; + I0 i0 = fusion::begin(seq); + BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _) + BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _) + return *this; + } + + BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _) + + template + typename add_reference::type>::type + at_impl(I i) + { + return this->at_impl(mpl::int_()); + } + + template + typename add_reference::type>::type>::type + at_impl(I i) const + { + return this->at_impl(mpl::int_()); + } + }; + diff --git a/include/boost/fusion/sequence/container/vector/detail/vector_n_chooser.hpp b/include/boost/fusion/sequence/container/vector/detail/vector_n_chooser.hpp new file mode 100644 index 00000000..9d6724af --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/detail/vector_n_chooser.hpp @@ -0,0 +1,100 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_VECTOR_N_CHOOSER_07072005_1248) +#define FUSION_VECTOR_N_CHOOSER_07072005_1248 + +#include + +// include vector0..N where N is FUSION_MAX_VECTOR_SIZE +#include +#if (FUSION_MAX_VECTOR_SIZE > 10) +#include +#endif +#if (FUSION_MAX_VECTOR_SIZE > 20) +#include +#endif +#if (FUSION_MAX_VECTOR_SIZE > 30) +#include +#endif +#if (FUSION_MAX_VECTOR_SIZE > 40) +#include +#endif + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct get_vector_n; + + template <> + struct get_vector_n<0> + { + template + struct call + { + typedef vector0 type; + }; + }; + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + + template + struct vector_n_chooser + { + typedef + mpl::BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE) + + input; + + typedef typename mpl::begin::type begin; + typedef typename mpl::find::type end; + typedef typename mpl::distance::type size; + + typedef typename get_vector_n::template + call::type + type; + }; +}}} + +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// +#else // defined(BOOST_PP_IS_ITERATING) + +#define N BOOST_PP_ITERATION() + + template <> + struct get_vector_n + { + template + struct call + { + typedef BOOST_PP_CAT(vector, N) type; + }; + }; + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) diff --git a/include/boost/fusion/sequence/container/vector/limits.hpp b/include/boost/fusion/sequence/container/vector/limits.hpp new file mode 100644 index 00000000..27af0fcf --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/limits.hpp @@ -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_VECTOR_LIMITS_07072005_1246) +#define FUSION_VECTOR_LIMITS_07072005_1246 + +#if !defined(FUSION_MAX_VECTOR_SIZE) +# define FUSION_MAX_VECTOR_SIZE 10 +#else +# if FUSION_MAX_VECTOR_SIZE < 3 +# undef FUSION_MAX_VECTOR_SIZE +# define FUSION_MAX_VECTOR_SIZE 10 +# endif +#endif + +#endif diff --git a/include/boost/fusion/sequence/container/vector/vector.hpp b/include/boost/fusion/sequence/container/vector/vector.hpp new file mode 100644 index 00000000..58f7f6b8 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector.hpp @@ -0,0 +1,129 @@ +/*============================================================================= + 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_VECTOR_07072005_1244) +#define FUSION_VECTOR_07072005_1244 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct fusion_sequence_tag; + + template + struct vector + : sequence_base > + { + private: + + typedef typename detail::vector_n_chooser< + BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type + vector_n; + + template + friend struct vector; + + public: + + typedef typename vector_n::types types; + typedef typename vector_n::ftag ftag; + typedef typename vector_n::tag tag; + typedef typename vector_n::size size; + typedef typename vector_n::category category; + typedef typename vector_n::is_view is_view; + + vector() + : vec() {} + + template + vector(vector const& rhs) + : vec(rhs.vec) {} + + template + explicit vector(T const& rhs) + : vec(rhs) {} + + // Expand a couple of forwarding constructors for arguments + // of type (T0), (T0, T1), (T0, T1, T2) etc. Exanple: + // + // vector( + // typename detail::call_param::type _0 + // , typename detail::call_param::type _1) + // : vec(_0, _1) {} + #include + + template + vector& + operator=(vector const& rhs) + { + vec = rhs.vec; + return *this; + } + + template + vector& + operator=(T const& rhs) + { + vec = rhs; + return *this; + } + + template + typename add_reference< + typename mpl::at_c::type + >::type + at_impl(mpl::int_ index) + { + return vec.at_impl(index); + } + + template + typename add_reference< + typename add_const< + typename mpl::at_c::type + >::type + >::type + at_impl(mpl::int_ index) const + { + return vec.at_impl(index); + } + + template + typename add_reference< + typename mpl::at::type + >::type + at_impl(I index) + { + return vec.at_impl(mpl::int_()); + } + + template + typename add_reference< + typename add_const< + typename mpl::at::type + >::type + >::type + at_impl(I index) const + { + return vec.at_impl(mpl::int_()); + } + + private: + + vector_n vec; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/vector10.hpp b/include/boost/fusion/sequence/container/vector/vector10.hpp new file mode 100644 index 00000000..8b760b0e --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector10.hpp @@ -0,0 +1,61 @@ +/*============================================================================= + 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_VECTOR10_05042005_0257) +#define FUSION_VECTOR10_05042005_0257 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct fusion_sequence_tag; + struct random_access_sequence_tag; + + struct vector0 : sequence_base + { + typedef mpl::vector0<> types; + typedef vector_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::false_ is_view; + typedef random_access_sequence_tag category; + typedef mpl::int_<0> size; + }; + +// expand vector1 to vector10 +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, 10) +#include BOOST_PP_ITERATE() + +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/vector20.hpp b/include/boost/fusion/sequence/container/vector/vector20.hpp new file mode 100644 index 00000000..1a4f94d2 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector20.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_VECTOR20_05052005_0205) +#define FUSION_VECTOR20_05052005_0205 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct fusion_sequence_tag; + struct random_access_sequence_tag; + +// expand vector11 to vector20 +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (11, 20) +#include BOOST_PP_ITERATE() + +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/vector30.hpp b/include/boost/fusion/sequence/container/vector/vector30.hpp new file mode 100644 index 00000000..8b5325ba --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector30.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_VECTOR30_05052005_0206) +#define FUSION_VECTOR30_05052005_0206 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct fusion_sequence_tag; + struct random_access_sequence_tag; + +// expand vector21 to vector30 +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (21, 30) +#include BOOST_PP_ITERATE() + +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/vector40.hpp b/include/boost/fusion/sequence/container/vector/vector40.hpp new file mode 100644 index 00000000..90aa1614 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector40.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_VECTOR40_05052005_0208) +#define FUSION_VECTOR40_05052005_0208 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct fusion_sequence_tag; + struct random_access_sequence_tag; + +// expand vector31 to vector40 +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (31, 40) +#include BOOST_PP_ITERATE() + +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/vector50.hpp b/include/boost/fusion/sequence/container/vector/vector50.hpp new file mode 100644 index 00000000..12fca5bf --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector50.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_VECTOR50_05052005_0207) +#define FUSION_VECTOR50_05052005_0207 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_tag; + struct fusion_sequence_tag; + struct random_access_sequence_tag; + +// expand vector41 to vector50 +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (41, 50) +#include BOOST_PP_ITERATE() + +}} + +#endif + diff --git a/include/boost/fusion/sequence/container/vector/vector_fwd.hpp b/include/boost/fusion/sequence/container/vector/vector_fwd.hpp new file mode 100644 index 00000000..cdd07d4f --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector_fwd.hpp @@ -0,0 +1,26 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_VECTOR_FORWARD_07072005_0125) +#define FUSION_VECTOR_FORWARD_07072005_0125 + +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename T, void_) + > + struct vector; +}} + +#endif diff --git a/include/boost/fusion/sequence/container/vector/vector_iterator.hpp b/include/boost/fusion/sequence/container/vector/vector_iterator.hpp new file mode 100644 index 00000000..e76f9e35 --- /dev/null +++ b/include/boost/fusion/sequence/container/vector/vector_iterator.hpp @@ -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_VECTOR_ITERATOR_05042005_0635) +#define FUSION_VECTOR_ITERATOR_05042005_0635 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct vector_iterator_tag; + struct random_access_traversal_tag; + + template + struct vector_iterator_identity; + + template + struct vector_iterator : iterator_base > + { + typedef mpl::int_ index; + typedef Vector vector; + typedef vector_iterator_tag ftag; + typedef random_access_traversal_tag category; + typedef vector_iterator_identity< + typename add_const::type, N> identity; + + vector_iterator(Vector& vec) + : vec(vec) {} + Vector& vec; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/conversion.hpp b/include/boost/fusion/sequence/conversion.hpp new file mode 100644 index 00000000..471bd27d --- /dev/null +++ b/include/boost/fusion/sequence/conversion.hpp @@ -0,0 +1,16 @@ +/*============================================================================= + 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_CONVERSION_10022005_0622) +#define FUSION_SEQUENCE_CONVERSION_10022005_0622 + +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/conversion/as_list.hpp b/include/boost/fusion/sequence/conversion/as_list.hpp new file mode 100644 index 00000000..02a43c76 --- /dev/null +++ b/include/boost/fusion/sequence/conversion/as_list.hpp @@ -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_AS_LIST_09232005_1215) +#define FUSION_AS_LIST_09232005_1215 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct as_list + { + typedef typename + detail::build_cons< + typename result_of::begin::type + , typename result_of::end::type + > + build_cons; + + typedef typename build_cons::type type; + + static type + call(Sequence& seq) + { + return build_cons::call(fusion::begin(seq), fusion::end(seq)); + } + }; + } + + template + inline typename result_of::as_list::type + as_list(Sequence& seq) + { + return result_of::as_list::call(seq); + } + + template + inline typename result_of::as_list::type + as_list(Sequence const& seq) + { + return result_of::as_list::call(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/conversion/as_map.hpp b/include/boost/fusion/sequence/conversion/as_map.hpp new file mode 100644 index 00000000..31b97a17 --- /dev/null +++ b/include/boost/fusion/sequence/conversion/as_map.hpp @@ -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_AS_MAP_09232005_1340) +#define FUSION_AS_MAP_09232005_1340 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct as_map + { + typedef typename detail::as_map::value> gen; + typedef typename gen:: + template apply::type>::type + type; + }; + } + + template + inline typename result_of::as_map::type + as_map(Sequence& seq) + { + typedef typename result_of::as_map::gen gen; + return gen::call(fusion::begin(seq)); + } + + template + inline typename result_of::as_map::type + as_map(Sequence const& seq) + { + typedef typename result_of::as_map::gen gen; + return gen::call(fusion::begin(seq)); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/conversion/as_set.hpp b/include/boost/fusion/sequence/conversion/as_set.hpp new file mode 100644 index 00000000..b2cc3061 --- /dev/null +++ b/include/boost/fusion/sequence/conversion/as_set.hpp @@ -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_AS_SET_09232005_1341) +#define FUSION_AS_SET_09232005_1341 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct as_set + { + typedef typename detail::as_set::value> gen; + typedef typename gen:: + template apply::type>::type + type; + }; + } + + template + inline typename result_of::as_set::type + as_set(Sequence& seq) + { + typedef typename result_of::as_set::gen gen; + return gen::call(fusion::begin(seq)); + } + + template + inline typename result_of::as_set::type + as_set(Sequence const& seq) + { + typedef typename result_of::as_set::gen gen; + return gen::call(fusion::begin(seq)); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/conversion/as_vector.hpp b/include/boost/fusion/sequence/conversion/as_vector.hpp new file mode 100644 index 00000000..077eb564 --- /dev/null +++ b/include/boost/fusion/sequence/conversion/as_vector.hpp @@ -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_AS_VECTOR_09222005_1104) +#define FUSION_AS_VECTOR_09222005_1104 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace result_of + { + template + struct as_vector + { + typedef typename detail::as_vector::value> gen; + typedef typename gen:: + template apply::type>::type + type; + }; + } + + template + inline typename result_of::as_vector::type + as_vector(Sequence& seq) + { + typedef typename result_of::as_vector::gen gen; + return gen::call(fusion::begin(seq)); + } + + template + inline typename result_of::as_vector::type + as_vector(Sequence const& seq) + { + typedef typename result_of::as_vector::gen gen; + return gen::call(fusion::begin(seq)); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/conversion/detail/as_map.hpp b/include/boost/fusion/sequence/conversion/detail/as_map.hpp new file mode 100644 index 00000000..480dbd1d --- /dev/null +++ b/include/boost/fusion/sequence/conversion/detail/as_map.hpp @@ -0,0 +1,102 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_AS_MAP_0932005_1339) +#define FUSION_AS_MAP_0932005_1339 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct as_map; + + template <> + struct as_map<0> + { + template + struct apply + { + typedef map<> type; + }; + + template + static typename apply::type + call(Iterator) + { + return map<>(); + } + }; + +#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::next::type \ + BOOST_PP_CAT(I, BOOST_PP_INC(n)); + +#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \ + typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \ + BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n)); + +#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::value_of::type \ + BOOST_PP_CAT(T, n); + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_NEXT_ITERATOR +#undef BOOST_FUSION_NEXT_CALL_ITERATOR +#undef BOOST_FUSION_VALUE_OF_ITERATOR + +}}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template <> + struct as_map + { + template + struct apply + { + BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _) + BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _) + typedef map type; + }; + + template + static typename apply::type + call(Iterator const& i0) + { + typedef apply gen; + typedef typename gen::type result; + BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _) + return result(BOOST_PP_ENUM_PARAMS(N, *i)); + } + }; + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/conversion/detail/as_set.hpp b/include/boost/fusion/sequence/conversion/detail/as_set.hpp new file mode 100644 index 00000000..cfdf660f --- /dev/null +++ b/include/boost/fusion/sequence/conversion/detail/as_set.hpp @@ -0,0 +1,102 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_AS_SET_0932005_1341) +#define FUSION_AS_SET_0932005_1341 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct as_set; + + template <> + struct as_set<0> + { + template + struct apply + { + typedef set<> type; + }; + + template + static typename apply::type + call(Iterator) + { + return set<>(); + } + }; + +#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::next::type \ + BOOST_PP_CAT(I, BOOST_PP_INC(n)); + +#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \ + typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \ + BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n)); + +#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::value_of::type \ + BOOST_PP_CAT(T, n); + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_NEXT_ITERATOR +#undef BOOST_FUSION_NEXT_CALL_ITERATOR +#undef BOOST_FUSION_VALUE_OF_ITERATOR + +}}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template <> + struct as_set + { + template + struct apply + { + BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _) + BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _) + typedef set type; + }; + + template + static typename apply::type + call(Iterator const& i0) + { + typedef apply gen; + typedef typename gen::type result; + BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _) + return result(BOOST_PP_ENUM_PARAMS(N, *i)); + } + }; + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/conversion/detail/as_vector.hpp b/include/boost/fusion/sequence/conversion/detail/as_vector.hpp new file mode 100644 index 00000000..abbca70c --- /dev/null +++ b/include/boost/fusion/sequence/conversion/detail/as_vector.hpp @@ -0,0 +1,102 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_AS_VECTOR_09222005_0950) +#define FUSION_AS_VECTOR_09222005_0950 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct as_vector; + + template <> + struct as_vector<0> + { + template + struct apply + { + typedef vector<> type; + }; + + template + static typename apply::type + call(Iterator) + { + return vector<>(); + } + }; + +#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::next::type \ + BOOST_PP_CAT(I, BOOST_PP_INC(n)); + +#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \ + typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \ + BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n)); + +#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \ + typedef typename fusion::result_of::value_of::type \ + BOOST_PP_CAT(T, n); + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_NEXT_ITERATOR +#undef BOOST_FUSION_NEXT_CALL_ITERATOR +#undef BOOST_FUSION_VALUE_OF_ITERATOR + +}}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template <> + struct as_vector + { + template + struct apply + { + BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _) + BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _) + typedef vector type; + }; + + template + static typename apply::type + call(Iterator const& i0) + { + typedef apply gen; + typedef typename gen::type result; + BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _) + return result(BOOST_PP_ENUM_PARAMS(N, *i)); + } + }; + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/conversion/detail/build_cons.hpp b/include/boost/fusion/sequence/conversion/detail/build_cons.hpp new file mode 100644 index 00000000..0391979d --- /dev/null +++ b/include/boost/fusion/sequence/conversion/detail/build_cons.hpp @@ -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_BUILD_CONS_09232005_1222) +#define FUSION_BUILD_CONS_09232005_1222 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template < + typename First + , typename Last + , bool is_empty = result_of::equal_to::value> + struct build_cons; + + template + struct build_cons + { + typedef nil type; + + static nil + call(First const&, Last const&) + { + return nil(); + } + }; + + template + struct build_cons + { + typedef + build_cons::type, Last> + next_build_cons; + + typedef cons< + typename result_of::value_of::type + , typename next_build_cons::type> + type; + + static type + call(First const& f, Last const& l) + { + return type(*f, next_build_cons::call(fusion::next(f), l)); + } + }; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/generation.hpp b/include/boost/fusion/sequence/generation.hpp new file mode 100644 index 00000000..b06b7574 --- /dev/null +++ b/include/boost/fusion/sequence/generation.hpp @@ -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_GENERATION_10022005_0615) +#define FUSION_SEQUENCE_GENERATION_10022005_0615 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/generation/cons_tie.hpp b/include/boost/fusion/sequence/generation/cons_tie.hpp new file mode 100644 index 00000000..668059ee --- /dev/null +++ b/include/boost/fusion/sequence/generation/cons_tie.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2005 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_CONS_TIE_07182005_0854) +#define FUSION_CONS_TIE_07182005_0854 + +#include + +namespace boost { namespace fusion +{ + struct nil; + + namespace result_of + { + template + struct cons_tie + { + typedef cons type; + }; + } + + // $$$ do we really want a cons_tie? $$$ + template + inline cons + cons_tie(Car& car) + { + return cons(car); + } + + // $$$ do we really want a cons_tie? $$$ + template + inline cons + cons_tie(Car& car, Cdr const& cdr) + { + return cons(car, cdr); + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/generation/ignore.hpp b/include/boost/fusion/sequence/generation/ignore.hpp new file mode 100644 index 00000000..0ea553e1 --- /dev/null +++ b/include/boost/fusion/sequence/generation/ignore.hpp @@ -0,0 +1,33 @@ +/*============================================================================= + Copyright (c) 2001 Doug Gregor + Copyright (c) 1999-2003 Jaakko Järvi + 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_IGNORE_07192005_0329) +#define FUSION_IGNORE_07192005_0329 + +namespace boost { namespace fusion +{ + // Swallows any assignment (by Doug Gregor) + namespace detail + { + struct swallow_assign + { + template + swallow_assign const& + operator=(const T&) const + { + return *this; + } + }; + } + + // "ignore" allows tuple positions to be ignored when using "tie". + detail::swallow_assign const ignore = detail::swallow_assign(); +}} + +#endif diff --git a/include/boost/fusion/sequence/generation/list_tie.hpp b/include/boost/fusion/sequence/generation/list_tie.hpp new file mode 100644 index 00000000..ef09e131 --- /dev/null +++ b/include/boost/fusion/sequence/generation/list_tie.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_LIST_TIE_07192005_0109) +#define FUSION_LIST_TIE_07192005_0109 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_LIST_SIZE, typename T, void_) + , typename Extra = void_ + > + struct list_tie; + } + +// $$$ shouldn't we remove_reference first to allow references? $$$ +#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_REF + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template + struct list_tie + { + typedef list type; + }; + } + + template + inline list + list_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) + { + return list( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/make_cons.hpp b/include/boost/fusion/sequence/generation/make_cons.hpp new file mode 100644 index 00000000..779af7b8 --- /dev/null +++ b/include/boost/fusion/sequence/generation/make_cons.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Copyright (c) 2005 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_MAKE_CONS_07172005_0918) +#define FUSION_MAKE_CONS_07172005_0918 + +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + namespace result_of + { + template + struct make_cons + { + typedef cons::type, Cdr> type; + }; + } + + template + inline cons::type> + make_cons(Car const& car) + { + return cons::type>(car); + } + + template + inline cons::type, Cdr> + make_cons(Car const& car, Cdr const& cdr) + { + return cons::type, Cdr>(car, cdr); + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/generation/make_list.hpp b/include/boost/fusion/sequence/generation/make_list.hpp new file mode 100644 index 00000000..0ec08442 --- /dev/null +++ b/include/boost/fusion/sequence/generation/make_list.hpp @@ -0,0 +1,85 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_LIST_07192005_1239) +#define FUSION_MAKE_LIST_07192005_1239 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_LIST_SIZE, typename T, void_) + , typename Extra = void_ + > + struct make_list; + + template <> + struct make_list<> + { + typedef list<> type; + }; + } + + inline list<> + make_list() + { + return list<>(); + } + +#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ + typename detail::as_fusion_element::type + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_AS_FUSION_ELEMENT + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template + struct make_list + { + typedef list type; + }; + } + + template + inline list + make_list(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + { + return list( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/make_map.hpp b/include/boost/fusion/sequence/generation/make_map.hpp new file mode 100644 index 00000000..c97ec700 --- /dev/null +++ b/include/boost/fusion/sequence/generation/make_map.hpp @@ -0,0 +1,100 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_MAP_07222005_1247) +#define FUSION_MAKE_MAP_07222005_1247 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename K, void_) + , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename D, void_) + , typename Extra = void_ + > + struct make_map; + + template <> + struct make_map<> + { + typedef map<> type; + }; + } + + inline map<> + make_map() + { + return map<>(); + } + +#define BOOST_FUSION_PAIR(z, n, data) \ + fusion::pair< \ + BOOST_PP_CAT(K, n) \ + , typename detail::as_fusion_element::type> + +#define BOOST_FUSION_MAKE_PAIR(z, n, data) \ + fusion::make_pair(BOOST_PP_CAT(_, n)) \ + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_PAIR +#undef BOOST_FUSION_MAKE_PAIR + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS(N, typename K) + , BOOST_PP_ENUM_PARAMS(N, typename D) + > + struct make_map + { + typedef map type; + }; + } + + template < + BOOST_PP_ENUM_PARAMS(N, typename K) + , BOOST_PP_ENUM_PARAMS(N, typename D) + > + inline map + make_map(BOOST_PP_ENUM_BINARY_PARAMS(N, D, const& _)) + { + return map( + BOOST_PP_ENUM(N, BOOST_FUSION_MAKE_PAIR, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/make_set.hpp b/include/boost/fusion/sequence/generation/make_set.hpp new file mode 100644 index 00000000..d9924818 --- /dev/null +++ b/include/boost/fusion/sequence/generation/make_set.hpp @@ -0,0 +1,87 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_SET_09162005_1125) +#define FUSION_MAKE_SET_09162005_1125 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename T, void_) + , typename Extra = void_ + > + struct make_set; + + template <> + struct make_set<> + { + typedef set<> type; + }; + } + + inline set<> + make_set() + { + return set<>(); + } + +#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ + typename detail::as_fusion_element::type + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_ELEMENT +#undef BOOST_FUSION_AS_ELEMENT + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template + struct make_set + { + typedef set type; + }; + } + + template + inline set + make_set(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + { + return set( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/make_vector.hpp b/include/boost/fusion/sequence/generation/make_vector.hpp new file mode 100644 index 00000000..ff5a0611 --- /dev/null +++ b/include/boost/fusion/sequence/generation/make_vector.hpp @@ -0,0 +1,85 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_VECTOR_07162005_0243) +#define FUSION_MAKE_VECTOR_07162005_0243 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename T, void_) + , typename Extra = void_ + > + struct make_vector; + + template <> + struct make_vector<> + { + typedef vector<> type; + }; + } + + inline vector<> + make_vector() + { + return vector<>(); + } + +#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ + typename detail::as_fusion_element::type + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_AS_FUSION_ELEMENT + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template + struct make_vector + { + typedef vector type; + }; + } + + template + inline vector + make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + { + return vector( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/map_tie.hpp b/include/boost/fusion/sequence/generation/map_tie.hpp new file mode 100644 index 00000000..8275e06c --- /dev/null +++ b/include/boost/fusion/sequence/generation/map_tie.hpp @@ -0,0 +1,102 @@ +/*============================================================================= + 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_MAP_TIE_20060814_1116) +#define FUSION_MAP_TIE_20060814_1116 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename K, void_) + , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename D, void_) + , typename Extra = void_ + > + struct map_tie; + + template <> + struct map_tie<> + { + typedef map<> type; + }; + } + + inline map<> + map_tie() + { + return map<>(); + } + +#define BOOST_FUSION_TIED_PAIR(z, n, data) \ + fusion::pair< \ + BOOST_PP_CAT(K, n) \ + , typename add_reference::type> + +#define BOOST_FUSION_PAIR_TIE(z, n, data) \ + fusion::pair_tie(BOOST_PP_CAT(_, n)) \ + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_PAIR +#undef BOOST_FUSION_MAKE_PAIR + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS(N, typename K) + , BOOST_PP_ENUM_PARAMS(N, typename D) + > + struct map_tie + { + typedef map type; + }; + } + + template < + BOOST_PP_ENUM_PARAMS(N, typename K) + , BOOST_PP_ENUM_PARAMS(N, typename D) + > + inline map + map_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, D, & _)) + { + return map( + BOOST_PP_ENUM(N, BOOST_FUSION_PAIR_TIE, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/generation/pair_tie.hpp b/include/boost/fusion/sequence/generation/pair_tie.hpp new file mode 100644 index 00000000..ebadfdf8 --- /dev/null +++ b/include/boost/fusion/sequence/generation/pair_tie.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + 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 (BOOST_FUSION_PAIR_TIE_20060812_2058) +#define BOOST_FUSION_PAIR_TIE_20060812_2058 + +#include +#include + +namespace boost { namespace fusion { + + template + struct pair; + + namespace result_of + { + template + struct pair_tie + { + typedef fusion::pair type; + }; + } + + template + typename disable_if, typename result_of::pair_tie::type>::type + pair_tie(T& t) + { + return typename result_of::pair_tie::type(t); + } + + template + typename result_of::pair_tie::type + pair_tie(T const& t) + { + return typename result_of::pair_tie::type(t); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/generation/vector_tie.hpp b/include/boost/fusion/sequence/generation/vector_tie.hpp new file mode 100644 index 00000000..c16dc5ef --- /dev/null +++ b/include/boost/fusion/sequence/generation/vector_tie.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_VECTOR_TIE_07192005_1242) +#define FUSION_VECTOR_TIE_07192005_1242 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + namespace result_of + { + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename T, void_) + , typename Extra = void_ + > + struct vector_tie; + } + +#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_REF + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + namespace result_of + { + template + struct vector_tie + { + typedef vector type; + }; + } + + template + inline vector + vector_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) + { + return vector( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/sequence/intrinsic.hpp b/include/boost/fusion/sequence/intrinsic.hpp new file mode 100644 index 00000000..60bc6e81 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic.hpp @@ -0,0 +1,24 @@ +/*============================================================================= + 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_INTRINSIC_10022005_0618) +#define FUSION_SEQUENCE_INTRINSIC_10022005_0618 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/at.hpp b/include/boost/fusion/sequence/intrinsic/at.hpp new file mode 100644 index 00000000..62f9f9d4 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/at.hpp @@ -0,0 +1,81 @@ +/*============================================================================= + 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_AT_05042005_0722) +#define FUSION_AT_05042005_0722 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct at_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct at + : extension::at_impl::type>:: + template apply + {}; + + template + struct at_c + : at > + {}; + } + + + template + inline typename + lazy_disable_if< + is_const + , result_of::at + >::type + at(Sequence& seq) + { + return result_of::at::call(seq); + } + + template + inline typename result_of::at::type + at(Sequence const& seq) + { + return result_of::at::call(seq); + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::at_c + >::type + at_c(Sequence& seq) + { + return at >(seq); + } + + template + inline typename result_of::at_c::type + at_c(Sequence const& seq) + { + return at >(seq); + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/at_key.hpp b/include/boost/fusion/sequence/intrinsic/at_key.hpp new file mode 100644 index 00000000..1612c47b --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/at_key.hpp @@ -0,0 +1,56 @@ +/*============================================================================= + 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(BOOST_FUSION_AT_KEY_20060304_1755) +#define BOOST_FUSION_AT_KEY_20060304_1755 + +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct at_key_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct at_key + : extension::at_key_impl::type>:: + template apply + {}; + } + + template + inline typename + lazy_disable_if< + is_const + , result_of::at_key + >::type + at_key(Sequence& seq) + { + return result_of::at_key::call(seq); + } + + template + inline typename result_of::at_key::type + at_key(Sequence const& seq) + { + return result_of::at_key::call(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/back.hpp b/include/boost/fusion/sequence/intrinsic/back.hpp new file mode 100644 index 00000000..e2760bc0 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/back.hpp @@ -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_BACK_09162005_0350) +#define FUSION_BACK_09162005_0350 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace result_of + { + template + struct back + : result_of::deref::type>::type> + {}; + } + + template + inline typename result_of::back::type + back(Sequence& seq) + { + return *fusion::prior(fusion::end(seq)); + } + + template + inline typename result_of::back::type + back(Sequence const& seq) + { + return *fusion::prior(fusion::end(seq)); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/begin.hpp b/include/boost/fusion/sequence/intrinsic/begin.hpp new file mode 100644 index 00000000..b5e94849 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/begin.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_BEGIN_04052005_1132) +#define FUSION_BEGIN_04052005_1132 + +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace extension + { + template + struct begin_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct begin + : extension::begin_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::begin::type + begin(Sequence& seq) + { + return result_of::begin::call(seq); + } + + template + inline typename result_of::begin::type + begin(Sequence const& seq) + { + return result_of::begin::call(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/empty.hpp b/include/boost/fusion/sequence/intrinsic/empty.hpp new file mode 100644 index 00000000..0ce0636d --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/empty.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_EMPTY_09162005_0335) +#define FUSION_EMPTY_09162005_0335 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace extension + { + template + struct empty_impl + { + template + struct apply + : mpl::bool_<(result_of::size::value == 0)> + {}; + }; + } + + namespace result_of + { + template + struct empty + : extension::empty_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::empty::type + empty(Sequence const&) + { + static typename result_of::empty::type result; + return result; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/end.hpp b/include/boost/fusion/sequence/intrinsic/end.hpp new file mode 100644 index 00000000..b8ba514c --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/end.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_END_04052005_1141) +#define FUSION_END_04052005_1141 + +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace extension + { + template + struct end_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct end + : extension::end_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::end::type + end(Sequence& seq) + { + return result_of::end::call(seq); + } + + template + inline typename result_of::end::type + end(Sequence const& seq) + { + return result_of::end::call(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/front.hpp b/include/boost/fusion/sequence/intrinsic/front.hpp new file mode 100644 index 00000000..9ec99599 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/front.hpp @@ -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_FRONT_09162005_0343) +#define FUSION_FRONT_09162005_0343 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace result_of + { + template + struct front + : result_of::deref::type> + {}; + } + + template + inline typename result_of::front::type + front(Sequence& seq) + { + return *fusion::begin(seq); + } + + template + inline typename result_of::front::type + front(Sequence const& seq) + { + return *fusion::begin(seq); + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/has_key.hpp b/include/boost/fusion/sequence/intrinsic/has_key.hpp new file mode 100644 index 00000000..a8b07e20 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/has_key.hpp @@ -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_HAS_KEY_09232005_1454) +#define FUSION_HAS_KEY_09232005_1454 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct fusion_sequence_tag; + + namespace extension + { + template + struct has_key_impl + { + template + struct apply + : mpl::not_::type, void_> > + {}; + }; + } + + namespace result_of + { + template + struct has_key + : extension::has_key_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::has_key::type + has_key(Sequence const& seq) + { + static typename result_of::has_key::type result; + return result; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl.hpp b/include/boost/fusion/sequence/intrinsic/mpl.hpp new file mode 100644 index 00000000..30bd2473 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl.hpp @@ -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_SEQUENCE_INTRINSIC_MPL_10022005_1641) +#define FUSION_SEQUENCE_INTRINSIC_MPL_10022005_1641 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/at.hpp b/include/boost/fusion/sequence/intrinsic/mpl/at.hpp new file mode 100644 index 00000000..b4146c4b --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/at.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + 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_AT_10022005_1616) +#define FUSION_AT_10022005_1616 + +#include +#include + +namespace boost { +namespace fusion +{ + struct fusion_sequence_tag; +} + +namespace mpl +{ + template + struct at_impl; + + template <> + struct at_impl + { + template + struct apply : fusion::result_of::value_at {}; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/back.hpp b/include/boost/fusion/sequence/intrinsic/mpl/back.hpp new file mode 100644 index 00000000..ae06a7ce --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/back.hpp @@ -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_BACK_10022005_1620) +#define FUSION_BACK_10022005_1620 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct back_impl; + + template <> + struct back_impl + { + template + struct apply : + fusion::result_of::value_of< + typename fusion::result_of::prior< + typename fusion::result_of::end::type + >::type> {}; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/begin.hpp b/include/boost/fusion/sequence/intrinsic/mpl/begin.hpp new file mode 100644 index 00000000..e5a1aba6 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/begin.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + 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_BEGIN_10022005_1620) +#define FUSION_BEGIN_10022005_1620 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef fusion_iterator::type> type; + }; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/clear.hpp b/include/boost/fusion/sequence/intrinsic/mpl/clear.hpp new file mode 100644 index 00000000..68b86bb8 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/clear.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + 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_10022005_1817) +#define FUSION_CLEAR_10022005_1817 + +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct clear_impl; + + template <> + struct clear_impl + { + template + struct apply + { + typedef typename + fusion::detail::clear::type>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/detail/as.hpp b/include/boost/fusion/sequence/intrinsic/mpl/detail/as.hpp new file mode 100644 index 00000000..9659f325 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/detail/as.hpp @@ -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_AS_10022005_1442) +#define FUSION_AS_10022005_1442 + +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct as_impl; + + template <> + struct as_impl + { + template + struct apply : result_of::as_list {}; + }; + + template <> + struct as_impl + { + template + struct apply : result_of::as_map {}; + }; + + template <> + struct as_impl + { + template + struct apply : result_of::as_set {}; + }; + + template <> + struct as_impl + { + template + struct apply : result_of::as_vector {}; + }; + + template + struct as + { + typedef typename + as_impl::template apply::type + type; + }; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/detail/clear.hpp b/include/boost/fusion/sequence/intrinsic/mpl/detail/clear.hpp new file mode 100644 index 00000000..03cacb6a --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/detail/clear.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + 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_10022005_1442) +#define FUSION_CLEAR_10022005_1442 + +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct clear; + + template <> + struct clear : mpl::identity > {}; + + template <> + struct clear : mpl::identity > {}; + + template <> + struct clear : mpl::identity > {}; + + template <> + struct clear : mpl::identity > {}; + +}}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/empty.hpp b/include/boost/fusion/sequence/intrinsic/mpl/empty.hpp new file mode 100644 index 00000000..8f00c24e --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/empty.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + 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_EMPTY_10022005_1619) +#define FUSION_EMPTY_10022005_1619 + +#include +#include + +namespace boost { namespace mpl +{ + template + struct empty_impl; + + template <> + struct empty_impl + { + template + struct apply : fusion::result_of::empty {}; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/end.hpp b/include/boost/fusion/sequence/intrinsic/mpl/end.hpp new file mode 100644 index 00000000..979f659a --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/end.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + 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_END_10022005_1619) +#define FUSION_END_10022005_1619 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef fusion_iterator::type> type; + }; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/erase.hpp b/include/boost/fusion/sequence/intrinsic/mpl/erase.hpp new file mode 100644 index 00000000..f10ab843 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/erase.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1835) +#define FUSION_ERASE_10022005_1835 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct erase_impl; + + template <> + struct erase_impl + { + template + struct apply + { + typedef typename + fusion::result_of::erase::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/erase_key.hpp b/include/boost/fusion/sequence/intrinsic/mpl/erase_key.hpp new file mode 100644 index 00000000..a47d0916 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/erase_key.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_1907) +#define FUSION_ERASE_KEY_10022005_1907 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct erase_key_impl; + + template <> + struct erase_key_impl + { + template + struct apply + { + typedef typename + fusion::result_of::erase_key::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/front.hpp b/include/boost/fusion/sequence/intrinsic/mpl/front.hpp new file mode 100644 index 00000000..e503cadb --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/front.hpp @@ -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_FRONT_10022005_1618) +#define FUSION_FRONT_10022005_1618 + +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct front_impl; + + template <> + struct front_impl + { + template + struct apply : + fusion::result_of::value_of::type> {}; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/mpl/has_key.hpp b/include/boost/fusion/sequence/intrinsic/mpl/has_key.hpp new file mode 100644 index 00000000..593f5492 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/has_key.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + 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_HAS_KEY_10022005_1617) +#define FUSION_HAS_KEY_10022005_1617 + +#include +#include + +namespace boost { namespace mpl +{ + template + struct has_key_impl; + + template <> + struct has_key_impl + { + template + struct apply : fusion::result_of::has_key {}; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/insert.hpp b/include/boost/fusion/sequence/intrinsic/mpl/insert.hpp new file mode 100644 index 00000000..677c00c6 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/insert.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1837) +#define FUSION_INSERT_10022005_1837 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct insert_impl; + + template <> + struct insert_impl + { + template + struct apply + { + typedef typename + fusion::result_of::insert::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/insert_range.hpp b/include/boost/fusion/sequence/intrinsic/mpl/insert_range.hpp new file mode 100644 index 00000000..ad85d8d9 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/insert_range.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1838) +#define FUSION_INSERT_RANGE_10022005_1838 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct insert_range_impl; + + template <> + struct insert_range_impl + { + template + struct apply + { + typedef typename + fusion::result_of::insert_range::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/pop_back.hpp b/include/boost/fusion/sequence/intrinsic/mpl/pop_back.hpp new file mode 100644 index 00000000..c3f22cd8 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/pop_back.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1801) +#define FUSION_POP_BACK_10022005_1801 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct pop_back_impl; + + template <> + struct pop_back_impl + { + template + struct apply + { + typedef typename + fusion::result_of::pop_back::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/pop_front.hpp b/include/boost/fusion/sequence/intrinsic/mpl/pop_front.hpp new file mode 100644 index 00000000..1f4f6739 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/pop_front.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1800) +#define FUSION_POP_FRONT_10022005_1800 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct pop_front_impl; + + template <> + struct pop_front_impl + { + template + struct apply + { + typedef typename + fusion::result_of::pop_front::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/push_back.hpp b/include/boost/fusion/sequence/intrinsic/mpl/push_back.hpp new file mode 100644 index 00000000..6d635691 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/push_back.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1647) +#define FUSION_PUSH_BACK_10022005_1647 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct push_back_impl; + + template <> + struct push_back_impl + { + template + struct apply + { + typedef typename + fusion::result_of::push_back::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/push_front.hpp b/include/boost/fusion/sequence/intrinsic/mpl/push_front.hpp new file mode 100644 index 00000000..fb435502 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/push_front.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_10022005_1720) +#define FUSION_PUSH_FRONT_10022005_1720 + +#include +#include +#include +#include + +namespace boost { namespace mpl +{ + template + struct push_front_impl; + + template <> + struct push_front_impl + { + template + struct apply + { + typedef typename + fusion::result_of::push_front::type + result; + + typedef typename + fusion::detail::as::type, result>::type + type; + }; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/mpl/size.hpp b/include/boost/fusion/sequence/intrinsic/mpl/size.hpp new file mode 100644 index 00000000..0147a65d --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/mpl/size.hpp @@ -0,0 +1,27 @@ +/*============================================================================= + 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_SIZE_10022005_1617) +#define FUSION_SIZE_10022005_1617 + +#include +#include + +namespace boost { namespace mpl +{ + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : fusion::result_of::size {}; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/size.hpp b/include/boost/fusion/sequence/intrinsic/size.hpp new file mode 100644 index 00000000..1ff9360b --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/size.hpp @@ -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_SIZE_05052005_0214) +#define FUSION_SIZE_05052005_0214 + +#include +#include + +namespace boost { namespace fusion +{ + struct fusion_sequence_tag; + + namespace extension + { + template + struct size_impl + { + template + struct apply : Sequence::size {}; + }; + } + + namespace result_of + { + template + struct size + : extension::size_impl::type>:: + template apply + {}; + } + + template + inline typename result_of::size::type + size(Sequence const&) + { + static typename result_of::size::type result; + return result; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/intrinsic/value_at.hpp b/include/boost/fusion/sequence/intrinsic/value_at.hpp new file mode 100644 index 00000000..de518391 --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/value_at.hpp @@ -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_VALUE_AT_05052005_0229) +#define FUSION_VALUE_AT_05052005_0229 + +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct value_at_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct value_at + : extension::value_at_impl::type>:: + template apply + {}; + + template + struct value_at_c + : fusion::result_of::value_at > + {}; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/intrinsic/value_at_key.hpp b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp new file mode 100644 index 00000000..a6c8aeec --- /dev/null +++ b/include/boost/fusion/sequence/intrinsic/value_at_key.hpp @@ -0,0 +1,38 @@ +/*============================================================================= + 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_VALUE_AT_KEY_05052005_0229) +#define FUSION_VALUE_AT_KEY_05052005_0229 + +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct value_at_key_impl + { + template + struct apply; + }; + } + + namespace result_of + { + template + struct value_at_key + : extension::value_at_key_impl::type>:: + template apply + {}; + } +}} + +#endif + diff --git a/include/boost/fusion/sequence/io.hpp b/include/boost/fusion/sequence/io.hpp new file mode 100644 index 00000000..5547f15c --- /dev/null +++ b/include/boost/fusion/sequence/io.hpp @@ -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_SEQUENCE_IO_10032005_0836) +#define FUSION_SEQUENCE_IO_10032005_0836 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/io/detail/in.hpp b/include/boost/fusion/sequence/io/detail/in.hpp new file mode 100644 index 00000000..7054bfe3 --- /dev/null +++ b/include/boost/fusion/sequence/io/detail/in.hpp @@ -0,0 +1,86 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + Copyright (c) 1999-2003 Jeremiah Willcock + 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_IN_05052005_0121) +#define FUSION_IN_05052005_0121 + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct delimiter_in + { + // read a delimiter + template + static void + read(IS& is, char const* delim, mpl::false_ = mpl::false_()) + { + detail::string_ios_manip manip(is); + manip.read(delim); + } + + template + static void + read(IS& is, char const* delim, mpl::true_) + { + } + }; + + struct read_sequence_loop + { + template + static void + call(IS& is, First const&, Last const&, mpl::true_) + { + } + + template + static void + call(IS& is, First const& first, Last const& last, mpl::false_) + { + result_of::equal_to< + typename result_of::next::type + , Last + > + is_last; + + is >> *first; + delimiter_in::read(is, " ", is_last); + call(is, fusion::next(first), last, is_last); + } + + template + static void + call(IS& is, First const& first, Last const& last) + { + result_of::equal_to eq; + call(is, first, last, eq); + } + }; + + template + inline void + read_sequence(IS& is, Sequence& seq) + { + delimiter_in::read(is, "("); + read_sequence_loop::call(is, fusion::begin(seq), fusion::end(seq)); + delimiter_in::read(is, ")"); + } +}}} + +#endif diff --git a/include/boost/fusion/sequence/io/detail/manip.hpp b/include/boost/fusion/sequence/io/detail/manip.hpp new file mode 100644 index 00000000..c5776199 --- /dev/null +++ b/include/boost/fusion/sequence/io/detail/manip.hpp @@ -0,0 +1,318 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jeremiah Willcock + Copyright (c) 1999-2003 Jaakko Järvi + 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_MANIP_05052005_1200) +#define FUSION_MANIP_05052005_1200 + +#include +#include +#include +#include +#include + +// Tuple I/O manipulators + +#define FUSION_GET_CHAR_TYPE(T) typename T::char_type +#define FUSION_GET_TRAITS_TYPE(T) typename T::traits_type + +#if defined (BOOST_NO_TEMPLATED_STREAMS) +#define FUSION_STRING_OF_STREAM(Stream) std::string +#else +#define FUSION_STRING_OF_STREAM(Stream) \ + std::basic_string< \ + FUSION_GET_CHAR_TYPE(Stream) \ + , FUSION_GET_TRAITS_TYPE(Stream) \ + > +#endif + +//$$$ these should be part of the public API$$$ +//$$$ rename tuple_open, tuple_close and tuple_delimiter to +// open, close and delimeter and add these synonyms to the +// TR1 tuple module. + +namespace boost { namespace fusion +{ + namespace detail + { + template + int get_xalloc_index(Tag* = 0) + { + // each Tag will have a unique index + static int index = std::ios::xalloc(); + return index; + } + + template + struct stream_data + { + struct arena + { + ~arena() + { + for ( + typename std::vector::iterator i = data.begin() + ; i != data.end() + ; ++i) + { + delete *i; + } + } + + std::vector data; + }; + + static void attach(Stream& stream, T const& data) + { + static arena ar; // our arena + ar.data.push_back(new T(data)); + stream.pword(get_xalloc_index()) = ar.data.back(); + } + + static T const* get(Stream& stream) + { + return (T const*)stream.pword(get_xalloc_index()); + } + }; + + template + class string_ios_manip + { + public: + + typedef FUSION_STRING_OF_STREAM(Stream) string_type; + + typedef stream_data stream_data_t; + + string_ios_manip(Stream& str_) + : stream(str_) + {} + + void + set(string_type const& s) + { + stream_data_t::attach(stream, s); + } + + void + print(char const* default_) const + { + // print a delimiter + string_type const* p = stream_data_t::get(stream); + if (p) + stream << *p; + else + stream << default_; + } + + void + read(char const* default_) const + { + // read a delimiter + string_type const* p = stream_data_t::get(stream); + using namespace std; + ws(stream); + + if (p) + { + typedef typename string_type::const_iterator iterator; + for (iterator i = p->begin(); i != p->end(); ++i) + check_delim(*i); + } + else + { + while (*default_) + check_delim(*default_++); + } + } + + private: + + template + void + check_delim(Char c) const + { + if (!isspace(c)) + { + if (stream.get() != c) + { + stream.unget(); + stream.setstate(std::ios::failbit); + } + } + } + + Stream& stream; + }; + + } // detail + +#if defined (BOOST_NO_TEMPLATED_STREAMS) + +#define STD_TUPLE_DEFINE_MANIPULATOR(name) \ + namespace detail \ + { \ + struct name##_tag; \ + \ + struct name##_type \ + { \ + typedef std::string string_type; \ + string_type data; \ + name##_type(const string_type& d): data(d) {} \ + }; \ + \ + template \ + Stream& operator>>(Stream& s, const name##_type& m) \ + { \ + string_ios_manip(s).set(m.data); \ + return s; \ + } \ + \ + template \ + Stream& operator<<(Stream& s, const name##_type& m) \ + { \ + string_ios_manip(s).set(m.data); \ + return s; \ + } \ + } + +#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ + inline detail::name##_type \ + name(const std::string& s) \ + { \ + return detail::name##_type(s); \ + } \ + \ + inline detail::name##_type \ + name(const char* s) \ + { \ + return detail::name##_type(std::string(s)); \ + } \ + \ + inline detail::name##_type \ + name(char c) \ + { \ + return detail::name##_type(std::string(1, c)); \ + } + +#else // defined(BOOST_NO_TEMPLATED_STREAMS) + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ + template \ + inline detail::name##_type \ + name(const std::basic_string& s) \ + { \ + return detail::name##_type(s); \ + } \ + \ + inline detail::name##_type \ + name(char const* s) \ + { \ + return detail::name##_type(std::basic_string(s)); \ + } \ + \ + inline detail::name##_type \ + name(wchar_t const* s) \ + { \ + return detail::name##_type(std::basic_string(s)); \ + } \ + \ + inline detail::name##_type \ + name(char c) \ + { \ + return detail::name##_type(std::basic_string(1, c)); \ + } \ + \ + inline detail::name##_type \ + name(wchar_t c) \ + { \ + return detail::name##_type(std::basic_string(1, c)); \ + } + +#else // defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ + template \ + inline detail::name##_type \ + name(const std::basic_string& s) \ + { \ + return detail::name##_type(s); \ + } \ + \ + template \ + inline detail::name##_type \ + name(Char s[]) \ + { \ + return detail::name##_type(std::basic_string(s)); \ + } \ + \ + template \ + inline detail::name##_type \ + name(Char const s[]) \ + { \ + return detail::name##_type(std::basic_string(s)); \ + } \ + \ + template \ + inline detail::name##_type \ + name(Char c) \ + { \ + return detail::name##_type(std::basic_string(1, c)); \ + } + +#endif + +#define STD_TUPLE_DEFINE_MANIPULATOR(name) \ + namespace detail \ + { \ + struct name##_tag; \ + \ + template > \ + struct name##_type \ + { \ + typedef std::basic_string string_type; \ + string_type data; \ + name##_type(const string_type& d): data(d) {} \ + }; \ + \ + template \ + Stream& operator>>(Stream& s, const name##_type& m) \ + { \ + string_ios_manip(s).set(m.data); \ + return s; \ + } \ + \ + template \ + Stream& operator<<(Stream& s, const name##_type& m) \ + { \ + string_ios_manip(s).set(m.data); \ + return s; \ + } \ + } \ + +#endif // defined(BOOST_NO_TEMPLATED_STREAMS) + + STD_TUPLE_DEFINE_MANIPULATOR(tuple_open) + STD_TUPLE_DEFINE_MANIPULATOR(tuple_close) + STD_TUPLE_DEFINE_MANIPULATOR(tuple_delimiter) + + STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_open) + STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_close) + STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_delimiter) + +#undef STD_TUPLE_DEFINE_MANIPULATOR +#undef STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS +#undef FUSION_STRING_OF_STREAM +#undef FUSION_GET_CHAR_TYPE +#undef FUSION_GET_TRAITS_TYPE + +}} + +#endif diff --git a/include/boost/fusion/sequence/io/detail/out.hpp b/include/boost/fusion/sequence/io/detail/out.hpp new file mode 100644 index 00000000..e00ed17b --- /dev/null +++ b/include/boost/fusion/sequence/io/detail/out.hpp @@ -0,0 +1,86 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + Copyright (c) 1999-2003 Jeremiah Willcock + 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_OUT_05052005_0121) +#define FUSION_OUT_05052005_0121 + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct delimiter_out + { + // print a delimiter + template + static void + print(OS& os, char const* delim, mpl::false_ = mpl::false_()) + { + detail::string_ios_manip manip(os); + manip.print(delim); + } + + template + static void + print(OS& os, char const* delim, mpl::true_) + { + } + }; + + struct print_sequence_loop + { + template + static void + call(OS& os, First const&, Last const&, mpl::true_) + { + } + + template + static void + call(OS& os, First const& first, Last const& last, mpl::false_) + { + result_of::equal_to< + typename result_of::next::type + , Last + > + is_last; + + os << *first; + delimiter_out::print(os, " ", is_last); + call(os, fusion::next(first), last, is_last); + } + + template + static void + call(OS& os, First const& first, Last const& last) + { + result_of::equal_to eq; + call(os, first, last, eq); + } + }; + + template + inline void + print_sequence(OS& os, Sequence const& seq) + { + delimiter_out::print(os, "("); + print_sequence_loop::call(os, fusion::begin(seq), fusion::end(seq)); + delimiter_out::print(os, ")"); + } +}}} + +#endif diff --git a/include/boost/fusion/sequence/io/in.hpp b/include/boost/fusion/sequence/io/in.hpp new file mode 100644 index 00000000..2766daee --- /dev/null +++ b/include/boost/fusion/sequence/io/in.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + Copyright (c) 1999-2003 Jeremiah Willcock + 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(BOOST_IN_05042005_0120) +#define BOOST_IN_05042005_0120 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + fusion::traits::is_sequence + , IStream& + >::type + operator>>(IStream& is, Sequence& seq) + { + detail::read_sequence(is, seq); + return is; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/io/out.hpp b/include/boost/fusion/sequence/io/out.hpp new file mode 100644 index 00000000..fd943547 --- /dev/null +++ b/include/boost/fusion/sequence/io/out.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + Copyright (c) 1999-2003 Jeremiah Willcock + 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(BOOST_OUT_05042005_0120) +#define BOOST_OUT_05042005_0120 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + inline typename + enable_if< + fusion::traits::is_sequence + , OStream& + >::type + operator<<(OStream& os, Sequence const& seq) + { + detail::print_sequence(os, seq); + return os; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/utility.hpp b/include/boost/fusion/sequence/utility.hpp new file mode 100644 index 00000000..35a17af9 --- /dev/null +++ b/include/boost/fusion/sequence/utility.hpp @@ -0,0 +1,14 @@ +// +// Copyright (c) 2006 João Abecasis +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if !defined(BOOST_FUSION_SEQUENCE_UTILITY_HPP_INCLUDED) +#define BOOST_FUSION_SEQUENCE_UTILITY_HPP_INCLUDED + +# include + +#endif // include guard diff --git a/include/boost/fusion/sequence/utility/limits.hpp b/include/boost/fusion/sequence/utility/limits.hpp new file mode 100644 index 00000000..7f3d0136 --- /dev/null +++ b/include/boost/fusion/sequence/utility/limits.hpp @@ -0,0 +1,16 @@ +// +// Copyright (c) 2006 João Abecasis +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if !defined(BOOST_FUSION_ALGORITHM_INVOCATION_LIMITS_HPP_INCLUDED) +#define BOOST_FUSION_ALGORITHM_INVOCATION_LIMITS_HPP_INCLUDED + +# if !defined(FUSION_MAX_UNPACK_ARG_SIZE) +# define FUSION_MAX_UNPACK_ARG_SIZE 10 +# endif + +#endif // include guard diff --git a/include/boost/fusion/sequence/utility/unpack_args.hpp b/include/boost/fusion/sequence/utility/unpack_args.hpp new file mode 100644 index 00000000..df3cb736 --- /dev/null +++ b/include/boost/fusion/sequence/utility/unpack_args.hpp @@ -0,0 +1,164 @@ +// +// Copyright (c) 2005, 2006 João Abecasis +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if !BOOST_PP_IS_ITERATING + +# if !defined(BOOST_FUSION_SEQUENCE_UTILITY_UNPACK_ARGS_HPP_INCLUDED) +# define BOOST_FUSION_SEQUENCE_UTILITY_UNPACK_ARGS_HPP_INCLUDED + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +namespace boost { namespace fusion +{ + + namespace detail + { + + template < + class F, + class Sequence, + class F_ = + typename boost::mpl::eval_if< + boost::is_pointer, + boost::remove_cv, + boost::mpl::eval_if< + boost::is_function::type>, + boost::add_pointer::type>, + boost::mpl::identity + > + >::type, + class Size = mpl::int_::value> + > + struct unpack_args_impl; + + template + struct unpack_args_impl > + { + typedef typename boost::result_of::type type; + + static type call(F & f, Sequence &) + { + return f(); + } + }; + +# define BOOST_FUSION_next_iterator(z, n, data) \ + typedef typename fusion::result_of::next::type \ + BOOST_PP_CAT(I, BOOST_PP_INC(n)); + +# define BOOST_FUSION_deref_iterator(z, n, data) \ + typedef typename fusion::result_of::deref::type BOOST_PP_CAT(T, BOOST_PP_INC(n)); + +# define BOOST_FUSION_next_call_iterator(z, n, data) \ + BOOST_PP_CAT(I, BOOST_PP_INC(n)) BOOST_PP_CAT(i, BOOST_PP_INC(n)) \ + = fusion::next(BOOST_PP_CAT(i, n)); + +# define BOOST_FUSION_n BOOST_PP_ITERATION() + +# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, FUSION_MAX_UNPACK_ARG_SIZE, \ + )) + +# include BOOST_PP_ITERATE() + +# undef BOOST_FUSION_next_iterator +# undef BOOST_FUSION_deref_iterator +# undef BOOST_FUSION_next_call_iterator +# undef BOOST_FUSION_n + +# undef BOOST_PP_ITERATION_PARAMS_1 + + } // namespace detail + + namespace result_of + { + + template + struct unpack_args + : detail::unpack_args_impl + { + }; + + } // namespace result_of + + template + inline typename result_of::unpack_args::type + unpack_args(F & f, Sequence & seq) + { + return result_of::unpack_args::call(f, seq); + } + + template + inline typename result_of::unpack_args::type + unpack_args(F const & f, Sequence & seq) + { + return result_of::unpack_args::call(f, seq); + } + + template + inline typename result_of::unpack_args::type + unpack_args(F & f, Sequence const & seq) + { + return result_of::unpack_args::call(f, seq); + } + + template + inline typename result_of::unpack_args::type + unpack_args(F const & f, Sequence const & seq) + { + return result_of::unpack_args::call(f, seq); + } + +}} // namespace boost::fusion + +# endif // include guard + +#else // BOOST_PP_IS_ITERATING + + template + struct unpack_args_impl > + { + typedef typename fusion::result_of::begin::type I0; + typedef typename fusion::result_of::deref::type T0; + + BOOST_PP_REPEAT(BOOST_FUSION_n, BOOST_FUSION_next_iterator, ~) + BOOST_PP_REPEAT(BOOST_FUSION_n, BOOST_FUSION_deref_iterator, ~) + + typedef typename boost::result_of< + F_( BOOST_PP_ENUM_PARAMS(BOOST_FUSION_n, T) ) + >::type type; + + static type call(F & f, Sequence & seq) + { + I0 i0 = fusion::begin(seq); + + BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_FUSION_n), BOOST_FUSION_next_call_iterator, ~) + + return f( BOOST_PP_ENUM_PARAMS(BOOST_FUSION_n, *i) ); + } + }; + +#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/fusion/sequence/view.hpp b/include/boost/fusion/sequence/view.hpp new file mode 100644 index 00000000..977c4529 --- /dev/null +++ b/include/boost/fusion/sequence/view.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + 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_VIEW_10022005_0620) +#define FUSION_SEQUENCE_VIEW_10022005_0620 + +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/filter_view.hpp b/include/boost/fusion/sequence/view/filter_view.hpp new file mode 100644 index 00000000..c5416662 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view.hpp @@ -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_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608) +#define FUSION_SEQUENCE_VIEW_FILTER_VIEW_10022005_0608 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/filter_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/begin_impl.hpp new file mode 100644 index 00000000..42999deb --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_05062005_0903) +#define FUSION_BEGIN_IMPL_05062005_0903 + +namespace boost { namespace fusion +{ + struct filter_view_tag; + + template + struct filter_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::first_type first_type; + typedef typename Sequence::last_type last_type; + typedef typename Sequence::pred_type pred_type; + typedef filter_iterator type; + + static type + call(Sequence& s) + { + return type(s.first()); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/deref_impl.hpp new file mode 100644 index 00000000..fd46bf86 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/deref_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + 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_05062005_0905) +#define FUSION_DEREF_IMPL_05062005_0905 + +#include + +namespace boost { namespace fusion +{ + struct filter_view_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + : detail::adapt_deref_traits {}; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/end_impl.hpp new file mode 100644 index 00000000..bdaed67d --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/end_impl.hpp @@ -0,0 +1,45 @@ +/*============================================================================= + 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_END_IMPL_05062005_0906) +#define FUSION_END_IMPL_05062005_0906 + +namespace boost { namespace fusion +{ + struct filter_view_tag; + + template + struct filter_iterator; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::last_type last_type; + typedef typename Sequence::pred_type pred_type; + typedef filter_iterator type; + + static type + call(Sequence& s) + { + return type(s.last()); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/equal_to_impl.hpp new file mode 100644 index 00000000..33e92555 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/equal_to_impl.hpp @@ -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(BOOST_FUSION_EQUAL_TO_IMPL_02012005_2133) +#define BOOST_FUSION_EQUAL_TO_IMPL_02012005_2133 + +namespace boost { namespace fusion +{ + struct filter_view_iterator_tag; + + namespace extension + { + template + struct equal_to; + + template + struct equal_to_impl; + + template<> + struct equal_to_impl + { + template + struct apply + : result_of::equal_to + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/filter_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/next_impl.hpp new file mode 100644 index 00000000..3b35f9c6 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/next_impl.hpp @@ -0,0 +1,65 @@ +/*============================================================================= + 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_06052005_0900) +#define FUSION_NEXT_IMPL_06052005_0900 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct filter_view_iterator_tag; + + template + struct filter_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename Iterator::last_type last_type; + typedef typename Iterator::pred_type pred_type; + + typedef typename + mpl::eval_if< + result_of::equal_to + , mpl::identity + , result_of::next + >::type + next_type; + + typedef typename detail::static_find_if< + next_type, last_type, pred_type> + filter; + + typedef filter_iterator< + typename filter::type, last_type, pred_type> + type; + + static type + call(Iterator const& i) + { + return type(filter::call(i.first)); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/detail/size_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/size_impl.hpp new file mode 100644 index 00000000..55b91d36 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/size_impl.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + 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_SIZE_IMPL_09232005_1058) +#define FUSION_SIZE_IMPL_09232005_1058 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct filter_view_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply + : result_of::distance< + typename result_of::begin::type + , typename result_of::end::type> + {}; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/filter_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..4114dd9f --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/detail/value_of_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + 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_IMPL_05062005_0857) +#define FUSION_VALUE_OF_IMPL_05062005_0857 + +#include + +namespace boost { namespace fusion +{ + struct filter_view_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + : detail::adapt_value_traits {}; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/filter_view.hpp b/include/boost/fusion/sequence/view/filter_view/filter_view.hpp new file mode 100644 index 00000000..f6346eb0 --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/filter_view.hpp @@ -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_SEQUENCE_FILTER_VIEW_HPP) +#define FUSION_SEQUENCE_FILTER_VIEW_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct filter_view_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + template + struct filter_view : sequence_base > + { + typedef filter_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef forward_sequence_tag category; + typedef mpl::true_ is_view; + + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + typedef Pred pred_type; + + filter_view(Sequence& seq) + : seq(seq) + {} + + first_type first() const { return fusion::begin(seq); } + last_type last() const { return fusion::end(seq); } + typename mpl::if_, Sequence, Sequence&>::type seq; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/filter_view/filter_view_iterator.hpp b/include/boost/fusion/sequence/view/filter_view/filter_view_iterator.hpp new file mode 100644 index 00000000..2e469d5c --- /dev/null +++ b/include/boost/fusion/sequence/view/filter_view/filter_view_iterator.hpp @@ -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_FILTER_VIEW_ITERATOR_05062005_0849) +#define FUSION_FILTER_VIEW_ITERATOR_05062005_0849 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct filter_view_iterator_tag; + struct forward_traversal_tag; + + template + struct filter_iterator : iterator_base > + { + typedef convert_iterator first_converter; + typedef typename first_converter::type first_iter; + typedef convert_iterator last_converter; + typedef typename last_converter::type last_iter; + + typedef filter_view_iterator_tag ftag; + typedef forward_traversal_tag category; + typedef detail::static_find_if filter; + typedef typename filter::type first_type; + typedef last_iter last_type; + typedef Pred pred_type; + + filter_iterator(First const& first) + : first(filter::call(first_converter::call(first))) {} + + first_type first; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/iterator_range.hpp b/include/boost/fusion/sequence/view/iterator_range.hpp new file mode 100644 index 00000000..15fab150 --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range.hpp @@ -0,0 +1,13 @@ +/*============================================================================= + 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_VIEW_ITERATOR_RANGE_10022005_0610) +#define FUSION_SEQUENCE_VIEW_ITERATOR_RANGE_10022005_0610 + +#include + +#endif diff --git a/include/boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp new file mode 100644 index 00000000..8cde61be --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_05062005_1226) +#define FUSION_BEGIN_IMPL_05062005_1226 + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::begin_type type; + + static type + call(Sequence& s) + { + return s.first; + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp b/include/boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp new file mode 100644 index 00000000..dfd1ee2e --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range/detail/end_impl.hpp @@ -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_END_IMPL_05062005_1226) +#define FUSION_END_IMPL_05062005_1226 + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::end_type type; + + static type + call(Sequence& s) + { + return s.last; + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp b/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp new file mode 100644 index 00000000..c86f47e3 --- /dev/null +++ b/include/boost/fusion/sequence/view/iterator_range/iterator_range.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + 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_RANGE_05062005_1224) +#define FUSION_ITERATOR_RANGE_05062005_1224 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct iterator_range_tag; + struct fusion_sequence_tag; + + template + struct iterator_range : sequence_base > + { + typedef typename convert_iterator::type begin_type; + typedef typename convert_iterator::type end_type; + typedef iterator_range_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef typename result_of::distance::type size; + typedef mpl::true_ is_view; + + typedef typename + detail::iterator_to_sequence_category< + typename traits::category_of::type + >::type + category; + + iterator_range(First const& first, Last const& last) + : first(convert_iterator::call(first)) + , last(convert_iterator::call(last)) {} + + begin_type first; + end_type last; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/joint_view.hpp b/include/boost/fusion/sequence/view/joint_view.hpp new file mode 100644 index 00000000..64c22604 --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view.hpp @@ -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_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610) +#define FUSION_SEQUENCE_VIEW_JOINT_VIEW_10022005_0610 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/joint_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/joint_view/detail/begin_impl.hpp new file mode 100644 index 00000000..83bc970e --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_07162005_0115) +#define FUSION_BEGIN_IMPL_07162005_0115 + +#include +#include + +namespace boost { namespace fusion +{ + struct joint_view_tag; + + template + struct joint_view_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::first_type first_type; + typedef typename Sequence::last_type last_type; + typedef typename Sequence::concat_type concat_type; + typedef result_of::equal_to equal_to; + + typedef typename + mpl::if_< + equal_to + , concat_type + , joint_view_iterator + >::type + type; + + static type + call(Sequence& s, mpl::true_) + { + return s.concat(); + } + + static type + call(Sequence& s, mpl::false_) + { + return type(s.first(), s.concat()); + } + + static type + call(Sequence& s) + { + return call(s, equal_to()); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/joint_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/joint_view/detail/deref_impl.hpp new file mode 100644 index 00000000..2e927b23 --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/detail/deref_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + 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_07162005_0137) +#define FUSION_DEREF_IMPL_07162005_0137 + +#include + +namespace boost { namespace fusion +{ + struct joint_view_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + : detail::adapt_deref_traits {}; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/joint_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/joint_view/detail/end_impl.hpp new file mode 100644 index 00000000..b39a56b2 --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/detail/end_impl.hpp @@ -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_END_IMPL_07162005_0128) +#define FUSION_END_IMPL_07162005_0128 + +#include +#include + +namespace boost { namespace fusion +{ + struct joint_view_tag; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::concat_last_type type; + + static type + call(Sequence& s) + { + return s.concat_last(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/joint_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/joint_view/detail/next_impl.hpp new file mode 100644 index 00000000..1f6d78f6 --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/detail/next_impl.hpp @@ -0,0 +1,71 @@ +/*============================================================================= + 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_07162005_0136) +#define FUSION_NEXT_IMPL_07162005_0136 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct joint_view_iterator_tag; + + template + struct joint_view_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename Iterator::last_type last_type; + typedef typename Iterator::concat_type concat_type; + typedef typename result_of::next::type next_type; + typedef result_of::equal_to equal_to; + + typedef typename + mpl::if_< + equal_to + , concat_type + , joint_view_iterator + >::type + type; + + static type + call(Iterator const& i, mpl::true_) + { + return i.concat; + } + + static type + call(Iterator const& i, mpl::false_) + { + return type(fusion::next(i.first), i.concat); + } + + static type + call(Iterator const& i) + { + return call(i, equal_to()); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/joint_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/joint_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..68cb053d --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/detail/value_of_impl.hpp @@ -0,0 +1,30 @@ +/*============================================================================= + 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_IMPL_07162005_0132) +#define FUSION_VALUE_IMPL_07162005_0132 + +#include + +namespace boost { namespace fusion +{ + struct joint_view_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + : detail::adapt_value_traits {}; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/joint_view/joint_view.hpp b/include/boost/fusion/sequence/view/joint_view/joint_view.hpp new file mode 100644 index 00000000..6e0ac9cc --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/joint_view.hpp @@ -0,0 +1,62 @@ +/*============================================================================= + 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_JOINT_VIEW_07162005_0140) +#define FUSION_JOINT_VIEW_07162005_0140 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct joint_view_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + template + struct joint_view : sequence_base > + { + typedef joint_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef forward_sequence_tag category; + typedef mpl::true_ is_view; + + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + typedef typename result_of::begin::type concat_type; + typedef typename result_of::end::type concat_last_type; + typedef typename mpl::plus, result_of::size >::type size; + + joint_view(Sequence1& seq1, Sequence2& seq2) + : seq1(seq1) + , seq2(seq2) + {} + + first_type first() const { return fusion::begin(seq1); } + concat_type concat() const { return fusion::begin(seq2); } + concat_last_type concat_last() const { return fusion::end(seq2); } + + private: + + typename mpl::if_, Sequence1, Sequence1&>::type seq1; + typename mpl::if_, Sequence2, Sequence2&>::type seq2; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/joint_view/joint_view_iterator.hpp b/include/boost/fusion/sequence/view/joint_view/joint_view_iterator.hpp new file mode 100644 index 00000000..49ad4c33 --- /dev/null +++ b/include/boost/fusion/sequence/view/joint_view/joint_view_iterator.hpp @@ -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_JOINT_VIEW_ITERATOR_07162005_0140) +#define FUSION_JOINT_VIEW_ITERATOR_07162005_0140 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct joint_view_iterator_tag; + struct forward_traversal_tag; + + template + struct joint_view_iterator + : iterator_base > + { + typedef convert_iterator first_converter; + typedef convert_iterator last_converter; + typedef convert_iterator concat_converter; + + typedef typename first_converter::type first_type; + typedef typename last_converter::type last_type; + typedef typename concat_converter::type concat_type; + + typedef joint_view_iterator_tag ftag; + typedef forward_traversal_tag category; + BOOST_STATIC_ASSERT((!result_of::equal_to::value)); + + joint_view_iterator(First const& first, Concat const& concat) + : first(first_converter::call(first)) + , concat(concat_converter::call(concat)) + {} + + first_type first; + concat_type concat; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view.hpp b/include/boost/fusion/sequence/view/reverse_view.hpp new file mode 100644 index 00000000..cf782dac --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view.hpp @@ -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_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612) +#define FUSION_SEQUENCE_VIEW_REVERSE_VIEW_10022005_0612 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp new file mode 100644 index 00000000..4508c9db --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/advance_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + 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_ADVANCE_IMPL_14122005_2015) +#define FUSION_ADVANCE_IMPL_14122005_2015 + +#include +#include + +namespace boost { namespace fusion { + + struct reverse_view_iterator_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template + struct advance_impl; + + template<> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename mpl::negate::type negative_dist; + typedef typename result_of::advance::type advanced_type; + typedef reverse_view_iterator type; + + static type + call(Iterator const& i) + { + return type(boost::fusion::advance(i.first)); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/begin_impl.hpp new file mode 100644 index 00000000..77ec5aac --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_07202005_0849) +#define FUSION_BEGIN_IMPL_07202005_0849 + +namespace boost { namespace fusion +{ + struct reverse_view_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef reverse_view_iterator type; + + static type + call(Sequence const& s) + { + return type(s.last()); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/deref_impl.hpp new file mode 100644 index 00000000..f6dc07c4 --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/deref_impl.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_07202005_0851) +#define FUSION_DEREF_IMPL_07202005_0851 + +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename + result_of::deref< + typename result_of::prior< + typename Iterator::first_type + >::type + >::type + type; + + static type + call(Iterator const& i) + { + return *fusion::prior(i.first); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp new file mode 100644 index 00000000..b6db99cd --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/distance_impl.hpp @@ -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(FUSION_DISTANCE_IMPL_14122005_2104) +#define FUSION_DISTANCE_IMPL_14122005_2104 + +#include + +namespace boost { namespace fusion { + + struct reverse_view_iterator_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template + struct distance_impl; + + template<> + struct distance_impl + { + template + struct apply + { + typedef typename First::first_type first_type; + typedef typename Last::first_type last_type; + typedef typename result_of::distance::type type; + + static type + call(First const& first, Last const& last) + { + return boost::fusion::distance(last.first, first.first); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/end_impl.hpp new file mode 100644 index 00000000..39e28dd0 --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/end_impl.hpp @@ -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_END_IMPL_07202005_0851) +#define FUSION_END_IMPL_07202005_0851 + +namespace boost { namespace fusion +{ + struct reverse_view_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef reverse_view_iterator type; + + static type + call(Sequence const& s) + { + return type(s.first()); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/next_impl.hpp new file mode 100644 index 00000000..3d3c6a30 --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/next_impl.hpp @@ -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_NEXT_IMPL_07202005_0856) +#define FUSION_NEXT_IMPL_07202005_0856 + +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_iterator_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename prior_impl:: + template apply + wrapped; + + typedef reverse_view_iterator type; + + static type + call(Iterator const& i) + { + return type(wrapped::call(i.first)); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/prior_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/prior_impl.hpp new file mode 100644 index 00000000..bf5dc00e --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/prior_impl.hpp @@ -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_07202005_0857) +#define FUSION_PRIOR_IMPL_07202005_0857 + +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_iterator_tag; + + template + struct reverse_view_iterator; + + namespace extension + { + template <> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename next_impl:: + template apply + wrapped; + + typedef reverse_view_iterator type; + + static type + call(Iterator const& i) + { + return type(wrapped::call(i.first)); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..1d8f93a0 --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/detail/value_of_impl.hpp @@ -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_VALUE_OF_IMPL_07202005_0900) +#define FUSION_VALUE_OF_IMPL_07202005_0900 + +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename + result_of::value_of< + typename result_of::prior< + typename Iterator::first_type + >::type + >::type + type; + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/reverse_view.hpp b/include/boost/fusion/sequence/view/reverse_view/reverse_view.hpp new file mode 100644 index 00000000..fe10ea6a --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/reverse_view.hpp @@ -0,0 +1,59 @@ +/*============================================================================= + 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_VIEW_07202005_0836) +#define FUSION_REVERSE_VIEW_07202005_0836 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_tag; + struct fusion_sequence_tag; + + template + struct reverse_view : sequence_base > + { + typedef reverse_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::true_ is_view; + + typedef typename traits::category_of::type category; + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + typedef typename result_of::size::type size; + + BOOST_STATIC_ASSERT(( + is_base_and_derived< + bidirectional_traversal_tag + , typename traits::category_of::type>::value)); + + reverse_view(Sequence& seq) + : seq(seq) + {} + + first_type first() const { return fusion::begin(seq); } + last_type last() const { return fusion::end(seq); } + typename mpl::if_, Sequence, Sequence&>::type seq; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/reverse_view/reverse_view_iterator.hpp b/include/boost/fusion/sequence/view/reverse_view/reverse_view_iterator.hpp new file mode 100644 index 00000000..54c61e7d --- /dev/null +++ b/include/boost/fusion/sequence/view/reverse_view/reverse_view_iterator.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_VIEW_ITERATOR_07202005_0835) +#define FUSION_REVERSE_VIEW_ITERATOR_07202005_0835 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct reverse_view_iterator_tag; + + template + struct reverse_view_iterator + : iterator_base > + { + typedef convert_iterator converter; + typedef typename converter::type first_type; + typedef reverse_view_iterator_tag ftag; + typedef typename traits::category_of::type category; + + BOOST_STATIC_ASSERT(( + is_base_and_derived< + bidirectional_traversal_tag + , category>::value)); + + reverse_view_iterator(First const& first) + : first(converter::call(first)) {} + + first_type first; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/view/single_view.hpp b/include/boost/fusion/sequence/view/single_view.hpp new file mode 100644 index 00000000..65410a36 --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view.hpp @@ -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_SINGLE_VIEW_03192006_2216) +#define FUSION_SINGLE_VIEW_03192006_2216 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/single_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/single_view/detail/begin_impl.hpp new file mode 100644 index 00000000..18ca8104 --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_05052005_0305) +#define FUSION_BEGIN_IMPL_05052005_0305 + +namespace boost { namespace fusion +{ + struct single_view_tag; + + template + struct single_view_iterator; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef single_view_iterator type; + + static type + call(Sequence& s) + { + return type(s); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/single_view/detail/deref_impl.hpp new file mode 100644 index 00000000..d46bccef --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/detail/deref_impl.hpp @@ -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_0258) +#define FUSION_DEREF_IMPL_05052005_0258 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct single_view_iterator_tag; + + namespace extension + { + template + struct deref_impl; + + template <> + struct deref_impl + { + template + struct apply + { + typedef typename Iterator::value_type type; + + static type + call(Iterator const& i) + { + return i.val; + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/single_view/detail/end_impl.hpp new file mode 100644 index 00000000..576985c5 --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/detail/end_impl.hpp @@ -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_END_IMPL_05052005_0332) +#define FUSION_END_IMPL_05052005_0332 + +namespace boost { namespace fusion +{ + struct single_view_tag; + + template + struct single_view_iterator_end; + + namespace extension + { + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply + { + typedef single_view_iterator_end type; + + static type + call(Sequence&) + { + return type(); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/single_view/detail/next_impl.hpp new file mode 100644 index 00000000..02b823e5 --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/detail/next_impl.hpp @@ -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_NEXT_IMPL_05052005_0331) +#define FUSION_NEXT_IMPL_05052005_0331 + +namespace boost { namespace fusion +{ + struct single_view_iterator_tag; + + template + struct single_view_iterator_end; + + template + struct single_view_iterator; + + namespace extension + { + template + struct next_impl; + + template <> + struct next_impl + { + template + struct apply + { + typedef single_view_iterator_end< + typename Iterator::single_view_type> + type; + + static type + call(Iterator) + { + return type(); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/single_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..05c97afc --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/detail/value_of_impl.hpp @@ -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_VALUE_IMPL_05052005_0324) +#define FUSION_VALUE_IMPL_05052005_0324 + +namespace boost { namespace fusion +{ + struct single_view_iterator_tag; + + namespace extension + { + template + struct value_of_impl; + + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename Iterator::single_view_type single_view_type; + typedef typename single_view_type::value_type type; + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/single_view.hpp b/include/boost/fusion/sequence/view/single_view/single_view.hpp new file mode 100644 index 00000000..5fc81edc --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/single_view.hpp @@ -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_SINGLE_VIEW_05052005_0335) +#define FUSION_SINGLE_VIEW_05052005_0335 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct single_view_tag; + struct forward_sequence_tag; + struct fusion_sequence_tag; + + template + struct single_view : sequence_base > + { + typedef single_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef forward_sequence_tag category; + typedef mpl::true_ is_view; + typedef mpl::int_<1> size; + typedef T value_type; + + single_view() + : val() {} + + explicit single_view(typename detail::call_param::type val) + : val(val) {} + + value_type val; + }; + + template + inline single_view::type> + make_single_view(T const& v) + { + return single_view::type>(v); + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/single_view/single_view_iterator.hpp b/include/boost/fusion/sequence/view/single_view/single_view_iterator.hpp new file mode 100644 index 00000000..e2a9bead --- /dev/null +++ b/include/boost/fusion/sequence/view/single_view/single_view_iterator.hpp @@ -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_SINGLE_VIEW_ITERATOR_05052005_0340) +#define FUSION_SINGLE_VIEW_ITERATOR_05052005_0340 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct single_view_iterator_tag; + struct forward_traversal_tag; + + template + struct single_view_iterator_end + : iterator_base > + { + typedef single_view_iterator_tag ftag; + typedef forward_traversal_tag category; + }; + + template + struct single_view_iterator + : iterator_base > + { + typedef single_view_iterator_tag ftag; + typedef forward_traversal_tag category; + typedef typename SingleView::value_type value_type; + typedef SingleView single_view_type; + + explicit single_view_iterator(single_view_type const& view) + : val(view.val) {} + + value_type val; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view.hpp b/include/boost/fusion/sequence/view/transform_view.hpp new file mode 100644 index 00000000..62ef8a10 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view.hpp @@ -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_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612) +#define FUSION_SEQUENCE_VIEW_TRANSFORM_VIEW_10022005_0612 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/transform_view/detail/advance_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/advance_impl.hpp new file mode 100644 index 00000000..9a1cf14d --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/advance_impl.hpp @@ -0,0 +1,76 @@ +/*============================================================================= + 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_ADVANCE_IMPL_13122005_1906) +#define FUSION_ADVANCE_IMPL_13122005_1906 + +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + template + struct transform_view_iterator; + + template + struct transform_view_iterator2; + + namespace extension + { + template + struct advance_impl; + + // Unary Version + template<> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename result_of::advance::type advanced_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator type; + + static type + call(Iterator const& i) + { + return type(boost::fusion::advance(i.first), i.f); + } + }; + }; + + // Binary Version + template<> + struct advance_impl + { + template + struct apply + { + typedef typename Iterator::first1_type first1_type; + typedef typename Iterator::first2_type first2_type; + typedef typename result_of::advance::type advanced1_type; + typedef typename result_of::advance::type advanced2_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator2 type; + + static type + call(Iterator const& i) + { + return type( + boost::fusion::advance(i.first1) + , boost::fusion::advance(i.first2), i.f); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp b/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp new file mode 100644 index 00000000..3ff0b8ad --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/apply_transform_result.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + 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_APPLY_TRANSFORM_RESULT_02092006_1936) +#define FUSION_APPLY_TRANSFORM_RESULT_02092006_1936 + +namespace boost { namespace fusion +{ + struct void_; + + namespace detail + { + template + struct apply_transform_result + { + template + struct apply + { + typedef typename F::template result::type type; + }; + + template + struct apply + { + typedef typename F::template result::type type; + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/begin_impl.hpp new file mode 100644 index 00000000..94f7b5f6 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/begin_impl.hpp @@ -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_BEGIN_IMPL_07162005_1031) +#define FUSION_BEGIN_IMPL_07162005_1031 + +#include + +namespace boost { namespace fusion +{ + template + struct transform_view_iterator; + + template + struct transform_view_iterator2; + + namespace extension + { + template + struct begin_impl; + + // Unary Version + template <> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::first_type first_type; + typedef typename Sequence::transform_type transform_type; + typedef transform_view_iterator type; + + static type + call(Sequence& s) + { + return type(s.first(), s.f); + } + }; + }; + + // Binary Version + template <> + struct begin_impl + { + template + struct apply + { + typedef typename Sequence::first1_type first1_type; + typedef typename Sequence::first2_type first2_type; + typedef typename Sequence::transform_type transform_type; + typedef transform_view_iterator2 type; + + static type + call(Sequence& s) + { + return type(s.first1(), s.first2(), s.f); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/deref_impl.hpp new file mode 100644 index 00000000..3da4e396 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/deref_impl.hpp @@ -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_DEREF_IMPL_07162005_1026) +#define FUSION_DEREF_IMPL_07162005_1026 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct deref_impl; + + // Unary Version + template <> + struct deref_impl + { + template + struct apply + { + typedef typename + result_of::value_of::type + value_type; + + typedef detail::apply_transform_result transform_type; + typedef typename mpl::apply::type type; + + static type + call(Iterator const& i) + { + return i.f(*i.first); + } + }; + }; + + // Binary Version + template <> + struct deref_impl + { + template + struct apply + { + typedef typename + result_of::value_of::type + value1_type; + typedef typename + result_of::value_of::type + value2_type; + + typedef detail::apply_transform_result transform_type; + typedef typename mpl::apply::type type; + + static type + call(Iterator const& i) + { + return i.f(*i.first1, *i.first2); + } + }; + }; } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/detail/distance_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/distance_impl.hpp new file mode 100644 index 00000000..cf20b593 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/distance_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_DISTANCE_IMPL_13122005_2139) +#define FUSION_DISTANCE_IMPL_13122005_2139 + +#include + +namespace boost { namespace fusion { + + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct distance_impl; + + // Unary Version + template<> + struct distance_impl + { + template + struct apply + { + typedef typename First::first_type first_type; + typedef typename Last::first_type last_type; + typedef typename result_of::distance::type type; + + static type + call(First const& first, Last const& last) + { + return boost::fusion::distance(first.first, last.first); + } + }; + }; + + // Binary Version + template<> + struct distance_impl + { + template + struct apply + { + typedef typename First::first1_type first1_type; + typedef typename Last::first1_type last1_type; + typedef typename result_of::distance::type type; + + static type + call(First const& first, Last const& last) + { + return boost::fusion::distance(first.first1, last.first1); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/transform_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/end_impl.hpp new file mode 100644 index 00000000..3b2d4af0 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/end_impl.hpp @@ -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_END_IMPL_07162005_1028) +#define FUSION_END_IMPL_07162005_1028 + +#include + +namespace boost { namespace fusion +{ + template + struct transform_view_iterator; + + template + struct transform_view_iterator2; + + namespace extension + { + template + struct end_impl; + + // Unary Version + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::last_type last_type; + typedef typename Sequence::transform_type transform_type; + typedef transform_view_iterator type; + + static type + call(Sequence& s) + { + return type(s.last(), s.f); + } + }; + }; + + // Binary Version + template <> + struct end_impl + { + template + struct apply + { + typedef typename Sequence::last1_type last1_type; + typedef typename Sequence::last2_type last2_type; + typedef typename Sequence::transform_type transform_type; + typedef transform_view_iterator2 type; + + static type + call(Sequence& s) + { + return type(s.last1(), s.last2(), s.f); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/next_impl.hpp new file mode 100644 index 00000000..9823569b --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/next_impl.hpp @@ -0,0 +1,75 @@ +/*============================================================================= + 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_07162005_1029) +#define FUSION_NEXT_IMPL_07162005_1029 + +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + template + struct transform_view_iterator; + + template + struct transform_view_iterator2; + + namespace extension + { + template + struct next_impl; + + // Unary Version + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename result_of::next::type next_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator type; + + static type + call(Iterator const& i) + { + return type(fusion::next(i.first), i.f); + } + }; + }; + + // Binary Version + template <> + struct next_impl + { + template + struct apply + { + typedef typename Iterator::first1_type first1_type; + typedef typename Iterator::first2_type first2_type; + typedef typename result_of::next::type next1_type; + typedef typename result_of::next::type next2_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator2 type; + + static type + call(Iterator const& i) + { + return type(fusion::next(i.first1), fusion::next(i.first2), i.f); + } + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/detail/prior_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/prior_impl.hpp new file mode 100644 index 00000000..d53a28e0 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/prior_impl.hpp @@ -0,0 +1,74 @@ +/*============================================================================= + 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_PREV_IMPL_13122005_2110) +#define FUSION_PREV_IMPL_13122005_2110 + +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + template + struct transform_view_iterator; + + template + struct transform_view_iterator2; + + namespace extension + { + template + struct prior_impl; + + // Unary Version + template<> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::first_type first_type; + typedef typename result_of::prior::type prior_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator type; + + static type + call(Iterator const& i) + { + return type(fusion::prior(i.first), i.f); + } + }; + }; + + // Binary Version + template<> + struct prior_impl + { + template + struct apply + { + typedef typename Iterator::first1_type first1_type; + typedef typename Iterator::first2_type first2_type; + typedef typename result_of::prior::type prior1_type; + typedef typename result_of::prior::type prior2_type; + typedef typename Iterator::transform_type transform_type; + typedef transform_view_iterator2 type; + + static type + call(Iterator const& i) + { + return type(fusion::prior(i.first1), fusion::prior(i.first2), i.f); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/transform_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/transform_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..e95aa105 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/detail/value_of_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_IMPL_07162005_1030) +#define FUSION_VALUE_OF_IMPL_07162005_1030 + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct transform_view_iterator_tag; + struct transform_view_iterator2_tag; + + namespace extension + { + template + struct value_of_impl; + + // Unary Version + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename + result_of::value_of::type + value_type; + + typedef detail::apply_transform_result transform_type; + typedef typename mpl::apply::type type; + }; + }; + + // Binary Version + template <> + struct value_of_impl + { + template + struct apply + { + typedef typename + result_of::value_of::type + value1_type; + typedef typename + result_of::value_of::type + value2_type; + + typedef detail::apply_transform_result transform_type; + typedef typename mpl::apply::type type; + }; + }; + } +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/transform_view.hpp b/include/boost/fusion/sequence/view/transform_view/transform_view.hpp new file mode 100644 index 00000000..b5158029 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/transform_view.hpp @@ -0,0 +1,95 @@ +/*============================================================================= + 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_VIEW_07162005_1037) +#define FUSION_TRANSFORM_VIEW_07162005_1037 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + struct transform_view_tag; + struct transform_view2_tag; + struct fusion_sequence_tag; + + // Binary Version + template + struct transform_view : sequence_base > + { + BOOST_STATIC_ASSERT(result_of::size::value == result_of::size::value); + typedef transform_view2_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::true_ is_view; + + typedef typename traits::category_of::type category1; + typedef typename traits::category_of::type category2; + typedef typename result_of::begin::type first1_type; + typedef typename result_of::begin::type first2_type; + typedef typename result_of::end::type last1_type; + typedef typename result_of::end::type last2_type; + typedef typename result_of::size::type size; + typedef F transform_type; + + transform_view(Sequence1& seq1, Sequence2& seq2, F const& binop) + : f(binop) + , seq1(seq1) + , seq2(seq2) + {} + + first1_type first1() const { return fusion::begin(seq1); } + first2_type first2() const { return fusion::begin(seq2); } + last1_type last1() const { return fusion::end(seq1); } + last2_type last2() const { return fusion::end(seq2); } + + transform_type f; + typename mpl::if_, Sequence1, Sequence1&>::type seq1; + typename mpl::if_, Sequence2, Sequence2&>::type seq2; + }; + + // Unary Version + template + struct transform_view : sequence_base > + { + typedef transform_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::true_ is_view; + + typedef typename traits::category_of::type category; + typedef typename result_of::begin::type first_type; + typedef typename result_of::end::type last_type; + typedef typename result_of::size::type size; + typedef F transform_type; + + transform_view(Sequence& seq, F const& f) + : seq(seq) + , f(f) + {} + + first_type first() const { return fusion::begin(seq); } + last_type last() const { return fusion::end(seq); } + typename mpl::if_, Sequence, Sequence&>::type seq; + transform_type f; + }; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/transform_view_fwd.hpp b/include/boost/fusion/sequence/view/transform_view/transform_view_fwd.hpp new file mode 100644 index 00000000..324d2dd9 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/transform_view_fwd.hpp @@ -0,0 +1,23 @@ +/*============================================================================= + 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_VIEW_FORWARD_01052006_1839) +#define FUSION_TRANSFORM_VIEW_FORWARD_01052006_1839 + +namespace boost { namespace fusion +{ + struct void_; + struct transform_view_tag; + struct transform_view2_tag; + + template + struct transform_view; +}} + +#endif + + diff --git a/include/boost/fusion/sequence/view/transform_view/transform_view_iterator.hpp b/include/boost/fusion/sequence/view/transform_view/transform_view_iterator.hpp new file mode 100644 index 00000000..2571f5d8 --- /dev/null +++ b/include/boost/fusion/sequence/view/transform_view/transform_view_iterator.hpp @@ -0,0 +1,68 @@ +/*============================================================================= + 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_VIEW_ITERATOR_07162005_1033) +#define FUSION_TRANSFORM_VIEW_ITERATOR_07162005_1033 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + // Unary Version + struct transform_view_iterator_tag; + + template + struct transform_view_iterator + : iterator_base > + { + typedef transform_view_iterator_tag ftag; + typedef convert_iterator converter; + typedef typename converter::type first_type; + typedef typename traits::category_of::type category; + typedef F transform_type; + + transform_view_iterator(First const& first, F const& f) + : first(converter::call(first)), f(f) {} + + first_type first; + transform_type f; + }; + + // Binary Version + struct transform_view_iterator2_tag; + + template + struct transform_view_iterator2 + : iterator_base > + { + typedef transform_view_iterator2_tag ftag; + typedef convert_iterator converter1; + typedef convert_iterator converter2; + typedef typename converter1::type first1_type; + typedef typename converter2::type first2_type; + typedef typename traits::category_of::type category; + typedef F transform_type; + + transform_view_iterator2(First1 const& first1, First2 const& first2, F const& f) + : first1(converter1::call(first1)), first2(converter2::call(first2)), f(f) {} + + first1_type first1; + first2_type first2; + transform_type f; + }; +}} + +#endif + diff --git a/include/boost/fusion/sequence/view/zip_view.hpp b/include/boost/fusion/sequence/view/zip_view.hpp new file mode 100644 index 00000000..c2acf665 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view.hpp @@ -0,0 +1,15 @@ +/*============================================================================= + 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_ZIP_VIEW_23012006_0811) +#define FUSION_ZIP_VIEW_23012006_0811 + +#include +#include + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp new file mode 100644 index 00000000..4a423604 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/advance_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_ADVANCE_IMPL_20061024_2021) +#define FUSION_ADVANCE_IMPL_20061024_2021 + +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + template + struct poly_advance + { + template + struct result + : result_of::advance + {}; + + template + typename result::type + operator()(const It& it) const + { + return fusion::advance(it); + } + }; + } + + namespace extension + { + template + struct advance_impl; + + template<> + struct advance_impl + { + template + struct apply + { + typedef zip_view_iterator< + typename result_of::transform >::type> type; + + static type + call(It const& it) + { + return type( + fusion::transform(it.iterators_, detail::poly_advance())); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp new file mode 100644 index 00000000..cdcc22a6 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/at_impl.hpp @@ -0,0 +1,78 @@ +/*============================================================================= + 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_AT_IMPL_20060124_1933) +#define FUSION_AT_IMPL_20060124_1933 + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct zip_view_tag; + + namespace detail + { + template + struct poly_at + { + template + struct result + : result_of::at::type, N> + { + BOOST_MPL_ASSERT((is_reference)); + }; + + template + typename result::type + operator()(Seq& seq) const + { + return fusion::at(seq); + } + + template + typename result::type + operator()(Seq const& seq) const + { + return fusion::at(seq); + } + }; + } + + namespace extension + { + template + struct at_impl; + + template<> + struct at_impl + { + template + struct apply + { + typedef typename result_of::as_vector< + typename result_of::transform< + typename Seq::sequences, detail::poly_at >::type>::type type; + + static type + call(Seq& seq) + { + return type( + fusion::transform(seq.sequences_, detail::poly_at())); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp new file mode 100644 index 00000000..9ba435b7 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/begin_impl.hpp @@ -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) +==============================================================================*/ +#if !defined(FUSION_BEGIN_IMPL_20060123_2147) +#define FUSION_BEGIN_IMPL_20060123_2147 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_tag; + + namespace detail + { + struct poly_begin + { + template + struct result + : result_of::begin::type> + { + BOOST_MPL_ASSERT((is_reference)); + }; + + template + typename result::type + operator()(Seq& seq) const + { + return fusion::begin(seq); + } + + template + typename result::type + operator()(Seq const& seq) const + { + return fusion::begin(seq); + } + + }; + } + + namespace extension + { + template + struct begin_impl; + + template<> + struct begin_impl + { + template + struct apply + { + typedef zip_view_iterator< + typename result_of::transform::type, + typename Sequence::category> type; + + static type + call(Sequence& sequence) + { + return type( + fusion::transform(sequence.sequences_, detail::poly_begin())); + } + }; + + + + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp new file mode 100644 index 00000000..fcab17c4 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/deref_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_DEREF_IMPL_20061024_1959) +#define FUSION_DEREF_IMPL_20061024_1959 + +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + struct poly_deref + { + template + struct result + : result_of::deref + {}; + + template + typename result::type + operator()(const It& it) const + { + return fusion::deref(it); + } + }; + } + + namespace extension + { + template + struct deref_impl; + + template<> + struct deref_impl + { + template + struct apply + { + typedef typename result_of::as_vector< + typename result_of::transform::type>::type type; + + static type + call(It const& it) + { + return type( + fusion::transform(it.iterators_, detail::poly_deref())); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/distance_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/distance_impl.hpp new file mode 100644 index 00000000..e1505a9e --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/distance_impl.hpp @@ -0,0 +1,83 @@ +/*============================================================================= + 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_DISTANCE_IMPL_20060124_2033) +#define FUSION_DISTANCE_IMPL_20060124_2033 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + struct random_access_iterator_tag; + + namespace detail + { + template + struct best_distance + { + typedef typename result_of::find_if< + typename SearchIt::iterators, is_same, random_access_iterator_tag> > finder; + + BOOST_MPL_ASSERT_NOT((is_same >)); + + typedef typename result_of::distance::type type; + }; + + template + struct default_distance + : result_of::distance< + typename result_of::value_at_c::type, + typename result_of::value_at_c::type> + {}; + + template + struct zip_view_iterator_distance + { + typedef typename result_of::find_if< + typename It1::iterators, is_same, random_access_iterator_tag> > finder; + + typedef typename mpl::eval_if< + is_same::type>, + detail::default_distance , + detail::best_distance >::type type; + }; + } + + namespace extension + { + template + struct distance_impl; + + template<> + struct distance_impl + { + template + struct apply + : detail::zip_view_iterator_distance::type + { + static typename detail::zip_view_iterator_distance::type + call(It1 const& it1, It2 const& it2) + { + return typename detail::zip_view_iterator_distance::type(); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp new file mode 100644 index 00000000..c6a10e9e --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/end_impl.hpp @@ -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) +==============================================================================*/ +#if !defined(FUSION_END_IMPL_20060123_2208) +#define FUSION_END_IMPL_20060123_2208 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_tag; + + namespace detail + { + struct poly_end + { + template + struct result + : result_of::end::type> + { + BOOST_MPL_ASSERT((is_reference)); + }; + + template + typename result::type + operator()(Seq& seq) const + { + return fusion::end(seq); + } + + template + typename result::type + operator()(Seq const& seq) const + { + return fusion::end(seq); + } + + }; + } + + namespace extension + { + template + struct end_impl; + + template<> + struct end_impl + { + template + struct apply + { + typedef zip_view_iterator< + typename result_of::transform::type, + typename Sequence::category> type; + + static type + call(Sequence& sequence) + { + return type( + fusion::transform(sequence.sequences_, detail::poly_end())); + } + }; + + + + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/equal_to_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/equal_to_impl.hpp new file mode 100644 index 00000000..10643609 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/equal_to_impl.hpp @@ -0,0 +1,63 @@ +/*============================================================================= + 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_EQUAL_TO_IMPL_20060128_1423) +#define FUSION_EQUAL_TO_IMPL_20060128_1423 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + template + struct zip_iterators_equal + { + typedef mpl::zip_view > zipped; + typedef mpl::transform_view > > transformed; + + typedef typename mpl::find_if >::type found; + + typedef typename is_same::type, found>::type type; + }; + } + + namespace extension + { + template + struct equal_to_impl; + + template<> + struct equal_to_impl + { + template + struct apply + : detail::zip_iterators_equal::type + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp new file mode 100644 index 00000000..45d618fb --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/next_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_NEXT_IMPL_20060124_2006) +#define FUSION_NEXT_IMPL_20060124_2006 + +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + struct poly_next + { + template + struct result + : result_of::next + {}; + + template + typename result::type + operator()(const It& it) const + { + return fusion::next(it); + } + }; + } + + namespace extension + { + template + struct next_impl; + + template<> + struct next_impl + { + template + struct apply + { + typedef fusion::zip_view_iterator< + typename result_of::transform::type, + typename Iterator::category> type; + + static type + call(Iterator const& it) + { + return type( + fusion::transform(it.iterators_, detail::poly_next())); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp new file mode 100644 index 00000000..35187f48 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/prior_impl.hpp @@ -0,0 +1,65 @@ +/*============================================================================= + 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_PRIOR_IMPL_20060124_2006) +#define FUSION_PRIOR_IMPL_20060124_2006 + +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + struct poly_prior + { + template + struct result + : result_of::prior + {}; + + template + typename result::type + operator()(const It& it) const + { + return fusion::prior(it); + } + }; + } + + namespace extension + { + template + struct prior_impl; + + template<> + struct prior_impl + { + template + struct apply + { + typedef zip_view_iterator< + typename result_of::transform::type, + typename Iterator::category> type; + + static type + call(Iterator const& it) + + { + return type( + fusion::transform(it.iterators_, detail::poly_prior())); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/size_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/size_impl.hpp new file mode 100644 index 00000000..692c9d3f --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/size_impl.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_SIZE_IMPL_20060124_0800) +#define FUSION_SIZE_IMPL_20060124_0800 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_tag; + struct random_access_iterator_tag; + + namespace detail + { + template + struct zip_view_size + { + typedef result_of::find_if< + typename Sequence::sequences, + is_same >, random_access_iterator_tag> > finder; + + typedef typename remove_reference::type>, + result_of::value_at_c, + result_of::deref >::type>::type best_sequence; + + typedef typename fusion::result_of::size type; + }; + } + + namespace extension + { + template + struct size; + + template + struct size_impl; + + template<> + struct size_impl + { + template + struct apply + : detail::zip_view_size::type + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp new file mode 100644 index 00000000..594d3c3b --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/strictest_traversal.hpp @@ -0,0 +1,64 @@ +/*============================================================================= + 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_STRICTEST_TRAVERSAL_20060123_2101) +#define FUSION_STRICTEST_TRAVERSAL_20060123_2101 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct forward_traversal_tag; + struct bidirectional_traversal_tag; + struct random_access_traversal_tag; + + namespace detail + { + template + struct strictest_traversal_impl + { + typedef StrictestSoFar tag1; + typedef typename traits::category_of< + typename remove_reference::type>::type tag2; + + typedef typename mpl::or_< + is_same, + is_same >::type + has_forward_traversal; + + typedef typename mpl::or_< + is_same, + is_same >::type + has_bidirectional_traversal; + + typedef typename mpl::if_< + has_forward_traversal, + forward_traversal_tag, + typename mpl::if_< + has_bidirectional_traversal, + bidirectional_traversal_tag, + random_access_traversal_tag>::type>::type type; + }; + + template + struct strictest_traversal + : result_of::fold< + Sequence, fusion::random_access_traversal_tag, + strictest_traversal_impl > + {}; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp new file mode 100644 index 00000000..cf2bf5d9 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/value_at_impl.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + 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_VALUE_AT_IMPL_20060124_2129) +#define FUSION_VALUE_AT_IMPL_20060124_2129 + +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_tag; + + namespace detail + { + template + struct poly_value_at + { + template + struct result + : result_of::value_at::type, N> + {}; + }; + } + + namespace extension + { + template + struct value_at_impl; + + template<> + struct value_at_impl + { + template + struct apply + { + typedef typename result_of::transform< + typename Sequence::sequences, + detail::poly_value_at >::type values; + typedef typename result_of::as_vector::type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp b/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp new file mode 100644 index 00000000..46ed7330 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/detail/value_of_impl.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + 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_VALUE_OF_IMPL_20060124_2147) +#define FUSION_VALUE_OF_IMPL_20060124_2147 + +#include +#include +#include +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + namespace detail + { + struct poly_value_of + { + template + struct result + : result_of::value_of + {}; + }; + } + + namespace extension + { + template + struct value_of_impl; + + template<> + struct value_of_impl + { + template + struct apply + { + typedef typename result_of::transform< + typename Iterator::iterators, + detail::poly_value_of>::type values; + + typedef typename result_of::as_vector::type type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/zip_view.hpp b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp new file mode 100644 index 00000000..a8706801 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/zip_view.hpp @@ -0,0 +1,88 @@ +/*============================================================================= + 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_ZIP_VIEW_23012006_0813) +#define FUSION_ZIP_VIEW_23012006_0813 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace boost { namespace fusion { + + namespace detail + { + template + struct all_references + : fusion::result_of::equal_to > >::type, typename fusion::result_of::end::type> + {}; + + template + struct all_same_size_impl + { + typedef mpl::transform_view > > sizes; + typedef typename mpl::at_c::type first_size; + typedef mpl::iterator_range< + typename mpl::next::type>::type, + typename mpl::end::type> remainder; + typedef typename mpl::find_if > >::type found_difference; + typedef typename is_same::type>::type type; + }; + + template + struct all_same_size + : all_same_size_impl::type + {}; + } + + struct zip_view_tag; + struct fusion_sequence_tag; + + template + struct zip_view : sequence_base< zip_view > + { + BOOST_MPL_ASSERT((detail::all_references)); + BOOST_MPL_ASSERT((detail::all_same_size)); + typedef typename detail::strictest_traversal::type category; + typedef zip_view_tag ftag; + typedef fusion_sequence_tag tag; // this gets picked up by MPL + typedef mpl::true_ is_view; + typedef typename fusion::result_of::as_vector::type sequences; + + zip_view( + const Sequences& seqs) + : sequences_(seqs) + {}; + + sequences sequences_; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/zip_view_iterator.hpp b/include/boost/fusion/sequence/view/zip_view/zip_view_iterator.hpp new file mode 100644 index 00000000..b92e0305 --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/zip_view_iterator.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + 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_ZIP_VIEW_ITERATOR_23012006_0814) +#define FUSION_ZIP_VIEW_ITERATOR_23012006_0814 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { namespace fusion { + + struct zip_view_iterator_tag; + + template< + typename IteratorSequence, + typename Traversal> + struct zip_view_iterator + : iterator_base > + { + typedef zip_view_iterator_tag ftag; + typedef Traversal category; + + template + zip_view_iterator( + const InitSeq& iterator_seq) + : iterators_(iterator_seq) + {} + + typedef typename result_of::as_vector::type iterators; + iterators iterators_; + }; +}} + +#endif diff --git a/include/boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp b/include/boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp new file mode 100644 index 00000000..974e931a --- /dev/null +++ b/include/boost/fusion/sequence/view/zip_view/zip_view_iterator_fwd.hpp @@ -0,0 +1,23 @@ +/*============================================================================= + 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_ZIP_VIEW_ITERATOR_FWD) +#define FUSION_ZIP_VIEW_ITERATOR_FWD + +#include + +namespace boost { namespace fusion { + + template< + typename IteratorSequence, + typename Traversal = typename detail::strictest_traversal::type> + struct zip_view_iterator; + +}} + +#endif diff --git a/include/boost/fusion/support.hpp b/include/boost/fusion/support.hpp new file mode 100644 index 00000000..adede25c --- /dev/null +++ b/include/boost/fusion/support.hpp @@ -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_SUPPORT_10022005_0545) +#define FUSION_SUPPORT_10022005_0545 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/support/category_of.hpp b/include/boost/fusion/support/category_of.hpp new file mode 100644 index 00000000..9502b21e --- /dev/null +++ b/include/boost/fusion/support/category_of.hpp @@ -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_CATEGORY_OF_07202005_0308) +#define FUSION_CATEGORY_OF_07202005_0308 + +#include +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct category_of_impl + { + template + struct apply + : detail::fusion_category_of + {}; + }; + } + + namespace traits + { + template + struct category_of + : extension::category_of_impl::type>:: + template apply + {}; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/access.hpp b/include/boost/fusion/support/detail/access.hpp new file mode 100644 index 00000000..e4449d3a --- /dev/null +++ b/include/boost/fusion/support/detail/access.hpp @@ -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_ACCESS_04182005_0737) +#define FUSION_ACCESS_04182005_0737 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct ref_result + { + typedef typename add_reference::type type; + }; + + template + struct cref_result + { + typedef typename + add_reference< + typename add_const::type + >::type + type; + }; + + template + struct non_ref_parameter + { + typedef typename boost::remove_cv::type const& type; + }; + + template + struct call_param + { + typedef typename + mpl::eval_if< + is_reference + , mpl::identity + , non_ref_parameter + >::type + type; + }; +}}} + +#endif + diff --git a/include/boost/fusion/support/detail/as_fusion_element.hpp b/include/boost/fusion/support/detail/as_fusion_element.hpp new file mode 100644 index 00000000..74fa53f5 --- /dev/null +++ b/include/boost/fusion/support/detail/as_fusion_element.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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_AS_FUSION_ELEMENT_05052005_0338) +#define FUSION_AS_FUSION_ELEMENT_05052005_0338 + +#include + +namespace boost { namespace fusion { namespace detail +{ + template + struct as_fusion_element + { + typedef T type; + }; + + template + struct as_fusion_element > + { + typedef T& type; + }; + + template + struct as_fusion_element + { + typedef const T(&type)[N]; + }; + + template + struct as_fusion_element + { + typedef const volatile T(&type)[N]; + }; + + template + struct as_fusion_element + { + typedef const volatile T(&type)[N]; + }; + +}}} + +#endif diff --git a/include/boost/fusion/support/detail/category_of.hpp b/include/boost/fusion/support/detail/category_of.hpp new file mode 100644 index 00000000..78f474f2 --- /dev/null +++ b/include/boost/fusion/support/detail/category_of.hpp @@ -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_CATEGORY_OF_07212005_1025) +#define FUSION_CATEGORY_OF_07212005_1025 + +namespace boost { namespace fusion { namespace detail +{ + template + struct fusion_category_of + { + typedef typename T::category type; + }; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/compiler_config.hpp b/include/boost/fusion/support/detail/compiler_config.hpp new file mode 100644 index 00000000..8d90f27a --- /dev/null +++ b/include/boost/fusion/support/detail/compiler_config.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + 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_COMPILER_CONFIG_01052006_1200) +#define FUSION_COMPILER_CONFIG_01052006_1200 + +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) +#pragma warning(disable : 4512 4244 4100 4305) +#endif + +#endif diff --git a/include/boost/fusion/support/detail/is_mpl_sequence.hpp b/include/boost/fusion/support/detail/is_mpl_sequence.hpp new file mode 100644 index 00000000..09a77a8b --- /dev/null +++ b/include/boost/fusion/support/detail/is_mpl_sequence.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + 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_DETAIL_IS_MPL_SEQUENCE_15122005_2137) +#define FUSION_DETAIL_IS_MPL_SEQUENCE_15122005_2137 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace detail +{ + struct mpl_int_detect + { + template + mpl_int_detect(mpl::int_) {} + + template + mpl_int_detect(mpl::bool_) {} + + template + mpl_int_detect(mpl::integral_c) {} + + template + mpl_int_detect(mpl::long_) {} + + template + mpl_int_detect(mpl::size_t) {} + }; + + template + struct is_mpl_sequence + : mpl::and_< + mpl::not_ > + , mpl::not_ > + , mpl::is_sequence > + {}; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/is_view.hpp b/include/boost/fusion/support/detail/is_view.hpp new file mode 100644 index 00000000..489c27f9 --- /dev/null +++ b/include/boost/fusion/support/detail/is_view.hpp @@ -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_IS_VIEW_03202006_0018) +#define FUSION_IS_VIEW_03202006_0018 + +namespace boost { namespace fusion { namespace detail +{ + template + struct fusion_is_view + { + typedef typename T::is_view type; + }; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/iterator_to_sequence_category.hpp b/include/boost/fusion/support/detail/iterator_to_sequence_category.hpp new file mode 100644 index 00000000..9ffbb5a5 --- /dev/null +++ b/include/boost/fusion/support/detail/iterator_to_sequence_category.hpp @@ -0,0 +1,62 @@ +/*============================================================================= + 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_TO_SEQUENCE_CATEGORY_07212005_0726) +#define FUSION_ITERATOR_TO_SEQUENCE_CATEGORY_07212005_0726 + +namespace boost { namespace fusion +{ + struct incrementable_traversal_tag; + struct single_pass_traversal_tag; + struct forward_traversal_tag; + struct bidirectional_traversal_tag; + struct random_access_traversal_tag; + + struct incrementable_sequence_tag; + struct single_pass_sequence_tag; + struct forward_sequence_tag; + struct bidirectional_sequence_tag; + struct random_access_sequence_tag; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct iterator_to_sequence_category; + + template <> + struct iterator_to_sequence_category + { + typedef incrementable_sequence_tag type; + }; + + template <> + struct iterator_to_sequence_category + { + typedef single_pass_sequence_tag type; + }; + + template <> + struct iterator_to_sequence_category + { + typedef forward_sequence_tag type; + }; + + template <> + struct iterator_to_sequence_category + { + typedef bidirectional_sequence_tag type; + }; + + template <> + struct iterator_to_sequence_category + { + typedef random_access_sequence_tag type; + }; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/mpl_iterator_category.hpp b/include/boost/fusion/support/detail/mpl_iterator_category.hpp new file mode 100644 index 00000000..0a9a8d27 --- /dev/null +++ b/include/boost/fusion/support/detail/mpl_iterator_category.hpp @@ -0,0 +1,49 @@ +/*============================================================================= + 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_CATEGORY_07212005_0923) +#define FUSION_MPL_ITERATOR_CATEGORY_07212005_0923 + +namespace boost { namespace mpl +{ + struct forward_iterator_tag; + struct bidirectional_iterator_tag; + struct random_access_iterator_tag; +}} + +namespace boost { namespace fusion +{ + struct forward_traversal_tag; + struct bidirectional_traversal_tag; + struct random_access_traversal_tag; +}} + +namespace boost { namespace fusion { namespace detail +{ + template + struct mpl_iterator_category; + + template <> + struct mpl_iterator_category + { + typedef forward_traversal_tag type; + }; + + template <> + struct mpl_iterator_category + { + typedef bidirectional_traversal_tag type; + }; + + template <> + struct mpl_iterator_category + { + typedef random_access_traversal_tag type; + }; +}}} + +#endif diff --git a/include/boost/fusion/support/detail/unknown_key.hpp b/include/boost/fusion/support/detail/unknown_key.hpp new file mode 100644 index 00000000..11c53eb4 --- /dev/null +++ b/include/boost/fusion/support/detail/unknown_key.hpp @@ -0,0 +1,17 @@ +/*============================================================================= + 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_UNKNOWN_KEY_09242005_1219) +#define FUSION_UNKNOWN_KEY_09242005_1219 + +namespace boost { namespace fusion { namespace detail +{ + template + struct unknown_key {}; +}}} + +#endif diff --git a/include/boost/fusion/support/is_associative.hpp b/include/boost/fusion/support/is_associative.hpp new file mode 100644 index 00000000..4cda074a --- /dev/null +++ b/include/boost/fusion/support/is_associative.hpp @@ -0,0 +1,36 @@ +/*============================================================================= + 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_IS_ASSOCIATIVE_09242005_1018) +#define FUSION_IS_ASSOCIATIVE_09242005_1018 + +#include +#include + +namespace boost { namespace fusion { + namespace extension + { + template + struct is_associative_impl + { + template + struct apply + : mpl::false_ + {}; + }; + } + + namespace traits + { + template + struct is_associative + : extension::is_associative_impl::type>::template apply + {}; +}}} + +#endif diff --git a/include/boost/fusion/support/is_iterator.hpp b/include/boost/fusion/support/is_iterator.hpp new file mode 100644 index 00000000..3e9415cb --- /dev/null +++ b/include/boost/fusion/support/is_iterator.hpp @@ -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_IS_ITERATOR_05062005_1219) +#define FUSION_IS_ITERATOR_05062005_1219 + +#include + +namespace boost { namespace fusion +{ + struct iterator_root; + + template + struct is_fusion_iterator : is_base_and_derived {}; +}} + +#endif diff --git a/include/boost/fusion/support/is_sequence.hpp b/include/boost/fusion/support/is_sequence.hpp new file mode 100644 index 00000000..539fd396 --- /dev/null +++ b/include/boost/fusion/support/is_sequence.hpp @@ -0,0 +1,51 @@ +/*============================================================================= + 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_IS_SEQUENCE_05052005_1002) +#define FUSION_IS_SEQUENCE_05052005_1002 + +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct non_fusion_tag; + + namespace extension + { + template + struct is_sequence_impl + : is_base_and_derived + { + template + struct apply + : is_base_and_derived + {}; + }; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::false_ {}; + }; + } + + namespace traits + { + template + struct is_sequence + : extension::is_sequence_impl::type>::template apply + {}; + } +}} + +#endif diff --git a/include/boost/fusion/support/is_view.hpp b/include/boost/fusion/support/is_view.hpp new file mode 100644 index 00000000..e95038c8 --- /dev/null +++ b/include/boost/fusion/support/is_view.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + 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_IS_VIEW_03202006_0015) +#define FUSION_IS_VIEW_03202006_0015 + +#include +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct is_view_impl + { + template + struct apply + : detail::fusion_is_view + {}; + }; + } + + namespace traits + { + template + struct is_view : + extension::is_view_impl::type>:: + template apply::type + {}; +}}} + +#endif diff --git a/include/boost/fusion/support/iterator_base.hpp b/include/boost/fusion/support/iterator_base.hpp new file mode 100644 index 00000000..aa5e99ee --- /dev/null +++ b/include/boost/fusion/support/iterator_base.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + 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_BASE_05042005_1008) +#define FUSION_ITERATOR_BASE_05042005_1008 + +#include + +namespace boost { namespace fusion +{ + struct iterator_root {}; + + template + struct iterator_base : iterator_root + { + Iterator const& + cast() const + { + return static_cast(*this); + } + + Iterator& + cast() + { + return static_cast(*this); + } + }; +}} + +#endif diff --git a/include/boost/fusion/support/pair.hpp b/include/boost/fusion/support/pair.hpp new file mode 100644 index 00000000..e69c631c --- /dev/null +++ b/include/boost/fusion/support/pair.hpp @@ -0,0 +1,81 @@ +/*============================================================================= + Copyright (c) 2005 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_PAIR_07222005_1203) +#define FUSION_PAIR_07222005_1203 + +#include +#include +#include + +namespace boost { namespace fusion +{ + // A half runtime pair where the first type does not have data + template + struct pair + { + pair() + : second() {} + + pair(typename detail::call_param::type val) + : second(val) {} + + template + pair(pair const& rhs) + : second(rhs.second) {} + + template + pair& operator=(pair const& rhs) + { + second = rhs.second; + return *this; + } + + typedef First first_type; + typedef Second second_type; + Second second; + }; + + template + inline pair::type> + make_pair(Second const& val) + { + return pair::type>(val); + } + + template + inline OStream& + operator<<(OStream& os, pair const& p) + { + os << p.second; + return os; + } + + template + inline IStream& + operator>>(IStream& is, pair& p) + { + is >> p.second; + return is; + } + + template + inline bool + operator==(pair const& l, pair const& r) + { + return l.second == r.second; + } + + template + inline bool + operator!=(pair const& l, pair const& r) + { + return l.second != r.second; + } +}} + +#endif diff --git a/include/boost/fusion/support/sequence_base.hpp b/include/boost/fusion/support/sequence_base.hpp new file mode 100644 index 00000000..ed1fffc7 --- /dev/null +++ b/include/boost/fusion/support/sequence_base.hpp @@ -0,0 +1,34 @@ +/*============================================================================= + 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_BASE_04182005_0737) +#define FUSION_SEQUENCE_BASE_04182005_0737 + +#include + +namespace boost { namespace fusion +{ + struct sequence_root {}; + + template + struct sequence_base : sequence_root + { + Sequence const& + derived() const + { + return static_cast(*this); + } + + Sequence& + derived() + { + return static_cast(*this); + } + }; +}} + +#endif diff --git a/include/boost/fusion/support/tag_of.hpp b/include/boost/fusion/support/tag_of.hpp new file mode 100644 index 00000000..0ba9894a --- /dev/null +++ b/include/boost/fusion/support/tag_of.hpp @@ -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_TAG_OF_09232005_0845) +#define FUSION_TAG_OF_09232005_0845 + +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct non_fusion_tag; + + namespace detail + { + BOOST_MPL_HAS_XXX_TRAIT_DEF(ftag) + } + + namespace traits + { + template + struct tag_of + { + typedef non_fusion_tag type; + }; + + template + struct tag_of >::type> + { + typedef typename Sequence::ftag type; + }; + } + + namespace detail + { + template + struct tag_of + : traits::tag_of::type> + {}; + } +}} +#endif diff --git a/include/boost/fusion/support/tag_of_fwd.hpp b/include/boost/fusion/support/tag_of_fwd.hpp new file mode 100644 index 00000000..991c2576 --- /dev/null +++ b/include/boost/fusion/support/tag_of_fwd.hpp @@ -0,0 +1,21 @@ +/*============================================================================= + 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_TAG_OF_FWD_31122005_1445) +#define BOOST_FUSION_TAG_OF_FWD_31122005_1445 + +namespace boost { namespace fusion { + + namespace traits + { + template + struct tag_of; + } +}} + +#endif diff --git a/include/boost/fusion/support/tags.hpp b/include/boost/fusion/support/tags.hpp new file mode 100644 index 00000000..5571d779 --- /dev/null +++ b/include/boost/fusion/support/tags.hpp @@ -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_TAGS_07212005_1031) +#define FUSION_TAGS_07212005_1031 + +namespace boost { namespace fusion +{ +// Iterator Classification + struct incrementable_traversal_tag {}; + + struct single_pass_traversal_tag + : incrementable_traversal_tag {}; + + struct forward_traversal_tag + : single_pass_traversal_tag {}; + + struct bidirectional_traversal_tag + : forward_traversal_tag {}; + + struct random_access_traversal_tag + : bidirectional_traversal_tag {}; + +// Sequence Classification + struct incrementable_sequence_tag {}; + + struct single_pass_sequence_tag + : incrementable_sequence_tag {}; + + struct forward_sequence_tag + : single_pass_sequence_tag {}; + + struct bidirectional_sequence_tag + : forward_sequence_tag {}; + + struct random_access_sequence_tag + : bidirectional_sequence_tag {}; + + struct associative_sequence_tag // $$$ this is no longer true $$$ + : forward_sequence_tag {}; +}} + +#endif diff --git a/include/boost/fusion/tuple.hpp b/include/boost/fusion/tuple.hpp new file mode 100644 index 00000000..3df7adef --- /dev/null +++ b/include/boost/fusion/tuple.hpp @@ -0,0 +1,16 @@ +/*============================================================================= + 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_TUPLE_10032005_0806) +#define FUSION_TUPLE_10032005_0806 + +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp b/include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp new file mode 100644 index 00000000..e69db42e --- /dev/null +++ b/include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_TUPLE_FORWARD_CTOR_10032005_0815) +#define FUSION_TUPLE_FORWARD_CTOR_10032005_0815 + +#include +#include +#include + +#define BOOST_PP_FILENAME_1 \ + +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + +#if N == 1 + explicit +#endif + tuple(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/tuple/make_tuple.hpp b/include/boost/fusion/tuple/make_tuple.hpp new file mode 100644 index 00000000..c6e58fc0 --- /dev/null +++ b/include/boost/fusion/tuple/make_tuple.hpp @@ -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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_MAKE_TUPLE_10032005_0843) +#define FUSION_MAKE_TUPLE_10032005_0843 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + inline tuple<> + make_tuple() + { + return tuple<>(); + } + +#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data) \ + typename detail::as_fusion_element::type + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_AS_FUSION_ELEMENT + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template + inline tuple + make_tuple(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _)) + { + return tuple( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) + diff --git a/include/boost/fusion/tuple/tuple.hpp b/include/boost/fusion/tuple/tuple.hpp new file mode 100644 index 00000000..2e5ef15c --- /dev/null +++ b/include/boost/fusion/tuple/tuple.hpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2005 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_TUPLE_10032005_0810) +#define FUSION_TUPLE_10032005_0810 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + template + struct tuple : vector + { + typedef vector< + BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> + base_type; + + tuple() + : base_type() {} + + template + explicit tuple(T const& rhs) + : base_type(rhs) {} + + #include + + template + tuple& + operator=(T const& rhs) + { + base_type::operator=(rhs); + return *this; + } + }; + + template + struct tuple_size : result_of::size {}; + + template + struct tuple_element : result_of::value_at_c {}; + + template + inline typename + lazy_disable_if< + is_const + , result_of::at_c + >::type + get(Tuple& tup) + { + return at_c(tup); + } + + template + inline typename result_of::at_c::type + get(Tuple const& tup) + { + return at_c(tup); + } +}} + +#endif diff --git a/include/boost/fusion/tuple/tuple_fwd.hpp b/include/boost/fusion/tuple/tuple_fwd.hpp new file mode 100644 index 00000000..272ce536 --- /dev/null +++ b/include/boost/fusion/tuple/tuple_fwd.hpp @@ -0,0 +1,25 @@ +/*============================================================================= + Copyright (c) 2005 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_TUPLE_FORWARD_10032005_0956) +#define FUSION_TUPLE_FORWARD_10032005_0956 + +#include +#include + +namespace boost { namespace fusion +{ + struct void_; + + template < + BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( + FUSION_MAX_VECTOR_SIZE, typename T, void_) + > + struct tuple; +}} + +#endif diff --git a/include/boost/fusion/tuple/tuple_tie.hpp b/include/boost/fusion/tuple/tuple_tie.hpp new file mode 100644 index 00000000..2c5ed4cc --- /dev/null +++ b/include/boost/fusion/tuple/tuple_tie.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + 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) +==============================================================================*/ +#ifndef BOOST_PP_IS_ITERATING +#if !defined(FUSION_TUPLE_TIE_10032005_0846) +#define FUSION_TUPLE_TIE_10032005_0846 + +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ +#define BOOST_FUSION_REF(z, n, data) BOOST_PP_CAT(T, n)& + +#define BOOST_PP_FILENAME_1 +#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) +#include BOOST_PP_ITERATE() + +#undef BOOST_FUSION_REF + +}} + +#endif +#else // defined(BOOST_PP_IS_ITERATING) +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocessor vertical repetition code +// +/////////////////////////////////////////////////////////////////////////////// + +#define N BOOST_PP_ITERATION() + + template + inline tuple + tie(BOOST_PP_ENUM_BINARY_PARAMS(N, T, & _)) + { + return tuple( + BOOST_PP_ENUM_PARAMS(N, _)); + } + +#undef N +#endif // defined(BOOST_PP_IS_ITERATING) +