1 // Copyright Daniel Wallin 2010. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef LUABIND_VECTOR_100629_HPP
6 # define LUABIND_VECTOR_100629_HPP
10 # include <boost/mpl/fold.hpp>
11 # include <boost/mpl/begin_end_fwd.hpp>
12 # include <boost/mpl/front_fwd.hpp>
13 # include <boost/mpl/size_fwd.hpp>
17 // This is used to specify function signatures, both in the user interface and
18 // in the implementation. In the C++03 version this used to be any MPL forward
19 // sequence. For backward compatibility reasons we provide a conversion layer
20 // from an MPL sequence.
21 template <class... Args
>
29 template <class... Args
>
30 struct vector_iterator
;
32 template <class Head
, class... Tail
>
33 struct vector_iterator
<Head
, Tail
...>
36 typedef vector_iterator
<Tail
...> next
;
40 struct vector_iterator
<>
45 } // namespace luabind
47 namespace boost
{ namespace mpl
50 // MPL sequence adaption layer to ease the transition to C++0x.
52 template <class... Args
>
53 struct begin
<luabind::vector
<Args
...> >
55 typedef luabind::detail::vector_iterator
<Args
...> type
;
58 template <class... Args
>
59 struct end
<luabind::vector
<Args
...> >
61 typedef luabind::detail::vector_iterator
<> type
;
64 template <class... Args
>
65 struct size
<luabind::vector
<Args
...> >
66 : long_
<sizeof...(Args
)>
69 template <class Head
, class... Tail
>
70 struct front
<luabind::vector
<Head
, Tail
...> >
75 template <class Head
, class... Tail
>
76 struct deref
<luabind::detail::vector_iterator
<Head
, Tail
...> >
81 }} // namespace boost::mpl
83 # endif // LUABIND_CPP0x
85 namespace luabind
{ namespace detail
92 template <class V
, class T
>
95 template <class... Args
, class T
>
96 struct apply
<vector
<Args
...>, T
>
98 typedef vector
<Args
..., T
> type
;
102 template <class Sequence
>
104 : boost::mpl::fold
<Sequence
, vector
<>, append_vector
>
107 template <class... Args
>
108 struct as_vector
<vector
<Args
...> >
110 typedef vector
<Args
...> type
;
113 # else // LUABIND_CPP0x
115 template <class Sequence
>
118 typedef Sequence type
;
123 }} // namespace luabind::detail
125 #endif // LUABIND_VECTOR_100629_HPP