]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/poly_collection/test/base_types.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / poly_collection / test / base_types.hpp
1 /* Copyright 2016-2017 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
5 *
6 * See http://www.boost.org/libs/poly_collection for library home page.
7 */
8
9 #ifndef BOOST_POLY_COLLECTION_TEST_BASE_TYPES_HPP
10 #define BOOST_POLY_COLLECTION_TEST_BASE_TYPES_HPP
11
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15
16 #include <boost/poly_collection/base_collection.hpp>
17
18 namespace base_types{
19
20 struct base
21 {
22 virtual ~base()=default;
23 virtual int operator()(int)const=0;
24 };
25
26 struct derived1 final:base
27 {
28 derived1(int n):n{n}{}
29 derived1(derived1&&)=default;
30 derived1(const derived1&)=delete;
31 derived1& operator=(derived1&&)=default;
32 derived1& operator=(const derived1&)=delete;
33 virtual int operator()(int)const{return n;}
34 bool operator==(const derived1& x)const{return n==x.n;}
35 int n;
36 };
37
38 struct derived2:base
39 {
40 derived2(int n):n{n}{}
41 derived2(derived2&&)=default;
42 derived2& operator=(derived2&&)=delete;
43 virtual int operator()(int x)const{return x*n;}
44 bool operator==(const derived2& x)const{return n==x.n;}
45 int n;
46 };
47
48 struct derived3:base
49 {
50 derived3():n{-1}{}
51 derived3(int n):n{n}{}
52 virtual int operator()(int x)const{return x*x*n;}
53 int n;
54 };
55
56 struct another_base
57 {
58 virtual ~another_base()=default;
59 char x[5];
60 };
61
62 struct derived4:another_base,derived3
63 {
64 using derived3::derived3;
65 virtual int operator()(int x)const{return -(this->derived3::operator()(x));}
66 bool operator==(const derived4& x)const{return n==x.n;}
67 };
68
69 struct derived5:base,another_base
70 {
71 derived5(int n):n{n}{}
72 virtual int operator()(int x)const{return x*x*x*n;}
73 int n;
74 };
75
76 using collection=boost::base_collection<base>;
77
78 using t1=derived1;
79 using t2=derived2;
80 using t3=derived3;
81 using t4=derived4;
82 using t5=derived5;
83
84 struct to_int
85 {
86 to_int(){};
87
88 template<typename F>
89 int operator()(const F& f)const{return f(1);}
90 };
91
92 } /* namespace base_types */
93
94 #endif