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 56 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
20a5331
Remove BOOST_STATIC_ASSERT & BOOST_NOEXCEPT
gogagum Jun 9, 2024
50e118c
facade_iterator_category, type_traits, same_as
gogagum Jun 9, 2024
fad6cd6
type_traits
gogagum Jun 9, 2024
125b315
function_output_iterator type_traits
gogagum Jun 9, 2024
3b42b72
indirect_iterator type_traits
gogagum Jun 9, 2024
ab8600f
indirect_reference
gogagum Jun 9, 2024
9b20b2c
pointee
gogagum Jun 9, 2024
b0a67ca
counting_iterator
gogagum Jun 9, 2024
0f976e8
filter_iterator
gogagum Jun 9, 2024
f299047
minimum_category
gogagum Jun 9, 2024
6aad725
iterator_concepts
gogagum Jun 9, 2024
84885ea
iterator_facade
gogagum Jun 9, 2024
cab8440
function_input_iterator
gogagum Jun 9, 2024
b889bd4
More std.
gogagum Jun 9, 2024
ae97f33
Example
gogagum Jun 9, 2024
76def86
new_iterator_tests
gogagum Jun 9, 2024
0360929
iterator_tests
gogagum Jun 9, 2024
5076b54
test/pointee
gogagum Jun 9, 2024
e927fe7
is_*
gogagum Jun 9, 2024
b644d2c
test
gogagum Jun 9, 2024
5ad5d51
zip_iterator
gogagum Jun 9, 2024
ed96afb
config_def
gogagum Jun 9, 2024
fafb68b
transform_iterator
gogagum Jun 9, 2024
80d5883
iterator_facade
gogagum Jun 9, 2024
3150019
interoperable
gogagum Jun 9, 2024
26d7f7c
facade_iterator_category
gogagum Jun 9, 2024
11c6da5
iterator_categories
gogagum Jun 9, 2024
85a6cad
iterator_facade
gogagum Jun 9, 2024
c2cee6f
enable_if
gogagum Jun 9, 2024
67060a0
Require SFINAE & decltype.
gogagum Jun 10, 2024
49d76ac
CXX11
gogagum Jun 10, 2024
829a20d
Return BOOST_NOEXCEPT
gogagum Jun 10, 2024
d2672c7
Replace move with static_cast
gogagum Jun 11, 2024
6178ab3
Return boost::addressof.
gogagum Jun 11, 2024
c69c46f
Omitted.
gogagum Jun 11, 2024
49c9f0f
Return is iterator CXX17 test.
gogagum Jun 12, 2024
8e8ca36
Partially add static_assert messages.
gogagum Jun 12, 2024
f102fb1
Finish with static_assert messages.
gogagum Jun 12, 2024
5e919eb
Make macro more readable.
gogagum Jun 12, 2024
c329a9b
return addressof.
gogagum Jun 12, 2024
2af7a36
return conjuction.
gogagum Jun 12, 2024
e4cc900
abstract conjunction.
gogagum Jun 12, 2024
165440d
Fix gcc 4.6 build.
gogagum Jun 12, 2024
e49506b
Remove workaround include.
gogagum Jun 23, 2024
8f73f2a
Fixes. Remove some Boost.MPL usages.
gogagum Oct 19, 2024
7908131
Fix compilation.
gogagum Oct 19, 2024
4f040a9
Fix compilation. [2]
gogagum Oct 19, 2024
6184e61
Fix compilation. [3] (+ std::true_type & std::false_type)
gogagum Oct 19, 2024
bef9f98
Fix compilation. [4]
gogagum Oct 19, 2024
8f31c27
Return macro.
gogagum Oct 20, 2024
0e892b2
Removed unused include.
gogagum Oct 26, 2024
33b33b1
Correct static_assert messages.
gogagum Oct 26, 2024
df5df6a
Remove BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
gogagum Oct 26, 2024
7937fb9
Remove useless static asserts.
gogagum Oct 26, 2024
7b231fe
Correct static_assert messages.
gogagum Oct 26, 2024
e05b5e2
Fix messages & replace is_standard_layout with is_copy_constructible.
gogagum Dec 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)
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
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: 11 additions & 16 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 @@ -39,7 +34,7 @@ namespace detail
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);
static_assert(std::is_integral<char>::value, "std::is_integral<char> is expected to be true");
gogagum marked this conversation as resolved.
Show resolved Hide resolved

# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS

Expand All @@ -50,19 +45,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 +111,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 +120,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 +220,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
8 changes: 4 additions & 4 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 @@ -92,7 +92,7 @@
# 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,13 +104,13 @@
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))
#if !defined(BOOST_MSVC) && (defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE))
# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
#endif
gogagum marked this conversation as resolved.
Show resolved Hide resolved

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

This file was deleted.

50 changes: 23 additions & 27 deletions include/boost/iterator/detail/facade_iterator_category.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@

# include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic
# include <boost/mpl/and.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/eval_if.hpp>
# include <boost/mpl/identity.hpp>

# include <boost/static_assert.hpp>

# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_const.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <type_traits>

# include <boost/iterator/detail/config_def.hpp> // try to keep this last

Expand Down Expand Up @@ -84,24 +78,24 @@ template <class Traversal, class ValueParam, class Reference>
struct iterator_facade_default_category
: mpl::eval_if<
mpl::and_<
gogagum marked this conversation as resolved.
Show resolved Hide resolved
is_reference<Reference>
, is_convertible<Traversal,forward_traversal_tag>
std::is_reference<Reference>
, std::is_convertible<Traversal,forward_traversal_tag>
>
, mpl::eval_if<
is_convertible<Traversal,random_access_traversal_tag>
std::is_convertible<Traversal,random_access_traversal_tag>
, mpl::identity<std::random_access_iterator_tag>
, mpl::if_<
is_convertible<Traversal,bidirectional_traversal_tag>
std::is_convertible<Traversal,bidirectional_traversal_tag>
, std::bidirectional_iterator_tag
, std::forward_iterator_tag
>
>
, typename mpl::eval_if<
mpl::and_<
is_convertible<Traversal, single_pass_traversal_tag>
std::is_convertible<Traversal, single_pass_traversal_tag>

// check for readability
, is_convertible<Reference, ValueParam>
, std::is_convertible<Reference, ValueParam>
>
, mpl::identity<std::input_iterator_tag>
, mpl::identity<Traversal>
Expand All @@ -114,15 +108,15 @@ struct iterator_facade_default_category
template <class T>
struct is_iterator_category
: mpl::or_<
is_convertible<T,std::input_iterator_tag>
, is_convertible<T,std::output_iterator_tag>
std::is_convertible<T,std::input_iterator_tag>
, std::is_convertible<T,std::output_iterator_tag>
>
{
};

template <class T>
struct is_iterator_traversal
: is_convertible<T,incrementable_traversal_tag>
: std::is_convertible<T,incrementable_traversal_tag>
{};

//
Expand All @@ -138,17 +132,19 @@ struct iterator_category_with_traversal
// Make sure this isn't used to build any categories where
// convertibility to Traversal is redundant. Should just use the
// Category element in that case.
BOOST_STATIC_ASSERT((
!is_convertible<
static_assert(
!std::is_convertible<
typename iterator_category_to_traversal<Category>::type
, Traversal
>::value));
>::value,
"Category transformed to corresponding traversal must be convertible to Traversal."
);

BOOST_STATIC_ASSERT(is_iterator_category<Category>::value);
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
BOOST_STATIC_ASSERT(!is_iterator_traversal<Category>::value);
static_assert(is_iterator_category<Category>::value, "Category must be an STL iterator category.");
static_assert(!is_iterator_category<Traversal>::value, "Traversal must not be an STL iterator category.");
static_assert(!is_iterator_traversal<Category>::value, "Category must not be a traversal tag.");
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
BOOST_STATIC_ASSERT(is_iterator_traversal<Traversal>::value);
static_assert(is_iterator_traversal<Traversal>::value, "Traversal must be a traversal tag.");
# endif
};

Expand All @@ -157,17 +153,17 @@ struct iterator_category_with_traversal
template <class Traversal, class ValueParam, class Reference>
struct facade_iterator_category_impl
{
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
static_assert(!is_iterator_category<Traversal>::value, "Traversal must not be an STL iterator category.");

typedef typename iterator_facade_default_category<
Traversal,ValueParam,Reference
>::type category;

typedef typename mpl::if_<
is_same<
typedef typename std::conditional<
std::is_same<
Traversal
, typename iterator_category_to_traversal<category>::type
>
>::value
, category
, iterator_category_with_traversal<category,Traversal>
>::type type;
Expand Down
Loading