poly_copyable.hppGo to the documentation of this file.00001 /* 00002 Copyright 2006-2007 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 00007 /*************************************************************************************************/ 00008 00009 #ifndef ADOBE_POLY_COPYABLE_HPP 00010 #define ADOBE_POLY_COPYABLE_HPP 00011 00012 #include <adobe/config.hpp> 00013 00014 #include <boost/concept_check.hpp> 00015 00016 #include <adobe/poly.hpp> 00017 00018 /*************************************************************************************************/ 00019 00020 namespace adobe { 00021 00026 /*************************************************************************************************/ 00027 00035 template <typename T> 00036 struct poly_copyable_instance : optimized_storage_type<T, poly_copyable_interface>::type 00037 { 00038 typedef typename optimized_storage_type<T, poly_copyable_interface>::type base_t; 00039 00043 BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept); 00044 00048 poly_copyable_instance(const T& x) : base_t(x) {} 00049 00053 poly_copyable_instance(move_from<poly_copyable_instance> x) 00054 : base_t(move_from<base_t>(x.source)) {} 00055 00056 }; 00057 00058 /*************************************************************************************************/ 00059 00066 struct copyable : poly_base<poly_copyable_interface, poly_copyable_instance> 00067 { 00068 typedef poly_base<poly_copyable_interface, poly_copyable_instance> base_t; 00069 00073 template <typename T> 00074 explicit copyable(const T& s) 00075 : base_t(s) { } 00076 00080 copyable(move_from<copyable> x) 00081 : base_t(move_from<base_t>(x.source)) {} 00082 }; 00083 00084 00085 /*************************************************************************************************/ 00086 00087 #if !defined(ADOBE_NO_DOCUMENTATION) 00088 00089 /*************************************************************************************************/ 00090 00091 typedef poly<copyable> poly_copyable_t; 00092 00093 /*************************************************************************************************/ 00094 00095 #endif 00096 00097 /*************************************************************************************************/ 00098 00099 } // namespace adobe 00100 00101 /*************************************************************************************************/ 00102 00103 #endif | ||||

