00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_CLONE_INCLUDE
00013 #define MTL_CLONE_INCLUDE
00014
00015 #include <boost/utility/enable_if.hpp>
00016 #include <boost/mpl/bool.hpp>
00017 #include <boost/numeric/mtl/utility/category.hpp>
00018
00019 namespace mtl {
00020
00021 struct clone_ctor {};
00022
00023 template<typename T>
00024 struct is_clonable : boost::mpl::false_
00025 { };
00026
00028
00046 template <typename T>
00047 typename boost::enable_if<is_clonable<T>, T>::type
00048 clone(const T& x)
00049 {
00050
00051 return T(x, clone_ctor());
00052 }
00053
00054
00055 template <typename T>
00056 typename boost::disable_if<is_clonable<T>, T>::type
00057 clone(const T& x)
00058 {
00059
00060 return x;
00061 }
00062
00063
00064 }
00065
00066 #endif // MTL_CLONE_INCLUDE