diff --git a/include/boost/spirit/fusion/sequence/append_view.hpp b/include/boost/spirit/fusion/sequence/append_view.hpp new file mode 100644 index 000000000..3c84418af --- /dev/null +++ b/include/boost/spirit/fusion/sequence/append_view.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2003 Joel de Guzman + + Use, modification and distribution is subject to the Boost Software + License, 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_APPEND_VIEW_HPP) +#define FUSION_SEQUENCE_APPEND_VIEW_HPP + +#include +#include + +namespace boost { namespace fusion +{ + template + struct append_view : joint_view > + { + append_view(View& view, T const& val) + : joint_view >(view, held) + , held(val) {} + single_view held; + }; +}} + +#endif + + diff --git a/include/boost/spirit/fusion/sequence/cons.hpp b/include/boost/spirit/fusion/sequence/cons.hpp new file mode 100755 index 000000000..ad0e84a65 --- /dev/null +++ b/include/boost/spirit/fusion/sequence/cons.hpp @@ -0,0 +1,69 @@ +/*============================================================================= + Copyright (c) 2003 Joel de Guzman + Copyright (c) 2004 Peder Holt + 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_SEQUENCE_CONS_HPP) +#define FUSION_SEQUENCE_CONS_HPP + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct void_t; + + struct cons_tag; + + struct nil : sequence_base + { + typedef cons_tag tag; + typedef void_t car_type; + typedef void_t cdr_type; + }; + + template + struct cons : sequence_base > + { + typedef cons_tag tag; + typedef typename call_traits::value_type car_type; + typedef Cdr cdr_type; + + cons() + : car(), cdr() {} + + explicit cons( + typename call_traits::param_type car_ + , typename call_traits::param_type cdr_ = Cdr()) + : car(car_), cdr(cdr_) {} + + car_type car; + cdr_type cdr; + }; + + template + inline cons + make_cons(Car const& car) + { + return cons(car); + } + + template + inline cons + make_cons(Car const& car, Cdr const& cdr) + { + return cons(car, cdr); + } +}} + +#endif + diff --git a/include/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp b/include/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp new file mode 100755 index 000000000..4e03f937c --- /dev/null +++ b/include/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp @@ -0,0 +1,101 @@ +/*============================================================================= + Copyright (c) 2003 Joel de Guzman + Copyright (c) 2004 Peder Holt + 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_SEQUENCE_DETAIL_CONS_BEGIN_END_TRAITS_HPP) +#define FUSION_SEQUENCE_DETAIL_CONS_BEGIN_END_TRAITS_HPP + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct nil; + + struct cons_tag; + + template + struct cons; + + template + struct cons_iterator; + + namespace cons_detail + { + template + struct begin_traits_impl + { + typedef cons_iterator type; + + static type + call(Cons& t) + { + return type(t); + } + }; + + template + struct end_traits_impl + { + typedef cons_iterator< + typename mpl::if_, nil const, nil>::type> + type; + + static type + call(Cons& t) + { + FUSION_RETURN_DEFAULT_CONSTRUCTED; + } + }; + } + + namespace meta + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply : cons_detail::begin_traits_impl + {}; + }; + + template + struct end_impl; + + template <> + struct end_impl + { + template + struct apply : cons_detail::end_traits_impl + {}; + }; + } +}} + +namespace boost { namespace mpl +{ + template + struct begin_impl; + + template + struct end_impl; + + template <> + struct begin_impl + : fusion::meta::begin_impl {}; + + template <> + struct end_impl + : fusion::meta::end_impl {}; +}} + +#endif