-
Notifications
You must be signed in to change notification settings - Fork 7
Add ext_iterator_interface_compat, a portable alternative to iterator_interface.
#13
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,6 @@ | ||
| #ifndef BEMAN_ITERATOR_INTERFACE26_CONFIG_HPP | ||
| #define BEMAN_ITERATOR_INTERFACE26_CONFIG_HPP | ||
|
|
||
| #cmakedefine01 BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS() | ||
|
|
||
| #endif | ||
49 changes: 49 additions & 0 deletions
49
include/beman/iterator_interface26/detail/stl_interfaces/config.hpp
This file contains hidden or 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,49 @@ | ||
| // include/beman/optional26/detail/stl_interfaces/config.hpp -*-C++-*- | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| // Copyright (C) 2020 T. Zachary Laine | ||
camio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // | ||
| // 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 BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONFIG_HPP | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONFIG_HPP | ||
|
|
||
| // Included for definition of __cpp_lib_concepts. | ||
| #include <iterator> | ||
|
|
||
| #if defined(__cpp_lib_concepts) && defined(__cpp_lib_ranges) && \ | ||
| !defined(BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DISABLE_CONCEPTS) | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS 1 | ||
| #else | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS 0 | ||
| #endif | ||
|
|
||
| #if defined(__cpp_explicit_this_parameter) && BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS && \ | ||
| !defined(BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DISABLE_DEDUCED_THIS) | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS 1 | ||
| #else | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_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 !BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS && !BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 inline namespace v1 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V2 namespace v2 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V3 namespace v3 | ||
| #elif BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS && !BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 namespace v1 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V2 inline namespace v2 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V3 namespace v3 | ||
| #else | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 namespace v1 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V2 namespace v2 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V3 inline namespace v3 | ||
| #endif | ||
|
|
||
| #endif | ||
88 changes: 88 additions & 0 deletions
88
include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp
This file contains hidden or 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,88 @@ | ||
| // include/beman/optional26/detail/stl_interfaces/fwd.hpp -*-C++-*- | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| // 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 BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_FWD_HPP | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_FWD_HPP | ||
|
|
||
| #include <beman/iterator_interface26/detail/stl_interfaces/config.hpp> | ||
|
|
||
| #if BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS | ||
| #include <ranges> | ||
| #endif | ||
| #if defined(__cpp_lib_three_way_comparison) | ||
| #include <compare> | ||
| #endif | ||
|
|
||
| #ifndef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN | ||
|
|
||
| #if defined(_MSC_VER) || defined(__GNUC__) && __GNUC__ < 8 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NO_HIDDEN_FRIEND_CONSTEXPR | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR | ||
| #else | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr | ||
| #endif | ||
|
|
||
| #if defined(__GNUC__) && __GNUC__ < 9 | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONCEPT concept bool | ||
| #else | ||
| #define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONCEPT concept | ||
| #endif | ||
|
|
||
| #endif | ||
|
|
||
| namespace beman::iterator_interface26::detail { | ||
| 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 }; | ||
|
|
||
| BEMAN_ITERATOR_INTERFACE26_DETAIL_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 beman::optional26::detail | ||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.