summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/config/test/boost_no_unified_init.ipp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/config/test/boost_no_unified_init.ipp
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/config/test/boost_no_unified_init.ipp')
-rw-r--r--src/boost/libs/config/test/boost_no_unified_init.ipp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/boost/libs/config/test/boost_no_unified_init.ipp b/src/boost/libs/config/test/boost_no_unified_init.ipp
new file mode 100644
index 000000000..428c8f43d
--- /dev/null
+++ b/src/boost/libs/config/test/boost_no_unified_init.ipp
@@ -0,0 +1,59 @@
+// Copyright (C) 2011 John Maddock
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/config for most recent version.
+
+// MACRO: BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+// TITLE: C++0x unified initialization syntax unavailable
+// DESCRIPTION: The compiler does not support C++0x unified initialization syntax: see http://en.wikipedia.org/wiki/C%2B%2B0x#Uniform_initialization
+
+#include <string>
+
+namespace boost_no_cxx11_unified_initialization_syntax {
+
+struct BasicStruct
+{
+ int x;
+ double y;
+};
+
+struct AltStruct
+{
+public:
+ AltStruct(int x, double y) : x_{x}, y_{y} {}
+ int X() const { return x_; }
+ double Y() const { return y_; }
+private:
+ int x_;
+ double y_;
+};
+
+struct IdString
+{
+ std::string name;
+ int identifier;
+ bool operator == (const IdString& other)
+ {
+ return identifier == other.identifier && name == other.name;
+ }
+};
+
+IdString get_string()
+{
+ return {"SomeName", 4}; //Note the lack of explicit type.
+}
+
+int test()
+{
+ BasicStruct var1{5, 3.2};
+ AltStruct var2{2, 4.3};
+ (void) var1;
+ (void) var2;
+
+ IdString id{"SomeName", 4};
+ return id == get_string() ? 0 : 1;
+}
+
+}