diff --git a/include/boost/intrusive/detail/utilities.hpp b/include/boost/intrusive/detail/utilities.hpp index ad81dc2..ab974ff 100644 --- a/include/boost/intrusive/detail/utilities.hpp +++ b/include/boost/intrusive/detail/utilities.hpp @@ -46,7 +46,7 @@ struct internal_base_hook_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; @@ -63,7 +63,7 @@ struct internal_any_hook_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; @@ -81,7 +81,7 @@ struct external_value_traits_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; @@ -92,7 +92,7 @@ struct external_bucket_traits_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index d8605aa..8f016f7 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -187,7 +187,7 @@ struct store_hash_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; @@ -204,7 +204,7 @@ struct optimize_multikey_bool struct two_or_three {one _[2 + Add];}; template static one test(...); template static two_or_three - test (detail::bool_* = 0); + test (int); static const std::size_t value = sizeof(test(0)); }; diff --git a/test/smart_ptr.hpp b/test/smart_ptr.hpp index dd945a8..70e4371 100644 --- a/test/smart_ptr.hpp +++ b/test/smart_ptr.hpp @@ -34,9 +34,9 @@ struct reinterpret_cast_tag {}; struct empty_type{}; template -struct random_it -: public boost::iterator +struct random_it +: public boost::iterator { typedef const T* const_pointer; typedef const T& const_reference; @@ -108,25 +108,25 @@ class smart_ptr public: //Public Functions //!Constructor from raw pointer (allows "0" pointer conversion). Never throws. - explicit smart_ptr(pointer ptr = 0) + smart_ptr(pointer ptr = 0) : m_ptr(ptr) {} //!Constructor from other pointer. Never throws. template - smart_ptr(T *ptr) + smart_ptr(T *ptr) : m_ptr(ptr) {} - //!Constructor from other smart_ptr + //!Constructor from other smart_ptr smart_ptr(const smart_ptr& ptr) : m_ptr(ptr.m_ptr) {} - //!Constructor from other smart_ptr. If pointers of pointee types are + //!Constructor from other smart_ptr. If pointers of pointee types are //!convertible, offset_ptrs will be convertibles. Never throws. template - smart_ptr(const smart_ptr &ptr) + smart_ptr(const smart_ptr &ptr) : m_ptr(ptr.m_ptr) {} @@ -159,16 +159,16 @@ class smart_ptr { return m_ptr; } //!Pointer-like -> operator. It can return 0 pointer. Never throws. - pointer operator->() const + pointer operator->() const { return this->get(); } - //!Dereferencing operator, if it is a null smart_ptr behavior + //!Dereferencing operator, if it is a null smart_ptr behavior //! is undefined. Never throws. - reference operator* () const + reference operator* () const { return *(this->get()); } //!Indexing operator. Never throws. - reference operator[](std::ptrdiff_t idx) const + reference operator[](std::ptrdiff_t idx) const { return this->get()[idx]; } //!Assignment from pointer (saves extra conversion). Never throws. @@ -179,18 +179,18 @@ class smart_ptr smart_ptr& operator= (const smart_ptr & pt) { m_ptr = pt.m_ptr; return *this; } - //!Assignment from related smart_ptr. If pointers of pointee types + //!Assignment from related smart_ptr. If pointers of pointee types //! are assignable, offset_ptrs will be assignable. Never throws. template smart_ptr& operator= (const smart_ptr & pt) { m_ptr = pt.m_ptr; return *this; } - + //!smart_ptr + std::ptrdiff_t. Never throws. - smart_ptr operator+ (std::ptrdiff_t offset) const + smart_ptr operator+ (std::ptrdiff_t offset) const { return smart_ptr(this->get()+offset); } //!smart_ptr - std::ptrdiff_t. Never throws. - smart_ptr operator- (std::ptrdiff_t offset) const + smart_ptr operator- (std::ptrdiff_t offset) const { return smart_ptr(this->get()-offset); } //!smart_ptr += std::ptrdiff_t. Never throws. @@ -202,7 +202,7 @@ class smart_ptr { m_ptr -= offset; return *this; } //!++smart_ptr. Never throws. - smart_ptr& operator++ (void) + smart_ptr& operator++ (void) { ++m_ptr; return *this; } //!smart_ptr++. Never throws. @@ -210,7 +210,7 @@ class smart_ptr { smart_ptr temp(*this); ++*this; return temp; } //!--smart_ptr. Never throws. - smart_ptr& operator-- (void) + smart_ptr& operator-- (void) { --m_ptr; return *this; } //!smart_ptr--. Never throws. @@ -218,16 +218,16 @@ class smart_ptr { smart_ptr temp(*this); --*this; return temp; } //!safe bool conversion operator. Never throws. - operator unspecified_bool_type() const + operator unspecified_bool_type() const { return this->get()? &self_t::unspecified_bool_type_func : 0; } - //!Not operator. Not needed in theory, but improves portability. + //!Not operator. Not needed in theory, but improves portability. //!Never throws. bool operator! () const { return this->get() == 0; } /* friend void swap (smart_ptr &pt, smart_ptr &pt2) - { + { value_type *ptr = pt.get(); pt = pt2; pt2 = ptr; @@ -237,67 +237,67 @@ class smart_ptr //!smart_ptr == smart_ptr. Never throws. template -inline bool operator== (const smart_ptr &pt1, +inline bool operator== (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() == pt2.get(); } //!smart_ptr != smart_ptr. Never throws. template -inline bool operator!= (const smart_ptr &pt1, +inline bool operator!= (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() != pt2.get(); } //!smart_ptr < smart_ptr. Never throws. template -inline bool operator< (const smart_ptr &pt1, +inline bool operator< (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() < pt2.get(); } //!smart_ptr <= smart_ptr. Never throws. template -inline bool operator<= (const smart_ptr &pt1, +inline bool operator<= (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() <= pt2.get(); } //!smart_ptr > smart_ptr. Never throws. template -inline bool operator> (const smart_ptr &pt1, +inline bool operator> (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() > pt2.get(); } //!smart_ptr >= smart_ptr. Never throws. template -inline bool operator>= (const smart_ptr &pt1, +inline bool operator>= (const smart_ptr &pt1, const smart_ptr &pt2) { return pt1.get() >= pt2.get(); } -//!operator<< -template -inline std::basic_ostream & operator<< +//!operator<< +template +inline std::basic_ostream & operator<< (std::basic_ostream & os, smart_ptr const & p) { return os << p.get(); } -//!operator>> -template -inline std::basic_istream & operator>> +//!operator>> +template +inline std::basic_istream & operator>> (std::basic_istream & os, smart_ptr & p) { Y * tmp; return os >> tmp; p = tmp; } -//!std::ptrdiff_t + smart_ptr +//!std::ptrdiff_t + smart_ptr template inline smart_ptr operator+(std::ptrdiff_t diff, const smart_ptr& right) { return right + diff; } -//!smart_ptr - smart_ptr +//!smart_ptr - smart_ptr template inline std::ptrdiff_t operator- (const smart_ptr &pt, const smart_ptr &pt2) { return pt.get()- pt2.get(); } -//!swap specialization +//!swap specialization template -inline void swap (smart_ptr &pt, +inline void swap (smart_ptr &pt, smart_ptr &pt2) -{ +{ typename smart_ptr::value_type *ptr = pt.get(); pt = pt2; pt2 = ptr; @@ -310,35 +310,35 @@ inline T* get_pointer(const smart_ptr & p) { return p.get(); } //!Simulation of static_cast between pointers. Never throws. -template -inline smart_ptr +template +inline smart_ptr static_pointer_cast(smart_ptr const & r) -{ - return smart_ptr(r, detail::static_cast_tag()); +{ + return smart_ptr(r, detail::static_cast_tag()); } //!Simulation of const_cast between pointers. Never throws. -template +template inline smart_ptrconst_pointer_cast(smart_ptr const & r) -{ - return smart_ptr(r, detail::const_cast_tag()); +{ + return smart_ptr(r, detail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. Never throws. -template -inline smart_ptr +template +inline smart_ptr dynamic_pointer_cast(smart_ptr const & r) -{ +{ return smart_ptr - (r, detail::dynamic_cast_tag()); + (r, detail::dynamic_cast_tag()); } //!Simulation of reinterpret_cast between pointers. Never throws. -template +template inline smart_ptr reinterpret_pointer_cast(smart_ptr const & r) -{ - return smart_ptr(r, detail::reinterpret_cast_tag()); +{ + return smart_ptr(r, detail::reinterpret_cast_tag()); } } //namespace intrusive {