1 | // Copyright Daniel Wallin, David Abrahams 2005. Use, modification and
|
---|
2 | // distribution is subject to the Boost Software License, Version 1.0. (See
|
---|
3 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
5 |
|
---|
6 | #ifndef TAGGED_ARGUMENT_050328_HPP
|
---|
7 | #define TAGGED_ARGUMENT_050328_HPP
|
---|
8 |
|
---|
9 | #include <boost/parameter/aux_/void.hpp>
|
---|
10 | #include <boost/parameter/aux_/arg_list.hpp>
|
---|
11 | #include <boost/detail/is_xxx.hpp>
|
---|
12 |
|
---|
13 | namespace boost { namespace parameter { namespace aux {
|
---|
14 |
|
---|
15 | // Holds a reference to an argument of type Arg associated with
|
---|
16 | // keyword Keyword
|
---|
17 |
|
---|
18 | template <class Keyword, class Arg>
|
---|
19 | struct tagged_argument
|
---|
20 | {
|
---|
21 | typedef Keyword key_type;
|
---|
22 | typedef Arg value_type;
|
---|
23 | typedef Arg& reference;
|
---|
24 |
|
---|
25 | tagged_argument(reference x) : value(x) {}
|
---|
26 |
|
---|
27 | // Comma operator to compose argument list without using parameters<>.
|
---|
28 | // Useful for argument lists with undetermined length.
|
---|
29 | template <class Keyword2, class Arg2>
|
---|
30 | arg_list<
|
---|
31 | tagged_argument<Keyword, Arg>
|
---|
32 | , arg_list<tagged_argument<Keyword2, Arg2> >
|
---|
33 | >
|
---|
34 | operator,(tagged_argument<Keyword2, Arg2> x) const
|
---|
35 | {
|
---|
36 | return arg_list<
|
---|
37 | tagged_argument<Keyword, Arg>
|
---|
38 | , arg_list<tagged_argument<Keyword2, Arg2> >
|
---|
39 | >(
|
---|
40 | *this
|
---|
41 | , arg_list<tagged_argument<Keyword2, Arg2> >(x, empty_arg_list())
|
---|
42 | );
|
---|
43 | }
|
---|
44 |
|
---|
45 | reference value;
|
---|
46 | };
|
---|
47 |
|
---|
48 | // Defines a metafunction, is_tagged_argument, that identifies
|
---|
49 | // tagged_argument specializations.
|
---|
50 | BOOST_DETAIL_IS_XXX_DEF(tagged_argument,tagged_argument,2)
|
---|
51 |
|
---|
52 | }}} // namespace boost::parameter::aux
|
---|
53 |
|
---|
54 | #endif // TAGGED_ARGUMENT_050328_HPP
|
---|
55 |
|
---|