1 |
|
---|
2 | #include <boost/parameter.hpp>
|
---|
3 |
|
---|
4 | namespace foo {
|
---|
5 |
|
---|
6 | BOOST_PARAMETER_NAME(arg1)
|
---|
7 | BOOST_PARAMETER_NAME(arg2)
|
---|
8 |
|
---|
9 | template <class Tag>
|
---|
10 | struct base {
|
---|
11 | template <class ArgPack>
|
---|
12 | base(ArgPack const & args)
|
---|
13 | : val1(args[_arg1])
|
---|
14 | , val2(args[_arg2])
|
---|
15 | {}
|
---|
16 |
|
---|
17 | int val1,val2;
|
---|
18 | };
|
---|
19 |
|
---|
20 | template <class Tag>
|
---|
21 | struct derived : base<Tag> {
|
---|
22 | BOOST_PARAMETER_CONSTRUCTOR(
|
---|
23 | derived, (base<Tag>), tag,
|
---|
24 | (optional (arg1,int,1) (arg2,int,2)))
|
---|
25 | };
|
---|
26 |
|
---|
27 | } /* foo */
|
---|
28 |
|
---|
29 | struct default_ {};
|
---|
30 |
|
---|
31 | int main(int argc, char * arg[]) {
|
---|
32 | foo::derived<default_> instance();
|
---|
33 | return 0;
|
---|
34 | }
|
---|
35 |
|
---|