]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/config/test/boost_no_unified_init.ipp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / config / test / boost_no_unified_init.ipp
1 // Copyright (C) 2011 John Maddock
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 // See http://www.boost.org/libs/config for most recent version.
7
8 // MACRO: BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
9 // TITLE: C++0x unified initialization syntax unavailable
10 // DESCRIPTION: The compiler does not support C++0x unified initialization syntax: see http://en.wikipedia.org/wiki/C%2B%2B0x#Uniform_initialization
11
12 #include <string>
13
14 namespace boost_no_cxx11_unified_initialization_syntax {
15
16 struct BasicStruct
17 {
18 int x;
19 double y;
20 };
21
22 struct AltStruct
23 {
24 public:
25 AltStruct(int x, double y) : x_{x}, y_{y} {}
26 int X() const { return x_; }
27 double Y() const { return y_; }
28 private:
29 int x_;
30 double y_;
31 };
32
33 struct IdString
34 {
35 std::string name;
36 int identifier;
37 bool operator == (const IdString& other)
38 {
39 return identifier == other.identifier && name == other.name;
40 }
41 };
42
43 IdString get_string()
44 {
45 return {"SomeName", 4}; //Note the lack of explicit type.
46 }
47
48 int test()
49 {
50 BasicStruct var1{5, 3.2};
51 AltStruct var2{2, 4.3};
52 (void) var1;
53 (void) var2;
54
55 IdString id{"SomeName", 4};
56 return id == get_string() ? 0 : 1;
57 }
58
59 }