]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | #include <boost/parameter.hpp> | |
3 | #include <iostream> | |
92f5a8d4 TL |
4 | |
5 | namespace lib { | |
6 | ||
7 | BOOST_PARAMETER_NAME(name) | |
8 | BOOST_PARAMETER_NAME(index) | |
9 | ||
10 | BOOST_PARAMETER_FUNCTION( | |
11 | (int), f, tag, (optional (name,*,"bob")(index,(int),1)) | |
12 | ) | |
13 | { | |
14 | std::cout << name << ":" << index << std::endl; | |
15 | return index; | |
16 | } | |
7c673cae | 17 | } |
92f5a8d4 TL |
18 | |
19 | #include <boost/core/lightweight_test.hpp> | |
20 | ||
7c673cae FG |
21 | using lib::_name; |
22 | using lib::_index; | |
23 | ||
92f5a8d4 TL |
24 | int main() |
25 | { | |
26 | int x = lib::f(_name = "jill", _index = 1); | |
27 | BOOST_TEST_EQ(x, 1); | |
28 | return boost::report_errors(); | |
29 | } | |
7c673cae | 30 |