stlab.adobe.com Adobe Systems Incorporated
poly_copyable.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/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 
22 namespace adobe {
23 
28 /*************************************************************************************************/
29 
37 template <typename T>
38 struct poly_copyable_instance : optimized_storage_type<T, poly_copyable_interface>::type
39 {
41 
45  BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept);
46 
50  poly_copyable_instance(const T& x) : base_t(x) {}
51 
56  : base_t(move_from<base_t>(x.source)) {}
57 
58 };
59 
60 /*************************************************************************************************/
61 
68 struct copyable : poly_base<poly_copyable_interface, poly_copyable_instance>
69 {
71 
75  template <typename T>
76  explicit copyable(const T& s)
77  : base_t(s) { }
78 
83  : base_t(move_from<base_t>(x.source)) {}
84 };
85 
86 
87 /*************************************************************************************************/
88 
89 #if !defined(ADOBE_NO_DOCUMENTATION)
90 
91 /*************************************************************************************************/
92 
93 typedef poly<copyable> poly_copyable_t;
94 
95 /*************************************************************************************************/
96 
97 #endif
98 
99 /*************************************************************************************************/
100 
101 } // namespace adobe
102 
103 /*************************************************************************************************/
104 
105 #endif
move_from is used for move_ctors.
Definition: move.hpp:306
"Handle" class used in poly implementation.
copyable(move_from< copyable > x)
Authors of a Concept representative F, intended as a template parameter to adobe::poly, will inherit from adobe::poly_base. The first template parameter for adobe::poly_base provides the virtual interface for the concept representative. The second template parameter for adobe::poly_base must inherit from the Concept interface representative. The author's third duty is to provide forwarding functions in a their Concept representative. See the placeable_concept.hpp header file for details.
Definition: poly.hpp:259
copyable(const T &s)
Implementation of a trivial poly interface in terms of types modeling Copyable . Used in poly
poly_copyable_instance(move_from< poly_copyable_instance > x)
Authors of adobe::poly concept representatives must derive their instance class from this...
Definition: poly.hpp:238
BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept)
poly_base< poly_copyable_interface, poly_copyable_instance > base_t
optimized_storage_type< T, poly_copyable_interface >::type base_t

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google