114 #ifndef LIB_META_VIRTUAL_COPY_SUPPORT_H 115 #define LIB_META_VIRTUAL_COPY_SUPPORT_H 120 #include <type_traits> 129 using std::is_move_constructible;
130 using std::is_copy_constructible;
131 using std::is_copy_assignable;
141 template<
class IFA,
class BASE = EmptyBase>
148 virtual void copyInto (
void* targetStorage)
const =0;
149 virtual void moveInto (
void* targetStorage) =0;
150 virtual void copyInto (IFA& target)
const =0;
151 virtual void moveInto (IFA& target) =0;
156 template<
class I,
class D,
class B =I>
161 copyInto (
void*)
const override 163 throw error::Logic{
"Copy construction invoked but target is noncopyable"};
167 moveInto (
void*)
override 169 throw error::Logic{
"Move construction invoked but target is noncopyable"};
173 copyInto (I&)
const override 175 throw error::Logic{
"Assignment invoked but target is not assignable"};
179 moveInto (I&)
override 181 throw error::Logic{
"Assignment invoked but target is not assignable"};
186 template<
class I,
class D,
class B =I>
191 copyInto (
void*)
const override 193 throw error::Logic{
"Copy construction invoked but target allows only move construction"};
197 moveInto (
void* targetStorage)
override 199 D& src =
static_cast<D&
> (*this);
200 new(targetStorage) D(move(src));
205 template<
class I,
class D,
class B =I>
210 copyInto (
void* targetStorage)
const override 212 D
const& src =
static_cast<D const&
> (*this);
213 new(targetStorage) D(src);
218 template<
class I,
class D,
class B =I>
223 copyInto (I& target)
const override 225 D& t = D::downcast(target);
226 D
const& s =
static_cast<D const&
> (*this);
231 moveInto (I& target)
override 233 D& t = D::downcast(target);
234 D& s =
static_cast<D&
> (*this);
246 : __and_<is_move_constructible<X>
247 ,__not_<is_copy_constructible<X>>
248 ,__not_<is_copy_assignable<X>>
254 : __and_<is_move_constructible<X>
255 ,is_copy_constructible<X>
256 ,__not_<is_copy_assignable<X>>
262 : __and_<is_move_constructible<X>
263 ,is_copy_constructible<X>
264 ,is_copy_assignable<X>
275 template<
class X,
class SEL=
void>
278 template<
class I,
class D,
class B =I>
285 template<
class I,
class D,
class B =I>
292 template<
class I,
class D,
class B =I>
299 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).