summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/flyweight/test/heavy_objects.hpp
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/flyweight/test/heavy_objects.hpp
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.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/flyweight/test/heavy_objects.hpp')
-rw-r--r--src/boost/libs/flyweight/test/heavy_objects.hpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/boost/libs/flyweight/test/heavy_objects.hpp b/src/boost/libs/flyweight/test/heavy_objects.hpp
new file mode 100644
index 000000000..142e96b7c
--- /dev/null
+++ b/src/boost/libs/flyweight/test/heavy_objects.hpp
@@ -0,0 +1,106 @@
+/* Classes for Boost.Flyweight key-value tests.
+ *
+ * Copyright 2006-2014 Joaquin M Lopez Munoz.
+ * Distributed under 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/flyweight for library home page.
+ */
+
+#ifndef BOOST_FLYWEIGHT_TEST_HEAVY_OBJECTS_HPP
+#define BOOST_FLYWEIGHT_TEST_HEAVY_OBJECTS_HPP
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
+#include <boost/noncopyable.hpp>
+#include <iosfwd>
+#include <string>
+
+struct texture
+{
+ texture(const std::string& str_=""):str(str_){}
+
+ friend bool operator==(
+ const texture& x,const texture& y){return x.str==y.str;}
+ friend bool operator< (
+ const texture& x,const texture& y){return x.str< y.str;}
+ friend bool operator!=(
+ const texture& x,const texture& y){return x.str!=y.str;}
+ friend bool operator> (
+ const texture& x,const texture& y){return x.str> y.str;}
+ friend bool operator>=(
+ const texture& x,const texture& y){return x.str>=y.str;}
+ friend bool operator<=(
+ const texture& x,const texture& y){return x.str<=y.str;}
+
+ friend std::ostream& operator<<(std::ostream& os,const texture& x)
+ {
+ return os<<x.str;
+ }
+
+ friend std::istream& operator>>(std::istream& is,texture& x)
+ {
+ return is>>x.str;
+ }
+
+ std::string str;
+};
+
+struct from_texture_to_string
+{
+ const std::string& operator()(const texture& x)const{return x.str;}
+};
+
+struct factorization:private boost::noncopyable
+{
+ factorization(int n_=0):n(n_){}
+
+ friend bool operator==(
+ const factorization& x,const factorization& y){return x.n==y.n;}
+ friend bool operator< (
+ const factorization& x,const factorization& y){return x.n< y.n;}
+ friend bool operator!=(
+ const factorization& x,const factorization& y){return x.n!=y.n;}
+ friend bool operator> (
+ const factorization& x,const factorization& y){return x.n> y.n;}
+ friend bool operator>=(
+ const factorization& x,const factorization& y){return x.n>=y.n;}
+ friend bool operator<=(
+ const factorization& x,const factorization& y){return x.n<=y.n;}
+
+ friend std::ostream& operator<<(std::ostream& os,const factorization& x)
+ {
+ return os<<x.n;
+ }
+
+ friend std::istream& operator>>(std::istream& is,factorization& x)
+ {
+ return is>>x.n;
+ }
+
+ int n;
+};
+
+#if !defined(BOOST_NO_EXCEPTIONS)
+struct throwing_value_exception{};
+
+struct throwing_value
+{
+ throwing_value():n(0){}
+ throwing_value(const throwing_value&){throw throwing_value_exception();}
+ throwing_value(int){throw throwing_value_exception();}
+
+ int n;
+};
+
+struct from_throwing_value_to_int
+{
+ const int& operator()(const throwing_value& x)const{return x.n;}
+};
+#endif
+
+#endif