mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Spirit miniboost update to V1.33
[SVN r30505]
This commit is contained in:
28
include/boost/spirit/fusion/sequence/append_view.hpp
Normal file
28
include/boost/spirit/fusion/sequence/append_view.hpp
Normal file
@@ -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 <boost/spirit/fusion/sequence/joint_view.hpp>
|
||||
#include <boost/spirit/fusion/sequence/single_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename View, typename T>
|
||||
struct append_view : joint_view<View, single_view<T> >
|
||||
{
|
||||
append_view(View& view, T const& val)
|
||||
: joint_view<View, single_view<T> >(view, held)
|
||||
, held(val) {}
|
||||
single_view<T> held;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
69
include/boost/spirit/fusion/sequence/cons.hpp
Executable file
69
include/boost/spirit/fusion/sequence/cons.hpp
Executable file
@@ -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 <boost/call_traits.hpp>
|
||||
#include <boost/spirit/fusion/detail/access.hpp>
|
||||
#include <boost/spirit/fusion/sequence/begin.hpp>
|
||||
#include <boost/spirit/fusion/sequence/end.hpp>
|
||||
#include <boost/spirit/fusion/iterator/cons_iterator.hpp>
|
||||
#include <boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp>
|
||||
#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_t;
|
||||
|
||||
struct cons_tag;
|
||||
|
||||
struct nil : sequence_base<nil>
|
||||
{
|
||||
typedef cons_tag tag;
|
||||
typedef void_t car_type;
|
||||
typedef void_t cdr_type;
|
||||
};
|
||||
|
||||
template <typename Car, typename Cdr = nil>
|
||||
struct cons : sequence_base<cons<Car,Cdr> >
|
||||
{
|
||||
typedef cons_tag tag;
|
||||
typedef typename call_traits<Car>::value_type car_type;
|
||||
typedef Cdr cdr_type;
|
||||
|
||||
cons()
|
||||
: car(), cdr() {}
|
||||
|
||||
explicit cons(
|
||||
typename call_traits<Car>::param_type car_
|
||||
, typename call_traits<Cdr>::param_type cdr_ = Cdr())
|
||||
: car(car_), cdr(cdr_) {}
|
||||
|
||||
car_type car;
|
||||
cdr_type cdr;
|
||||
};
|
||||
|
||||
template <typename Car>
|
||||
inline cons<Car>
|
||||
make_cons(Car const& car)
|
||||
{
|
||||
return cons<Car>(car);
|
||||
}
|
||||
|
||||
template <typename Car, typename Cdr>
|
||||
inline cons<Car, Cdr>
|
||||
make_cons(Car const& car, Cdr const& cdr)
|
||||
{
|
||||
return cons<Car, Cdr>(car, cdr);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
101
include/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp
Executable file
101
include/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp
Executable file
@@ -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 <boost/spirit/fusion/detail/config.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct nil;
|
||||
|
||||
struct cons_tag;
|
||||
|
||||
template <typename Car, typename Cdr>
|
||||
struct cons;
|
||||
|
||||
template <typename Cons>
|
||||
struct cons_iterator;
|
||||
|
||||
namespace cons_detail
|
||||
{
|
||||
template <typename Cons>
|
||||
struct begin_traits_impl
|
||||
{
|
||||
typedef cons_iterator<Cons> type;
|
||||
|
||||
static type
|
||||
call(Cons& t)
|
||||
{
|
||||
return type(t);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cons>
|
||||
struct end_traits_impl
|
||||
{
|
||||
typedef cons_iterator<
|
||||
typename mpl::if_<is_const<Cons>, nil const, nil>::type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Cons& t)
|
||||
{
|
||||
FUSION_RETURN_DEFAULT_CONSTRUCTED;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<cons_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : cons_detail::begin_traits_impl<Sequence>
|
||||
{};
|
||||
};
|
||||
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<cons_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply : cons_detail::end_traits_impl<Sequence>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<fusion::cons_tag>
|
||||
: fusion::meta::begin_impl<fusion::cons_tag> {};
|
||||
|
||||
template <>
|
||||
struct end_impl<fusion::cons_tag>
|
||||
: fusion::meta::end_impl<fusion::cons_tag> {};
|
||||
}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user