Loading cmake/Config.cmake +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ # setup version numbers set(VERSION_MAJOR 0) set(VERSION_MINOR 8) set(VERSION_PATCH 2) set(VERSION_PATCH 4) set(VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") message("Project version: ${VERSION_STR}") Loading include/camp/detail/issmartpointer.hpp +34 −34 Original line number Diff line number Diff line Loading @@ -35,56 +35,56 @@ #include <camp/detail/yesnotype.hpp> #include <boost/utility/enable_if.hpp> #include <type_traits> #include <memory> namespace camp { namespace detail template<class T> T* get_pointer(T *p) { return p; } template<class T> T* get_pointer(std::unique_ptr<T> const& p) { return p.get(); } template<class T> T* get_pointer(std::shared_ptr<T> const& p) { return p.get(); } namespace detail { /** * \brief Utility class which tells at compile-time if a type T is a smart pointer to a type U * * To detect a smart pointer type, we check using SFINAE if T implements an operator -> returning a U* */ template <typename T, typename U> struct IsSmartPointer { enum {value = (!std::is_pointer<T>::value && !std::is_same<T, U>::value) }; enum {value = false}; }; } // namespace detail } // namespace camp namespace boost { /** * \brief Specialization of boost::get_pointer for all smart pointer types (const version) * * This function is specialized for every type T for which IsSmartPointer<T> is true. It makes * the stored value available for all boost algorithms (especially for boost::bind). */ template <template <typename> class T, typename U> U* get_pointer(const T<U>& obj, typename enable_if<camp::detail::IsSmartPointer<T<U>, U> >::type* = 0) template <typename T, typename U> struct IsSmartPointer<std::unique_ptr<T>, U> { return obj.get(); } enum {value = true}; }; /** * \brief Specialization of boost::get_pointer for all smart pointer types (non-const version) * * This function is specialized for every type T for which IsSmartPointer<T> is true. It makes * the stored value available for all boost algorithms (especially for boost::bind). */ template <template <typename> class T, typename U> U* get_pointer(T<U>& obj, typename enable_if<camp::detail::IsSmartPointer<T<U>, U> >::type* = 0) template <typename T, typename U> struct IsSmartPointer<std::shared_ptr<T>, U> { return obj.get(); } enum {value = true}; }; } // namespace boost } // namespace detail } // namespace camp #endif // CAMP_DETAIL_ISSMARTPOINTER_HPP include/camp/detail/objecttraits.hpp +4 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ struct ObjectTraits<T*> { enum { isWritable = !boost::is_const<T>::value, isWritable = !std::is_const<T>::value, isRef = true }; Loading @@ -113,7 +113,7 @@ struct ObjectTraits<T<U>, typename boost::enable_if<IsSmartPointer<T<U>, U> >::t { enum { isWritable = !boost::is_const<U>::value, isWritable = !std::is_const<U>::value, isRef = true }; Loading @@ -122,7 +122,7 @@ struct ObjectTraits<T<U>, typename boost::enable_if<IsSmartPointer<T<U>, U> >::t typedef typename RawType<U>::Type DataType; static RefReturnType get(void* pointer) {return static_cast<U*>(pointer);} static PointerType getPointer(T<U> value) {return boost::get_pointer(value);} static PointerType getPointer(T<U> value) {return get_pointer(value);} }; /* Loading @@ -149,7 +149,7 @@ struct ObjectTraits<T&, typename boost::disable_if<boost::is_pointer<typename Ob { enum { isWritable = !boost::is_const<T>::value, isWritable = !std::is_const<T>::value, isRef = true }; Loading test/property.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ namespace PropertyTest const int p6; std::string p7_impl; std::string* p7; MyEnum p8_impl; const MyEnum* p8; boost::shared_ptr<MyType> p9; std::shared_ptr<MyType> p9; // ***** member functions ***** bool p10; bool getP10() {return p10;} Loading Loading
cmake/Config.cmake +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ # setup version numbers set(VERSION_MAJOR 0) set(VERSION_MINOR 8) set(VERSION_PATCH 2) set(VERSION_PATCH 4) set(VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") message("Project version: ${VERSION_STR}") Loading
include/camp/detail/issmartpointer.hpp +34 −34 Original line number Diff line number Diff line Loading @@ -35,56 +35,56 @@ #include <camp/detail/yesnotype.hpp> #include <boost/utility/enable_if.hpp> #include <type_traits> #include <memory> namespace camp { namespace detail template<class T> T* get_pointer(T *p) { return p; } template<class T> T* get_pointer(std::unique_ptr<T> const& p) { return p.get(); } template<class T> T* get_pointer(std::shared_ptr<T> const& p) { return p.get(); } namespace detail { /** * \brief Utility class which tells at compile-time if a type T is a smart pointer to a type U * * To detect a smart pointer type, we check using SFINAE if T implements an operator -> returning a U* */ template <typename T, typename U> struct IsSmartPointer { enum {value = (!std::is_pointer<T>::value && !std::is_same<T, U>::value) }; enum {value = false}; }; } // namespace detail } // namespace camp namespace boost { /** * \brief Specialization of boost::get_pointer for all smart pointer types (const version) * * This function is specialized for every type T for which IsSmartPointer<T> is true. It makes * the stored value available for all boost algorithms (especially for boost::bind). */ template <template <typename> class T, typename U> U* get_pointer(const T<U>& obj, typename enable_if<camp::detail::IsSmartPointer<T<U>, U> >::type* = 0) template <typename T, typename U> struct IsSmartPointer<std::unique_ptr<T>, U> { return obj.get(); } enum {value = true}; }; /** * \brief Specialization of boost::get_pointer for all smart pointer types (non-const version) * * This function is specialized for every type T for which IsSmartPointer<T> is true. It makes * the stored value available for all boost algorithms (especially for boost::bind). */ template <template <typename> class T, typename U> U* get_pointer(T<U>& obj, typename enable_if<camp::detail::IsSmartPointer<T<U>, U> >::type* = 0) template <typename T, typename U> struct IsSmartPointer<std::shared_ptr<T>, U> { return obj.get(); } enum {value = true}; }; } // namespace boost } // namespace detail } // namespace camp #endif // CAMP_DETAIL_ISSMARTPOINTER_HPP
include/camp/detail/objecttraits.hpp +4 −4 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ struct ObjectTraits<T*> { enum { isWritable = !boost::is_const<T>::value, isWritable = !std::is_const<T>::value, isRef = true }; Loading @@ -113,7 +113,7 @@ struct ObjectTraits<T<U>, typename boost::enable_if<IsSmartPointer<T<U>, U> >::t { enum { isWritable = !boost::is_const<U>::value, isWritable = !std::is_const<U>::value, isRef = true }; Loading @@ -122,7 +122,7 @@ struct ObjectTraits<T<U>, typename boost::enable_if<IsSmartPointer<T<U>, U> >::t typedef typename RawType<U>::Type DataType; static RefReturnType get(void* pointer) {return static_cast<U*>(pointer);} static PointerType getPointer(T<U> value) {return boost::get_pointer(value);} static PointerType getPointer(T<U> value) {return get_pointer(value);} }; /* Loading @@ -149,7 +149,7 @@ struct ObjectTraits<T&, typename boost::disable_if<boost::is_pointer<typename Ob { enum { isWritable = !boost::is_const<T>::value, isWritable = !std::is_const<T>::value, isRef = true }; Loading
test/property.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ namespace PropertyTest const int p6; std::string p7_impl; std::string* p7; MyEnum p8_impl; const MyEnum* p8; boost::shared_ptr<MyType> p9; std::shared_ptr<MyType> p9; // ***** member functions ***** bool p10; bool getP10() {return p10;} Loading