return addressof & conjunction.

This commit is contained in:
Georgiy Guminov
2024-06-12 16:35:43 +03:00
committed by Georgy Guminov
parent 3b3d162575
commit c02def8acf
2 changed files with 21 additions and 19 deletions

View File

@ -17,6 +17,7 @@
#include <cstddef> #include <cstddef>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/type_traits/is_complete.hpp> #include <boost/type_traits/is_complete.hpp>
#include <boost/type_traits/conjunction.hpp>
#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) #if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS)
#include <iterator> #include <iterator>
#endif #endif
@ -57,56 +58,56 @@ no_type check(...);
template< typename T > template< typename T >
struct is_iterator_impl : struct is_iterator_impl :
public boost::integral_constant< public std::integral_constant<
bool, bool,
sizeof(has_iterator_category_detail::check< T >(0)) == sizeof(has_iterator_category_detail::yes_type) sizeof(has_iterator_category_detail::check<T>(0)) == sizeof(has_iterator_category_detail::yes_type)
> >
{ {
}; };
template< typename T > template< typename T >
struct is_iterator_impl< T* > : struct is_iterator_impl< T* > :
std::integral_constant< public boost::conjunction<
bool boost::is_complete<T>,
, boost::is_complete<T>::value && !std::is_function<T>::value std::integral_constant<bool, !std::is_function<T>::value>
> >::type
{ {
}; };
template< typename T, typename U > template< typename T, typename U >
struct is_iterator_impl< T U::* > : struct is_iterator_impl< T U::* > :
public boost::false_type public std::false_type
{ {
}; };
template< typename T > template< typename T >
struct is_iterator_impl< T& > : struct is_iterator_impl<T&> :
public boost::false_type public std::false_type
{ {
}; };
template< typename T, std::size_t N > template< typename T, std::size_t N >
struct is_iterator_impl< T[N] > : struct is_iterator_impl< T[N] > :
public boost::false_type public std::false_type
{ {
}; };
#if !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) #if !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE)
template< typename T > template< typename T >
struct is_iterator_impl< T[] > : struct is_iterator_impl< T[] > :
public boost::false_type public std::false_type
{ {
}; };
template< > template< >
struct is_iterator_impl< void > : struct is_iterator_impl< void > :
public boost::false_type public std::false_type
{ {
}; };
template< > template< >
struct is_iterator_impl< void* > : struct is_iterator_impl< void* > :
public boost::false_type public std::false_type
{ {
}; };
#endif // !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) #endif // !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE)

View File

@ -8,10 +8,11 @@
#define BOOST_ITERATOR_FACADE_23022003THW_HPP #define BOOST_ITERATOR_FACADE_23022003THW_HPP
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/iterator/interoperable.hpp> #include <boost/iterator/interoperable.hpp>
#include <boost/iterator/iterator_traits.hpp> #include <boost/iterator/iterator_traits.hpp>
#include <boost/iterator/iterator_categories.hpp> #include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/detail/facade_iterator_category.hpp> #include <boost/iterator/detail/facade_iterator_category.hpp>
#include <boost/mpl/eval_if.hpp> #include <boost/mpl/eval_if.hpp>
@ -169,7 +170,7 @@ namespace iterators {
// Provides (r++)->foo() // Provides (r++)->foo()
value_type* operator->() const value_type* operator->() const
{ {
return std::addressof(stored_value); return boost::addressof(stored_value);
} }
private: private:
@ -269,7 +270,7 @@ namespace iterators {
// Provides (r++)->foo() // Provides (r++)->foo()
value_type* operator->() const value_type* operator->() const
{ {
return std::addressof(dereference_proxy.stored_value); return boost::addressof(dereference_proxy.stored_value);
} }
private: private:
@ -371,10 +372,10 @@ namespace iterators {
struct proxy struct proxy
{ {
explicit proxy(Reference const & x) : m_ref(x) {} explicit proxy(Reference const & x) : m_ref(x) {}
Reference* operator->() { return std::addressof(m_ref); } Reference* operator->() { return boost::addressof(m_ref); }
// This function is needed for MWCW and BCC, which won't call // This function is needed for MWCW and BCC, which won't call
// operator-> again automatically per 13.3.1.2 para 8 // operator-> again automatically per 13.3.1.2 para 8
operator Reference*() { return std::addressof(m_ref); } operator Reference*() { return boost::addressof(m_ref); }
Reference m_ref; Reference m_ref;
}; };
typedef proxy result_type; typedef proxy result_type;
@ -390,7 +391,7 @@ namespace iterators {
typedef Pointer result_type; typedef Pointer result_type;
static result_type apply(T& x) static result_type apply(T& x)
{ {
return std::addressof(x); return boost::addressof(x);
} }
}; };