Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/variant/test/test6.cpp @ 29

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

updated boost from 1_33_1 to 1_34_1

File size: 1.5 KB
Line 
1//-----------------------------------------------------------------------------
2// boost-libs variant/test/test6.cpp header 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 <iostream>
17
18#include "jobs.h"
19
20
21//Just Another Class
22struct jac
23{
24   jac() { }
25   jac(int ) { }
26   jac(const char* ) { }
27};
28
29std::ostream& operator<<(std::ostream& out, const jac& )
30{
31   out << "jac ";
32   return out;
33}
34
35
36void run()
37{
38   using boost::variant;
39
40   variant<jac, int, double*, const double*> v1;   
41   variant<int, char, double*, const double*, char*> v2;
42
43   v1 = v2;
44
45   verify(v1, spec<int>());
46   verify(v2, spec<int>());
47
48   verify_not(v1, spec<jac>());
49   verify_not(v1, spec<double*>());
50   verify_not(v1, spec<const double*>());
51
52   verify_not(v2, spec<char>());
53   verify_not(v2, spec<double*>());
54   verify_not(v2, spec<const double*>());
55   verify_not(v2, spec<char*>());
56
57
58   variant<jac, const double*> v3;
59   variant<int, unsigned char, double*> v4;
60
61   v3 = v4;
62   verify(v3, spec<jac>());
63   verify(v4, spec<int>());
64   verify_not(v4, spec<unsigned char>());
65}
66
67
68
69int test_main(int , char* [])
70{
71   run();
72   return 0;
73}
74
Note: See TracBrowser for help on using the repository browser.