]> git.donarmstrong.com Git - rsem.git/blob - boost/fusion/view/single_view/single_view.hpp
Updated boost to v1.55.0
[rsem.git] / boost / fusion / view / single_view / single_view.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2011 Eric Niebler
4
5     Distributed under the Boost Software License, Version 1.0. (See accompanying 
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(BOOST_FUSION_SINGLE_VIEW_05052005_0335)
9 #define BOOST_FUSION_SINGLE_VIEW_05052005_0335
10
11 #include <boost/fusion/support/detail/access.hpp>
12 #include <boost/fusion/support/detail/as_fusion_element.hpp>
13 #include <boost/fusion/support/sequence_base.hpp>
14 #include <boost/fusion/view/single_view/single_view_iterator.hpp>
15 #include <boost/fusion/view/single_view/detail/at_impl.hpp>
16 #include <boost/fusion/view/single_view/detail/begin_impl.hpp>
17 #include <boost/fusion/view/single_view/detail/end_impl.hpp>
18 #include <boost/fusion/view/single_view/detail/size_impl.hpp>
19 #include <boost/fusion/view/single_view/detail/value_at_impl.hpp>
20 #include <boost/mpl/bool.hpp>
21 #include <boost/mpl/int.hpp>
22 #include <boost/config.hpp>
23
24 #if defined (BOOST_MSVC)
25 #  pragma warning(push)
26 #  pragma warning (disable: 4512) // assignment operator could not be generated.
27 #endif
28
29 namespace boost { namespace fusion
30 {
31     struct single_view_tag;
32     struct random_access_traversal_tag;
33     struct fusion_sequence_tag;
34
35     template <typename T>
36     struct single_view : sequence_base<single_view<T> >
37     {
38         typedef single_view_tag fusion_tag;
39         typedef fusion_sequence_tag tag; // this gets picked up by MPL
40         typedef random_access_traversal_tag category;
41         typedef mpl::true_ is_view;
42         typedef mpl::int_<1> size;
43         typedef T value_type;
44
45         single_view()
46             : val() {}
47
48         explicit single_view(typename detail::call_param<T>::type in_val)
49             : val(in_val) {}
50
51         value_type val;
52     };
53     
54     template <typename T>
55     inline single_view<typename detail::as_fusion_element<T>::type>
56     make_single_view(T const& v)
57     {
58         return single_view<typename detail::as_fusion_element<T>::type>(v);
59     }
60 }}
61
62 #if defined (BOOST_MSVC)
63 #  pragma warning(pop)
64 #endif
65
66 #endif
67
68