Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/variant/test/test4.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: 1.2 KB
Line 
1//-----------------------------------------------------------------------------
2// boost-libs variant/test/test4.cpp source file
3// See http://www.boost.org for updates, documentation, and revision history.
4//-----------------------------------------------------------------------------
5//
6// Copyright (c) 2003
7// Eric Friedman, Itay Maman
8//
9// Distributed under the Boost Software License, Version 1.0. (See
10// accompanying file LICENSE_1_0.txt or copy at
11// http://www.boost.org/LICENSE_1_0.txt)
12
13#include "boost/test/minimal.hpp"
14#include "boost/variant.hpp"
15
16#include "jobs.h"
17
18#include <string>
19
20struct class_a;
21
22using boost::variant;
23
24typedef variant<std::string, class_a, float> var_type_1;
25typedef variant<std::string, class_a, short> var_type_2;
26
27#include "class_a.h"
28
29int test_main(int , char* [])
30{
31   using namespace boost;
32
33   var_type_1 v1;
34   var_type_2 v2;
35
36   v1 = class_a();
37   verify(v1, spec<class_a>(), "[V] class_a(5511)");
38
39   verify(v2, spec<std::string>(), "[V] ");
40
41   v2 = "abcde";
42   verify(v2, spec<std::string>(), "[V] abcde");
43
44   v2 = v1;
45   verify(v2, spec<class_a>(), "[V] class_a(5511)");
46
47   v2 = 5;
48   v1 = v2;
49
50   return boost::exit_success;
51}
Note: See TracBrowser for help on using the repository browser.