-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace gcc's normal_iterator with boost/stl_interfaces/iterator_inte…
…rface
- Loading branch information
1 parent
09a1750
commit a6c6fa3
Showing
7 changed files
with
1,170 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (C) 2020 T. Zachary Laine | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
#ifndef BOOST_STL_INTERFACES_CONFIG_HPP | ||
#define BOOST_STL_INTERFACES_CONFIG_HPP | ||
|
||
// Included for definition of __cpp_lib_concepts. | ||
#include <iterator> | ||
|
||
#if defined(__cpp_lib_concepts) && defined(__cpp_lib_ranges) && !defined(BOOST_STL_INTERFACES_DISABLE_CONCEPTS) | ||
#define BOOST_STL_INTERFACES_USE_CONCEPTS 1 | ||
#else | ||
#define BOOST_STL_INTERFACES_USE_CONCEPTS 0 | ||
#endif | ||
|
||
#if defined(__cpp_explicit_this_parameter) && BOOST_STL_INTERFACES_USE_CONCEPTS && \ | ||
!defined(BOOST_STL_INTERFACES_DISABLE_DEDUCED_THIS) | ||
#define BOOST_STL_INTERFACES_USE_DEDUCED_THIS 1 | ||
#else | ||
#define BOOST_STL_INTERFACES_USE_DEDUCED_THIS 0 | ||
#endif | ||
|
||
// The inline namespaces v1, v2, and v3 represent C++14, C++20, and C++23 and | ||
// later, respectively. v1 is inline for standards before C++20, and v2 is | ||
// inline for C++20 and later. Note that this only applies to code for which | ||
// multiple vI namespace alternatives exist. For example, some instances of | ||
// the v1 namespace may still be inline, if there is no v2 version of its | ||
// contents. | ||
#if !BOOST_STL_INTERFACES_USE_CONCEPTS && !BOOST_STL_INTERFACES_USE_DEDUCED_THIS | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V1 inline namespace v1 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V2 namespace v2 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V3 namespace v3 | ||
#elif BOOST_STL_INTERFACES_USE_CONCEPTS && !BOOST_STL_INTERFACES_USE_DEDUCED_THIS | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V1 namespace v1 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V2 inline namespace v2 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V3 namespace v3 | ||
#else | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V1 namespace v1 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V2 namespace v2 | ||
#define BOOST_STL_INTERFACES_NAMESPACE_V3 inline namespace v3 | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright (C) 2019 T. Zachary Laine | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
#ifndef BOOST_STL_INTERFACES_FWD_HPP | ||
#define BOOST_STL_INTERFACES_FWD_HPP | ||
|
||
#include <Beman/Optional26/detail/stl_interfaces/config.hpp> | ||
|
||
#if BOOST_STL_INTERFACES_USE_CONCEPTS | ||
#include <ranges> | ||
#endif | ||
#if defined(__cpp_lib_three_way_comparison) | ||
#include <compare> | ||
#endif | ||
|
||
#ifndef BOOST_STL_INTERFACES_DOXYGEN | ||
|
||
#if defined(_MSC_VER) || defined(__GNUC__) && __GNUC__ < 8 | ||
#define BOOST_STL_INTERFACES_NO_HIDDEN_FRIEND_CONSTEXPR | ||
#define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR | ||
#else | ||
#define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr | ||
#endif | ||
|
||
#if defined(__GNUC__) && __GNUC__ < 9 | ||
#define BOOST_STL_INTERFACES_CONCEPT concept bool | ||
#else | ||
#define BOOST_STL_INTERFACES_CONCEPT concept | ||
#endif | ||
|
||
#endif | ||
|
||
namespace boost { | ||
namespace stl_interfaces { | ||
|
||
/** An enumeration used to indicate whether the underlying data have a | ||
contiguous or discontiguous layout when instantiating `view_interface` | ||
and `sequence_container_interface`. */ | ||
enum class element_layout : bool { discontiguous = false, contiguous = true }; | ||
|
||
BOOST_STL_INTERFACES_NAMESPACE_V1 { | ||
|
||
namespace v1_dtl { | ||
template <typename... T> | ||
using void_t = void; | ||
|
||
template <typename Iter> | ||
using iter_difference_t = typename std::iterator_traits<Iter>::difference_type; | ||
|
||
template <typename Range, typename = void> | ||
struct iterator; | ||
template <typename Range> | ||
struct iterator<Range, void_t<decltype(std::declval<Range&>().begin())>> { | ||
using type = decltype(std::declval<Range&>().begin()); | ||
}; | ||
template <typename Range> | ||
using iterator_t = typename iterator<Range>::type; | ||
|
||
template <typename Range, typename = void> | ||
struct sentinel; | ||
template <typename Range> | ||
struct sentinel<Range, void_t<decltype(std::declval<Range&>().end())>> { | ||
using type = decltype(std::declval<Range&>().end()); | ||
}; | ||
template <typename Range> | ||
using sentinel_t = typename sentinel<Range>::type; | ||
|
||
template <typename Range> | ||
using range_difference_t = iter_difference_t<iterator_t<Range>>; | ||
|
||
template <typename Range> | ||
using common_range = std::is_same<iterator_t<Range>, sentinel_t<Range>>; | ||
|
||
template <typename Range, typename = void> | ||
struct decrementable_sentinel : std::false_type {}; | ||
template <typename Range> | ||
struct decrementable_sentinel<Range, void_t<decltype(--std::declval<sentinel_t<Range>&>())>> : std::true_type {}; | ||
} // namespace v1_dtl | ||
} | ||
} // namespace stl_interfaces | ||
} // namespace boost | ||
|
||
#endif |
Oops, something went wrong.