105 #ifndef LIB_META_VIRTUAL_COPY_SUPPORT_H 106 #define LIB_META_VIRTUAL_COPY_SUPPORT_H 111 #include <type_traits> 120 using std::is_move_constructible;
121 using std::is_copy_constructible;
122 using std::is_copy_assignable;
132 template<
class IFA,
class BASE = EmptyBase>
139 virtual void copyInto (
void* targetStorage)
const =0;
140 virtual void moveInto (
void* targetStorage) =0;
141 virtual void copyInto (IFA& target)
const =0;
142 virtual void moveInto (IFA& target) =0;
147 template<
class I,
class D,
class B =I>
152 copyInto (
void*)
const override 154 throw error::Logic{
"Copy construction invoked but target is noncopyable"};
158 moveInto (
void*)
override 160 throw error::Logic{
"Move construction invoked but target is noncopyable"};
164 copyInto (I&)
const override 166 throw error::Logic{
"Assignment invoked but target is not assignable"};
170 moveInto (I&)
override 172 throw error::Logic{
"Assignment invoked but target is not assignable"};
177 template<
class I,
class D,
class B =I>
182 copyInto (
void*)
const override 184 throw error::Logic{
"Copy construction invoked but target allows only move construction"};
188 moveInto (
void* targetStorage)
override 190 D& src =
static_cast<D&
> (*this);
191 new(targetStorage) D(move(src));
196 template<
class I,
class D,
class B =I>
201 copyInto (
void* targetStorage)
const override 203 D
const& src =
static_cast<D const&
> (*this);
204 new(targetStorage) D(src);
209 template<
class I,
class D,
class B =I>
214 copyInto (I& target)
const override 216 D& t = D::downcast(target);
217 D
const& s =
static_cast<D const&
> (*this);
222 moveInto (I& target)
override 224 D& t = D::downcast(target);
225 D& s =
static_cast<D&
> (*this);
237 : __and_<is_move_constructible<X>
238 ,__not_<is_copy_constructible<X>>
239 ,__not_<is_copy_assignable<X>>
245 : __and_<is_move_constructible<X>
246 ,is_copy_constructible<X>
247 ,__not_<is_copy_assignable<X>>
253 : __and_<is_move_constructible<X>
254 ,is_copy_constructible<X>
255 ,is_copy_assignable<X>
266 template<
class X,
class SEL=
void>
269 template<
class I,
class D,
class B =I>
276 template<
class I,
class D,
class B =I>
283 template<
class I,
class D,
class B =I>
290 template<
class I,
class D,
class B =I>
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera's exception hierarchy.
Lumiera error handling (C++ interface).