Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly remove pre-CXX11 workarounds. #82

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ target_link_libraries(boost_iterator
Boost::mpl
Boost::optional
Boost::smart_ptr
Boost::static_assert
Boost::type_traits
Boost::utility
)
1 change: 0 additions & 1 deletion build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ constant boost_dependencies :
/boost/mpl//boost_mpl
/boost/optional//boost_optional
/boost/smart_ptr//boost_smart_ptr
/boost/static_assert//boost_static_assert
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility ;

Expand Down
18 changes: 3 additions & 15 deletions example/node_iterator2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

# include "node.hpp"
# include <boost/iterator/iterator_facade.hpp>

# ifndef BOOST_NO_SFINAE
# include <boost/type_traits/is_convertible.hpp>
# include <boost/utility/enable_if.hpp>
# endif
# include <type_traits>

template <class Value>
class node_iter
Expand All @@ -33,21 +29,13 @@ class node_iter
template <class OtherValue>
node_iter(
node_iter<OtherValue> const& other
# ifndef BOOST_NO_SFINAE
, typename boost::enable_if<
boost::is_convertible<OtherValue*,Value*>
, typename std::enable_if<
std::is_convertible<OtherValue*,Value*>::value
, enabler
>::type = enabler()
# endif
)
: m_node(other.m_node) {}


# if !BOOST_WORKAROUND(__GNUC__, == 2)
private: // GCC2 can't grant friendship to template member functions
friend class boost::iterator_core_access;
# endif

template <class OtherValue>
bool equal(node_iter<OtherValue> const& other) const
{
Expand Down
12 changes: 3 additions & 9 deletions example/node_iterator3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

# include "node.hpp"
# include <boost/iterator/iterator_adaptor.hpp>

# ifndef BOOST_NO_SFINAE
# include <boost/type_traits/is_convertible.hpp>
# include <boost/utility/enable_if.hpp>
# endif
# include <type_traits>

template <class Value>
class node_iter
Expand Down Expand Up @@ -38,12 +34,10 @@ class node_iter
template <class OtherValue>
node_iter(
node_iter<OtherValue> const& other
# ifndef BOOST_NO_SFINAE
, typename boost::enable_if<
boost::is_convertible<OtherValue*,Value*>
, typename std::enable_if<
std::is_convertible<OtherValue*,Value*>::value
, enabler
>::type = enabler()
# endif
)
: super_t(other.base()) {}

Expand Down
2 changes: 1 addition & 1 deletion include/boost/generator_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct generator_iterator_generator

template <class Generator>
inline generator_iterator<Generator>
make_generator_iterator(Generator & gen)
make_generator_iterator(Generator& gen)
{
typedef generator_iterator<Generator> result_t;
return result_t(&gen);
Expand Down
1 change: 0 additions & 1 deletion include/boost/indirect_reference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/mpl/eval_if.hpp>
# include <boost/pointee.hpp>

Expand Down
27 changes: 10 additions & 17 deletions include/boost/iterator/counting_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
#ifndef COUNTING_ITERATOR_DWA200348_HPP
# define COUNTING_ITERATOR_DWA200348_HPP

# include <type_traits>

# include <boost/config.hpp>
# include <boost/static_assert.hpp>
# include <boost/detail/workaround.hpp>
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# include <limits>
# elif !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
# include <boost/type_traits/is_convertible.hpp>
# else
# include <boost/type_traits/is_arithmetic.hpp>
# endif
# include <boost/type_traits/is_integral.hpp>
# include <boost/type_traits/type_identity.hpp>
# include <boost/type_traits/conditional.hpp>
# include <boost/type_traits/integral_constant.hpp>
# include <boost/detail/numeric_traits.hpp>
# include <boost/iterator/iterator_adaptor.hpp>

Expand All @@ -38,8 +33,6 @@ namespace detail
template <class T>
struct is_numeric_impl
{
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);

# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS

Expand All @@ -50,19 +43,19 @@ namespace detail
# if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
BOOST_STATIC_CONSTANT(
bool, value = (
boost::is_convertible<int,T>::value
&& boost::is_convertible<T,int>::value
std::is_convertible<int,T>::value
&& std::is_convertible<T,int>::value
));
# else
BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic<T>::value);
BOOST_STATIC_CONSTANT(bool, value = std::is_arithmetic<T>::value);
# endif

# endif
};

template <class T>
struct is_numeric
: boost::integral_constant<bool, ::boost::iterators::detail::is_numeric_impl<T>::value>
: std::integral_constant<bool, ::boost::iterators::detail::is_numeric_impl<T>::value>
{};

# if defined(BOOST_HAS_LONG_LONG)
Expand Down Expand Up @@ -116,7 +109,7 @@ namespace detail
{
typedef typename detail::ia_dflt_help<
CategoryOrTraversal
, typename boost::conditional<
, typename std::conditional<
is_numeric<Incrementable>::value
, boost::type_identity<random_access_traversal_tag>
, iterator_traversal<Incrementable>
Expand All @@ -125,7 +118,7 @@ namespace detail

typedef typename detail::ia_dflt_help<
Difference
, typename boost::conditional<
, typename std::conditional<
is_numeric<Incrementable>::value
, numeric_difference<Incrementable>
, iterator_difference<Incrementable>
Expand Down Expand Up @@ -225,7 +218,7 @@ class counting_iterator
difference_type
distance_to(counting_iterator<OtherIncrementable, CategoryOrTraversal, Difference> const& y) const
{
typedef typename boost::conditional<
typedef typename std::conditional<
detail::is_numeric<Incrementable>::value
, detail::number_distance<difference_type, Incrementable, OtherIncrementable>
, detail::iterator_distance<difference_type, Incrementable, OtherIncrementable>
Expand Down
17 changes: 3 additions & 14 deletions include/boost/iterator/detail/config_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#endif

#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x5A0)) \
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x5A0)) \
|| (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
|| BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \
|| BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
Expand Down Expand Up @@ -87,12 +87,8 @@
# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types"
#endif

#if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \
|| BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile:

# if 0 // test code
#include <boost/type_traits/is_convertible.hpp>
#include <type_traits>
template <class T>
struct foo
{
Expand All @@ -104,16 +100,9 @@
T p;
};

bool x = boost::is_convertible<foo<int const*>, foo<int*> >::value;
bool x = std::is_convertible<foo<int const*>, foo<int*> >::value;
# endif

#endif


#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE))
# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#endif

# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))

// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion
Expand Down
2 changes: 0 additions & 2 deletions include/boost/iterator/detail/config_undef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//

#undef BOOST_NO_IS_CONVERTIBLE
#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE
#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#undef BOOST_NO_LVALUE_RETURN_DETECTION
#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP

Expand Down
83 changes: 0 additions & 83 deletions include/boost/iterator/detail/enable_if.hpp

This file was deleted.

Loading