File indexing completed on 2025-09-17 08:45:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_POLY_COLLECTION_VARIANT_COLLECTION_HPP
0010 #define BOOST_POLY_COLLECTION_VARIANT_COLLECTION_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/poly_collection/variant_collection_fwd.hpp>
0017 #include <boost/mp11/list.hpp>
0018 #include <boost/poly_collection/detail/variant_model.hpp>
0019 #include <boost/poly_collection/detail/poly_collection.hpp>
0020 #include <utility>
0021
0022 namespace boost{
0023
0024 namespace poly_collection{
0025
0026 template<typename TypeList,typename Allocator>
0027 class variant_collection:
0028 public common_impl::poly_collection<
0029 mp11::mp_rename<TypeList,detail::variant_model>,Allocator>
0030 {
0031 using base_type=common_impl::poly_collection<
0032 mp11::mp_rename<TypeList,detail::variant_model>,Allocator>;
0033
0034 base_type& base()noexcept{return *this;}
0035 const base_type& base()const noexcept{return *this;}
0036
0037 public:
0038 using base_type::base_type;
0039
0040 variant_collection()=default;
0041 variant_collection(const variant_collection& x)=default;
0042 variant_collection(variant_collection&& x)=default;
0043 variant_collection& operator=(const variant_collection& x)=default;
0044 variant_collection& operator=(variant_collection&& x)=default;
0045
0046 template<typename TL,typename A>
0047 friend bool operator==(
0048 const variant_collection<TL,A>&,const variant_collection<TL,A>&);
0049 };
0050
0051 template<typename TypeList,typename Allocator>
0052 bool operator==(
0053 const variant_collection<TypeList,Allocator>& x,
0054 const variant_collection<TypeList,Allocator>& y)
0055 {
0056 return x.base()==y.base();
0057 }
0058
0059 template<typename TypeList,typename Allocator>
0060 bool operator!=(
0061 const variant_collection<TypeList,Allocator>& x,
0062 const variant_collection<TypeList,Allocator>& y)
0063 {
0064 return !(x==y);
0065 }
0066
0067
0068
0069 template<typename TypeList,typename Allocator>
0070 void swap(
0071 variant_collection<TypeList,Allocator>& x,
0072 variant_collection<TypeList,Allocator>& y)
0073 {
0074 x.swap(y);
0075 }
0076
0077 }
0078
0079 using poly_collection::variant_collection;
0080
0081 }
0082
0083 #endif