Release 1.39.0
[boost.git] / Boost_1_39_0 / libs / test / example / cla / default_value.cpp
blob44a3bbce32a39a81c9a737e7760ac586b984bee0
1 // (C) Copyright Gennadiy Rozental 2001-2008.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
8 // Boost.Runtime.Param
9 #include <boost/test/utils/runtime/cla/named_parameter.hpp>
10 #include <boost/test/utils/runtime/cla/parser.hpp>
12 namespace rt = boost::runtime;
13 namespace cla = boost::runtime::cla;
15 // STL
16 #include <iostream>
18 int main() {
19 char* argv[] = { "basic" };
20 int argc = sizeof(argv)/sizeof(char*);
22 try {
23 cla::parser P;
25 P << cla::named_parameter<int>( "abcd" ) - ( cla::default_value = 10 );
27 P.parse( argc, argv );
29 std::cout << "abcd = " << P.get<int>( "abcd" ) << std::endl;
31 catch( rt::logic_error const& ex ) {
32 std::cout << "Logic error: " << ex.msg() << std::endl;
33 return -1;
36 return 0;
39 // EOF