Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/parameter/test/maybe.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 826 bytes
Line 
1// Copyright Daniel Wallin 2006. Use, modification and distribution is
2// subject to the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#include <boost/parameter/keyword.hpp>
6#include <boost/parameter/aux_/maybe.hpp>
7#include <cassert>
8
9namespace test {
10
11BOOST_PARAMETER_KEYWORD(tag, kw)
12BOOST_PARAMETER_KEYWORD(tag, unused)
13   
14template <class Args>
15int f(Args const& args)
16{
17    return args[kw | 1.f];
18}
19
20} // namespace test
21
22int main()
23{
24    using test::kw;
25    using test::unused;
26    using test::f;
27    using boost::parameter::aux::maybe;
28
29    assert(f((kw = 0, unused = 0)) == 0);
30    assert(f(unused = 0) == 1);
31    assert(f((kw = maybe<int>(), unused = 0)) == 1);
32    assert(f((kw = maybe<int>(2), unused = 0)) == 2);
33    return 0;
34}
35
Note: See TracBrowser for help on using the repository browser.