stlab.adobe.com Adobe Systems Incorporated

poly_copyable.hpp

Go 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     Author(s): Mat Marcus
00007 */
00008 
00009 /*************************************************************************************************/
00010 
00011 #ifndef ADOBE_POLY_COPYABLE_HPP
00012 #define ADOBE_POLY_COPYABLE_HPP
00013 
00014 #include <adobe/config.hpp>
00015 
00016 #include <boost/concept_check.hpp>
00017 
00018 #include <adobe/poly.hpp>
00019 
00020 /*************************************************************************************************/
00021 
00022 namespace adobe {  
00023 
00028 /*************************************************************************************************/
00029 
00037 template <typename T>
00038 struct poly_copyable_instance : optimized_storage_type<T, poly_copyable_interface>::type
00039 {
00040     typedef typename optimized_storage_type<T, poly_copyable_interface>::type base_t;
00041 
00045     BOOST_CLASS_REQUIRE(T, boost, CopyConstructibleConcept);
00046 
00050     poly_copyable_instance(const T& x) : base_t(x) {}
00051 
00055     poly_copyable_instance(move_from<poly_copyable_instance> x) 
00056         : base_t(move_from<base_t>(x.source)) {}
00057 
00058 }; 
00059 
00060 /*************************************************************************************************/
00061 
00068 struct copyable : poly_base<poly_copyable_interface, poly_copyable_instance>
00069 {
00070     typedef poly_base<poly_copyable_interface, poly_copyable_instance> base_t;
00071 
00075     template <typename T>
00076     explicit copyable(const T& s)
00077       : base_t(s)  { }
00078 
00082     copyable(move_from<copyable> x)
00083         : base_t(move_from<base_t>(x.source)) {}
00084 };
00085 
00086 
00087 /*************************************************************************************************/
00088 
00089 #if !defined(ADOBE_NO_DOCUMENTATION)
00090 
00091 /*************************************************************************************************/
00092 
00093 typedef poly<copyable> poly_copyable_t;
00094 
00095 /*************************************************************************************************/
00096 
00097 #endif
00098 
00099 /*************************************************************************************************/
00100 
00101 } // namespace adobe
00102 
00103 /*************************************************************************************************/
00104 
00105 #endif

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