summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/parameter/test/literate/namespaces1.cpp
blob: 4d5ff786cadd13b9f2242b776178dcc56f338915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <boost/parameter.hpp>
#include <iostream>

namespace lib {

    BOOST_PARAMETER_NAME(name)
    BOOST_PARAMETER_NAME(index)

    BOOST_PARAMETER_FUNCTION(
        (int), f, tag, (optional (name,*,"bob")(index,(int),1))
    )
    {
        std::cout << name << ":" << index << std::endl;
        return index;
    }
}

#include <boost/core/lightweight_test.hpp>

using lib::_name;
using lib::_index;

int main()
{
    int x = lib::f(_name = "jill", _index = 1);
    BOOST_TEST_EQ(x, 1);
    return boost::report_errors();
}