Improve vacpp support.
[boost.git] / boost / boost / spirit / fusion / sequence / tie.hpp
blob68e180300e0915911e2c386da98d2896485893b8
1 /*=============================================================================
2 Copyright (c) 1999-2003 Jaakko Järvi
3 Copyright (c) 2001-2003 Joel de Guzman
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 #if !defined(FUSION_SEQUENCE_TIE_HPP)
10 #define FUSION_SEQUENCE_TIE_HPP
12 #include <boost/ref.hpp>
13 #include <boost/preprocessor/repetition/enum.hpp>
14 #include <boost/preprocessor/repetition/enum_params.hpp>
15 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
16 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
17 #include <boost/spirit/fusion/sequence/tuple.hpp>
19 namespace boost { namespace fusion
21 // Swallows any assignment (by Doug Gregor)
22 namespace detail
24 struct swallow_assign
26 template<typename T>
27 swallow_assign const&
28 operator=(const T&) const
30 return *this;
35 // "ignore" allows tuple positions to be ignored when using "tie".
36 detail::swallow_assign const ignore = detail::swallow_assign();
38 #define FUSION_REFERENCE_TYPE(z, n, data) \
39 BOOST_PP_CAT(T, n)&
41 #define FUSION_TIE(z, n, _) \
43 template <BOOST_PP_ENUM_PARAMS(n, typename T)> \
44 inline tuple<BOOST_PP_ENUM(n, FUSION_REFERENCE_TYPE, _)> \
45 tie(BOOST_PP_ENUM_BINARY_PARAMS(n, T, & _)) \
46 { \
47 return tuple<BOOST_PP_ENUM(n, FUSION_REFERENCE_TYPE, _)>( \
48 BOOST_PP_ENUM_PARAMS(n, _)); \
51 BOOST_PP_REPEAT_FROM_TO(1, FUSION_MAX_TUPLE_SIZE, FUSION_TIE, _)
53 #undef FUSION_REFERENCE_TYPE
54 #undef FUSION_TIE
58 #endif