From 66c6c17eed685e33b9036ab23fc6dba6af101fcf Mon Sep 17 00:00:00 2001 From: David Sankel Date: Thu, 7 Nov 2024 17:15:19 -0500 Subject: [PATCH 1/2] iterator_interface26 -> interator_interface Fixes #29 --- CMakeLists.txt | 16 ++-- README.md | 2 +- cmake/CompilerFeatureTest.cmake | 2 +- examples/CMakeLists.txt | 2 +- examples/sample.cpp | 2 +- extern/CMakeLists.txt | 2 +- .../beman/iterator_interface26/config.hpp.in | 6 +- .../detail/stl_interfaces/config.hpp | 41 +++++------ .../detail/stl_interfaces/fwd.hpp | 27 ++++--- .../stl_interfaces/iterator_interface.hpp | 73 +++++++++---------- .../iterator_interface.hpp | 20 ++--- .../iterator_interface_access.hpp | 2 +- src/beman/iterator_interface26/CMakeLists.txt | 16 ++-- .../iterator_interface.cpp | 2 +- .../iterator_interface.t.cpp | 8 +- 15 files changed, 109 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc2439b..f737673 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,32 +6,32 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") include(FetchContent) include(CompilerFeatureTest) -beman_iterator26_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS) +beman_iterator_check_deducing_this(COMPILER_SUPPORTS_DEDUCING_THIS) -option(BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS +option(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS "Make use of deducing this. Turn this off for non-conforming compilers." ${COMPILER_SUPPORTS_DEDUCING_THIS}) -option(BEMAN_ITERATOR_INTERFACE26_ENABLE_TESTING "Build beman.iterator_interface26 tests" ${PROJECT_IS_TOP_LEVEL}) +option(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING "Build beman.iterator_interface tests" ${PROJECT_IS_TOP_LEVEL}) -if(BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS AND NOT COMPILER_SUPPORTS_DEDUCING_THIS) +if(BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS AND NOT COMPILER_SUPPORTS_DEDUCING_THIS) message(WARNING "Building with deducing this support despite of the compiler's lack of support for it") endif() configure_file( - "${PROJECT_SOURCE_DIR}/include/beman/iterator_interface26/config.hpp.in" - "${PROJECT_BINARY_DIR}/include/beman/iterator_interface26/config.hpp" + "${PROJECT_SOURCE_DIR}/include/beman/iterator_interface/config.hpp.in" + "${PROJECT_BINARY_DIR}/include/beman/iterator_interface/config.hpp" @ONLY ) -if(BEMAN_ITERATOR_INTERFACE26_ENABLE_TESTING) +if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) enable_testing() endif() set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets) add_subdirectory(extern) -add_subdirectory(src/beman/iterator_interface26) +add_subdirectory(src/beman/iterator_interface) add_subdirectory(examples) include(GNUInstallDirs) diff --git a/README.md b/README.md index 3f3c504..b062b00 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Beman.iterator: C++26 Extensions for iterators +# beman.iterator\_interface: iterator creation mechanisms **Implements**: diff --git a/cmake/CompilerFeatureTest.cmake b/cmake/CompilerFeatureTest.cmake index 2480cf4..68d7a00 100644 --- a/cmake/CompilerFeatureTest.cmake +++ b/cmake/CompilerFeatureTest.cmake @@ -4,7 +4,7 @@ include(CheckCXXSourceCompiles) # Determines if the selected C++ compiler has deducing this support. Sets # 'result_var' to whether support is detected. -function(beman_iterator26_check_deducing_this result_var) +function(beman_iterator_check_deducing_this result_var) check_cxx_source_compiles( " // clang-specific check due to http://github.com/llvm/llvm-project/issues/113174 #if defined(__cpp_explicit_this_parameter) || (defined(__clang__) && __has_extension(cxx_explicit_this_parameter)) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ab4cca1..dd7dc39 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,7 +17,7 @@ foreach(EXAMPLE ${EXAMPLES}) ) # Link example with the library. - target_link_libraries(${EXAMPLE} beman.iterator_interface26) + target_link_libraries(${EXAMPLE} beman.iterator_interface) # Install . install( diff --git a/examples/sample.cpp b/examples/sample.cpp index 49a5b65..f6dd24a 100644 --- a/examples/sample.cpp +++ b/examples/sample.cpp @@ -1,4 +1,4 @@ -#include +#include #include int main() { diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 16e3bbf..04fddb0 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -1,4 +1,4 @@ -if(BEMAN_ITERATOR_INTERFACE26_ENABLE_TESTING) +if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) # Fetch GoogleTest FetchContent_Declare( googletest diff --git a/include/beman/iterator_interface26/config.hpp.in b/include/beman/iterator_interface26/config.hpp.in index b83cd27..ad99f47 100644 --- a/include/beman/iterator_interface26/config.hpp.in +++ b/include/beman/iterator_interface26/config.hpp.in @@ -1,6 +1,6 @@ -#ifndef BEMAN_ITERATOR_INTERFACE26_CONFIG_HPP -#define BEMAN_ITERATOR_INTERFACE26_CONFIG_HPP +#ifndef BEMAN_ITERATOR_INTERFACE_CONFIG_HPP +#define BEMAN_ITERATOR_INTERFACE_CONFIG_HPP -#cmakedefine01 BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS() +#cmakedefine01 BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS() #endif diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/config.hpp b/include/beman/iterator_interface26/detail/stl_interfaces/config.hpp index bc49bd2..5c202f3 100644 --- a/include/beman/iterator_interface26/detail/stl_interfaces/config.hpp +++ b/include/beman/iterator_interface26/detail/stl_interfaces/config.hpp @@ -1,4 +1,3 @@ -// include/beman/optional26/detail/stl_interfaces/config.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Copyright (C) 2020 T. Zachary Laine @@ -6,24 +5,24 @@ // 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 +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_CONFIG_HPP +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_CONFIG_HPP // Included for definition of __cpp_lib_concepts. #include #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 + !defined(BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DISABLE_CONCEPTS) +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS 1 #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS 0 +#define BEMAN_ITERATOR_INTERFACE_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 +#if defined(__cpp_explicit_this_parameter) && BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS && \ + !defined(BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DISABLE_DEDUCED_THIS) +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS 1 #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS 0 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS 0 #endif // The inline namespaces v1, v2, and v3 represent C++14, C++20, and C++23 and @@ -32,18 +31,18 @@ // 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 +#if !BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS && !BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V1 inline namespace v1 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V2 namespace v2 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V3 namespace v3 +#elif BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS && !BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V1 namespace v1 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V2 inline namespace v2 +#define BEMAN_ITERATOR_INTERFACE_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 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V1 namespace v1 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V2 namespace v2 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V3 inline namespace v3 #endif #endif diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp b/include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp index 2ff0e25..b5be8b9 100644 --- a/include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp +++ b/include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp @@ -1,4 +1,3 @@ -// include/beman/optional26/detail/stl_interfaces/fwd.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Copyright (C) 2019 T. Zachary Laine @@ -6,36 +5,36 @@ // 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 +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_FWD_HPP +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_FWD_HPP -#include +#include -#if BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS +#if BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS #include #endif #if defined(__cpp_lib_three_way_comparison) #include #endif -#ifndef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN +#ifndef BEMAN_ITERATOR_INTERFACE_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 +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NO_HIDDEN_FRIEND_CONSTEXPR +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr #endif #if defined(__GNUC__) && __GNUC__ < 9 -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONCEPT concept bool +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_CONCEPT concept bool #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_CONCEPT concept +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_CONCEPT concept #endif #endif -namespace beman::iterator_interface26::detail { +namespace beman::iterator_interface::detail { namespace stl_interfaces { /** An enumeration used to indicate whether the underlying data have a @@ -43,7 +42,7 @@ namespace stl_interfaces { and `sequence_container_interface`. */ enum class element_layout : bool { discontiguous = false, contiguous = true }; -BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { +BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V1 { namespace v1_dtl { template @@ -83,6 +82,6 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { } // namespace v1_dtl } } // namespace stl_interfaces -} // namespace beman::optional26::detail +} // namespace beman::iterator_interface::detail #endif diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp b/include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp index d562157..e850700 100644 --- a/include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp +++ b/include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp @@ -1,4 +1,3 @@ -// include/beman/optional26/detail/stl_interfaces/iterator_interface.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // Copyright (C) 2019 T. Zachary Laine @@ -6,11 +5,11 @@ // 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_ITERATOR_INTERFACE_HPP -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_ITERATOR_INTERFACE_HPP +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_ITERATOR_INTERFACE_HPP +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_ITERATOR_INTERFACE_HPP -#include -#include +#include +#include #include #include @@ -18,7 +17,7 @@ #include #endif -namespace beman::iterator_interface26::detail { +namespace beman::iterator_interface::detail { namespace stl_interfaces { /** The return type of `operator->()` in a proxy iterator. @@ -28,7 +27,7 @@ namespace stl_interfaces { this template implies a copy or move of the underlying object of type `T`. */ template -#if defined(BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS +#if defined(BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS // clang-format off requires std::is_object_v #endif @@ -111,11 +110,11 @@ common_diff(T lhs, U rhs) noexcept(noexcept(static_cast>(lhs) - s } // namespace detail } // namespace stl_interfaces -} // namespace beman::iterator_interface26::detail +} // namespace beman::iterator_interface::detail -namespace beman::iterator_interface26::detail { +namespace beman::iterator_interface::detail { namespace stl_interfaces { -BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { +BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V1 { /** A CRTP template that one may derive from to make defining iterators easier. @@ -131,7 +130,7 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { typename Reference = ValueType&, typename Pointer = ValueType*, typename DifferenceType = std::ptrdiff_t -#ifndef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN , typename E = std::enable_if_t::value && std::is_same>::value> @@ -171,13 +170,13 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { typename Reference, typename Pointer, typename DifferenceType -#ifndef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN , typename E #endif > struct iterator_interface { -#ifndef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN +#ifndef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN private: constexpr Derived& derived() noexcept { return static_cast(*this); } constexpr const Derived& derived() const noexcept { return static_cast(*this); } @@ -263,7 +262,7 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { retval += i; return retval; } - friend BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR Derived operator+(difference_type i, + friend BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR Derived operator+(difference_type i, Derived it) noexcept { return it + i; } @@ -304,7 +303,7 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { return iterator_interface_access::base(derived()) - iterator_interface_access::base(other); } - friend BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR Derived + friend BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR Derived operator-(Derived it, difference_type i) noexcept { Derived retval = it; retval += -i; @@ -400,13 +399,13 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V1 { DifferenceType>; } } // namespace stl_interfaces -} // namespace beman::optional26::detail +} // namespace beman::iterator_interface::detail -#if defined(BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS +#if defined(BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS -namespace beman::iterator_interface26::detail { +namespace beman::iterator_interface::detail { namespace stl_interfaces { -BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V2 { +BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V2 { namespace v2_dtl { template @@ -723,15 +722,15 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V2 { DifferenceType>; } } // namespace stl_interfaces -} // namespace beman::optional26::detail +} // namespace beman::iterator_interface::detail #endif -#if defined(BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS +#if defined(BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN) || BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_DEDUCED_THIS -namespace beman::iterator_interface26::detail { +namespace beman::iterator_interface::detail { namespace stl_interfaces { -BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V3 { +BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_NAMESPACE_V3 { // clang-format off @@ -912,58 +911,58 @@ BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_NAMESPACE_V3 { iterator_interface, DifferenceType>; } } // namespace stl_interfaces -} // namespace beman::optional26::detail +} // namespace beman::iterator_interface::detail #endif -#ifdef BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_DOXYGEN +#ifdef BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_DOXYGEN /** `static_asserts` that type `type` models concept `concept_name`. This is useful for checking that an iterator, view, etc. that you write using one of the *`_interface` templates models the right C++ concept. - For example: `BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(my_iter, + For example: `BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(my_iter, std::input_iterator)`. \note This macro expands to nothing when `__cpp_lib_concepts` is not defined. */ -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(type, concept_name) +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(type, concept_name) /** `static_asserts` that the types of all typedefs in `std::iterator_traits` match the remaining macro parameters. This is useful for checking that an iterator you write using `iterator_interface` has the correct iterator traits. - For example: `BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(my_iter, + For example: `BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS(my_iter, std::input_iterator_tag, std::input_iterator, int, int &, int *, std::ptrdiff_t)`. \note This macro ignores the `concept` parameter when `__cpp_lib_concepts` is not defined. */ -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( \ +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( \ iter, category, concept, value_type, reference, pointer, difference_type) #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_CONCEPT_IMPL(type, concept_name) \ +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_CONCEPT_IMPL(type, concept_name) \ static_assert(concept_name, ""); -#if BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_USE_CONCEPTS -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(iter, concept_name) \ - BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_CONCEPT_IMPL(iter, concept_name) +#if BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_USE_CONCEPTS +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(iter, concept_name) \ + BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_CONCEPT_IMPL(iter, concept_name) #else -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(iter, concept_name) +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_CONCEPT(iter, concept_name) #endif -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS_IMPL( \ +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS_IMPL( \ iter, category, value_t, ref, ptr, diff_t) \ static_assert(std::is_same::value_type, value_t>::value, ""); \ static_assert(std::is_same::reference, ref>::value, ""); \ static_assert(std::is_same::pointer, ptr>::value, ""); \ static_assert(std::is_same::difference_type, diff_t>::value, ""); -#define BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( \ +#define BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS( \ iter, category, concept, value_type, reference, pointer, difference_type) \ - BEMAN_ITERATOR_INTERFACE26_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS_IMPL( \ + BEMAN_ITERATOR_INTERFACE_DETAIL_STL_INTERFACES_STATIC_ASSERT_ITERATOR_TRAITS_IMPL( \ iter, category, value_type, reference, pointer, difference_type) #endif diff --git a/include/beman/iterator_interface26/iterator_interface.hpp b/include/beman/iterator_interface26/iterator_interface.hpp index 6b10e2e..ed8022e 100644 --- a/include/beman/iterator_interface26/iterator_interface.hpp +++ b/include/beman/iterator_interface26/iterator_interface.hpp @@ -2,10 +2,10 @@ #ifndef INCLUDED_ITERATOR_INTERFACE #define INCLUDED_ITERATOR_INTERFACE -#include -#include -#if !BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS() -#include +#include +#include +#if !BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS() +#include #endif #include @@ -13,9 +13,9 @@ #include namespace beman { -namespace iterator_interface26 { +namespace iterator_interface { -#if BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS() +#if BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS() using std::conditional_t; using std::convertible_to; @@ -356,9 +356,9 @@ template , "beman.iterator_interface was compiled with " - "BEMAN_ITERATOR_INTERFACE26_USE_DEDUCING_THIS set to FALSE so " - "beman::iterator_interface26::iterator_interface is not available. See " - "beman::iterator_interface26::ext_iterator_interface_compat for a portable alternative."); + "BEMAN_ITERATOR_INTERFACE_USE_DEDUCING_THIS set to FALSE so " + "beman::iterator_interface::iterator_interface is not available. See " + "beman::iterator_interface::ext_iterator_interface_compat for a portable alternative."); }; template $ $ # /include/scratch ) install( - TARGETS beman.iterator_interface26 + TARGETS beman.iterator_interface EXPORT ${TARGETS_EXPORT_NAME}1 DESTINATION ${CMAKE_INSTALL_LIBDIR} ) @@ -30,10 +30,10 @@ install( FILES_MATCHING PATTERN "*.hpp" ) -target_link_libraries(beman.iterator_interface26) +target_link_libraries(beman.iterator_interface) ## Tests -if(BEMAN_ITERATOR_INTERFACE26_ENABLE_TESTING) +if(BEMAN_ITERATOR_INTERFACE_ENABLE_TESTING) add_executable(iterator_interface_test "") target_sources( @@ -42,7 +42,7 @@ if(BEMAN_ITERATOR_INTERFACE26_ENABLE_TESTING) iterator_interface.t.cpp ) - target_link_libraries(iterator_interface_test beman.iterator_interface26) + target_link_libraries(iterator_interface_test beman.iterator_interface) target_link_libraries(iterator_interface_test GTest::gtest) target_link_libraries(iterator_interface_test GTest::gtest_main) diff --git a/src/beman/iterator_interface26/iterator_interface.cpp b/src/beman/iterator_interface26/iterator_interface.cpp index 2356e2c..dfcb8d4 100644 --- a/src/beman/iterator_interface26/iterator_interface.cpp +++ b/src/beman/iterator_interface26/iterator_interface.cpp @@ -1 +1 @@ -#include +#include diff --git a/src/beman/iterator_interface26/iterator_interface.t.cpp b/src/beman/iterator_interface26/iterator_interface.t.cpp index 5e4a5d5..651778f 100644 --- a/src/beman/iterator_interface26/iterator_interface.t.cpp +++ b/src/beman/iterator_interface26/iterator_interface.t.cpp @@ -1,6 +1,6 @@ // iterator_interface.t.cpp -*-C++-*- -#include -#include +#include +#include #include @@ -8,7 +8,7 @@ #include namespace beman { -namespace iterator_interface26 { +namespace iterator_interface { namespace {} // namespace @@ -117,5 +117,5 @@ TEST(IteratorTest, OperatorArrow) { ASSERT_EQ(ai->f(), 3); } -} // namespace iterator_interface26 +} // namespace iterator_interface } // namespace beman From 49a9157af86997ebfdaf4c803de32e19dd2cb82d Mon Sep 17 00:00:00 2001 From: David Sankel Date: Thu, 7 Nov 2024 17:16:11 -0500 Subject: [PATCH 2/2] Rename directories to remove "26" from the name. --- .../{iterator_interface26 => iterator_interface}/config.hpp.in | 0 .../detail/stl_interfaces/config.hpp | 0 .../detail/stl_interfaces/fwd.hpp | 0 .../detail/stl_interfaces/iterator_interface.hpp | 0 .../iterator_interface.hpp | 0 .../iterator_interface_access.hpp | 0 .../{iterator_interface26 => iterator_interface}/CMakeLists.txt | 0 .../iterator_interface.cpp | 0 .../iterator_interface.t.cpp | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename include/beman/{iterator_interface26 => iterator_interface}/config.hpp.in (100%) rename include/beman/{iterator_interface26 => iterator_interface}/detail/stl_interfaces/config.hpp (100%) rename include/beman/{iterator_interface26 => iterator_interface}/detail/stl_interfaces/fwd.hpp (100%) rename include/beman/{iterator_interface26 => iterator_interface}/detail/stl_interfaces/iterator_interface.hpp (100%) rename include/beman/{iterator_interface26 => iterator_interface}/iterator_interface.hpp (100%) rename include/beman/{iterator_interface26 => iterator_interface}/iterator_interface_access.hpp (100%) rename src/beman/{iterator_interface26 => iterator_interface}/CMakeLists.txt (100%) rename src/beman/{iterator_interface26 => iterator_interface}/iterator_interface.cpp (100%) rename src/beman/{iterator_interface26 => iterator_interface}/iterator_interface.t.cpp (100%) diff --git a/include/beman/iterator_interface26/config.hpp.in b/include/beman/iterator_interface/config.hpp.in similarity index 100% rename from include/beman/iterator_interface26/config.hpp.in rename to include/beman/iterator_interface/config.hpp.in diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/config.hpp b/include/beman/iterator_interface/detail/stl_interfaces/config.hpp similarity index 100% rename from include/beman/iterator_interface26/detail/stl_interfaces/config.hpp rename to include/beman/iterator_interface/detail/stl_interfaces/config.hpp diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp b/include/beman/iterator_interface/detail/stl_interfaces/fwd.hpp similarity index 100% rename from include/beman/iterator_interface26/detail/stl_interfaces/fwd.hpp rename to include/beman/iterator_interface/detail/stl_interfaces/fwd.hpp diff --git a/include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp b/include/beman/iterator_interface/detail/stl_interfaces/iterator_interface.hpp similarity index 100% rename from include/beman/iterator_interface26/detail/stl_interfaces/iterator_interface.hpp rename to include/beman/iterator_interface/detail/stl_interfaces/iterator_interface.hpp diff --git a/include/beman/iterator_interface26/iterator_interface.hpp b/include/beman/iterator_interface/iterator_interface.hpp similarity index 100% rename from include/beman/iterator_interface26/iterator_interface.hpp rename to include/beman/iterator_interface/iterator_interface.hpp diff --git a/include/beman/iterator_interface26/iterator_interface_access.hpp b/include/beman/iterator_interface/iterator_interface_access.hpp similarity index 100% rename from include/beman/iterator_interface26/iterator_interface_access.hpp rename to include/beman/iterator_interface/iterator_interface_access.hpp diff --git a/src/beman/iterator_interface26/CMakeLists.txt b/src/beman/iterator_interface/CMakeLists.txt similarity index 100% rename from src/beman/iterator_interface26/CMakeLists.txt rename to src/beman/iterator_interface/CMakeLists.txt diff --git a/src/beman/iterator_interface26/iterator_interface.cpp b/src/beman/iterator_interface/iterator_interface.cpp similarity index 100% rename from src/beman/iterator_interface26/iterator_interface.cpp rename to src/beman/iterator_interface/iterator_interface.cpp diff --git a/src/beman/iterator_interface26/iterator_interface.t.cpp b/src/beman/iterator_interface/iterator_interface.t.cpp similarity index 100% rename from src/beman/iterator_interface26/iterator_interface.t.cpp rename to src/beman/iterator_interface/iterator_interface.t.cpp