Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
poly_copyable.hpp
Go to the documentation of this file.
1/*
2 Copyright 2006-2007 Adobe Systems Incorporated
3 Distributed under the Boost Software License - Version 1.0 (see the accompanying file LICENSE
4 or a copy at https://stlab.github.io/adobe_source_libraries/licenses.html)
5
6 Author(s): Mat Marcus
7*/
8
9/**************************************************************************************************/
10
11#ifndef ADOBE_POLY_COPYABLE_HPP
12#define ADOBE_POLY_COPYABLE_HPP
13
14#include <adobe/config.hpp>
15
16#include <boost/concept_check.hpp>
17
18#include <adobe/poly.hpp>
19
20/**************************************************************************************************/
21
22namespace adobe {
23
27
28/**************************************************************************************************/
29
36
37template <typename T>
38struct poly_copyable_instance : optimized_storage_type<T, poly_copyable_interface>::type {
40
44 BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept);
45
49 poly_copyable_instance(const T& x) : base_t(x) {}
50
54 poly_copyable_instance(move_from<poly_copyable_instance> x)
55 : base_t(move_from<base_t>(x.source)) {}
56};
57
58/**************************************************************************************************/
59
65
66struct copyable : poly_base<poly_copyable_interface, poly_copyable_instance> {
68
72 template <typename T>
73 explicit copyable(const T& s) : base_t(s) {}
74
78 copyable(move_from<copyable> x) : base_t(move_from<base_t>(x.source)) {}
79};
80
81
82/**************************************************************************************************/
83
84#if !defined(ADOBE_NO_DOCUMENTATION)
85
86/**************************************************************************************************/
87
89
90/**************************************************************************************************/
91
92#endif
93
94/**************************************************************************************************/
95
96} // namespace adobe
97
98/**************************************************************************************************/
99
100#endif
poly<foo> will be a runtime polymorphic value type wrapper modelling a concept represented by foo
Definition poly.hpp:403
poly< copyable > poly_copyable_t
copyable(const T &s)
copyable(move_from< copyable > x)
poly_base< poly_copyable_interface, poly_copyable_instance > base_t
Authors of poly concept representatives must derive their instance class from this....
Definition poly.hpp:238
optimized_storage_type< T, poly_copyable_interface >::type base_t
BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept)
poly_copyable_instance(move_from< poly_copyable_instance > x)