Imported existing code
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_BEGIN_IMPL_05052005_0305)
|
||||
#define FUSION_BEGIN_IMPL_05052005_0305
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_tag;
|
||||
|
||||
template <typename T>
|
||||
struct single_view_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<single_view_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef single_view_iterator<Sequence> type;
|
||||
|
||||
static type
|
||||
call(Sequence& s)
|
||||
{
|
||||
return type(s);
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_DEREF_IMPL_05052005_0258)
|
||||
#define FUSION_DEREF_IMPL_05052005_0258
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<single_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::value_type type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.val;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_END_IMPL_05052005_0332)
|
||||
#define FUSION_END_IMPL_05052005_0332
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_tag;
|
||||
|
||||
template <typename T>
|
||||
struct single_view_iterator_end;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<single_view_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef single_view_iterator_end<Sequence> type;
|
||||
|
||||
static type
|
||||
call(Sequence&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_NEXT_IMPL_05052005_0331)
|
||||
#define FUSION_NEXT_IMPL_05052005_0331
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator_end;
|
||||
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct next_impl;
|
||||
|
||||
template <>
|
||||
struct next_impl<single_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef single_view_iterator_end<
|
||||
typename Iterator::single_view_type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_VALUE_IMPL_05052005_0324)
|
||||
#define FUSION_VALUE_IMPL_05052005_0324
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_of_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_impl<single_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::single_view_type single_view_type;
|
||||
typedef typename single_view_type::value_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_SINGLE_VIEW_05052005_0335)
|
||||
#define FUSION_SINGLE_VIEW_05052005_0335
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/view/single_view/single_view_iterator.hpp>
|
||||
#include <boost/fusion/view/single_view/detail/begin_impl.hpp>
|
||||
#include <boost/fusion/view/single_view/detail/end_impl.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_tag;
|
||||
struct forward_traversal_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
template <typename T>
|
||||
struct single_view : sequence_base<single_view<T> >
|
||||
{
|
||||
typedef single_view_tag fusion_tag;
|
||||
typedef fusion_sequence_tag tag; // this gets picked up by MPL
|
||||
typedef forward_traversal_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<T>::type val)
|
||||
: val(val) {}
|
||||
|
||||
value_type val;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline single_view<typename detail::as_fusion_element<T>::type>
|
||||
make_single_view(T const& v)
|
||||
{
|
||||
return single_view<typename detail::as_fusion_element<T>::type>(v);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
|
||||
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(FUSION_SINGLE_VIEW_ITERATOR_05052005_0340)
|
||||
#define FUSION_SINGLE_VIEW_ITERATOR_05052005_0340
|
||||
|
||||
#include <boost/fusion/support/detail/access.hpp>
|
||||
#include <boost/fusion/support/iterator_base.hpp>
|
||||
#include <boost/fusion/view/single_view/detail/deref_impl.hpp>
|
||||
#include <boost/fusion/view/single_view/detail/next_impl.hpp>
|
||||
#include <boost/fusion/view/single_view/detail/value_of_impl.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
struct forward_traversal_tag;
|
||||
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator_end
|
||||
: iterator_base<single_view_iterator_end<SingleView> >
|
||||
{
|
||||
typedef single_view_iterator_tag fusion_tag;
|
||||
typedef forward_traversal_tag category;
|
||||
};
|
||||
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator
|
||||
: iterator_base<single_view_iterator<SingleView> >
|
||||
{
|
||||
typedef single_view_iterator_tag fusion_tag;
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user