Skip to content

Commit 8bfaf75

Browse files
committed
🔥 Remove memory.hpp
Problem: - `memory.hpp` contains only `to_address`, which is a C++20 feature that has long since been supported in supported toolchains. - See https://cppstat.dev/?search=to_address Solution: - Remove `memory.hpp`.
1 parent f50ce7f commit 8bfaf75

15 files changed

Lines changed: 15 additions & 127 deletions

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ target_sources(
7272
include/stdx/intrusive_list.hpp
7373
include/stdx/iterator.hpp
7474
include/stdx/latched.hpp
75-
include/stdx/memory.hpp
7675
include/stdx/numeric.hpp
7776
include/stdx/optional.hpp
7877
include/stdx/panic.hpp

docs/header_graph.mmd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ flowchart BT
1919
type_traits --> ct_conversions
2020

2121
%% level 3
22-
memory(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/memory.hpp">memory.hpp</a>)
23-
memory --> type_traits
2422
iterator(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/iterator.hpp">iterator.hpp</a>)
2523
iterator --> type_traits
2624
concepts(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/concepts.hpp">concepts.hpp</a>)
@@ -53,11 +51,9 @@ flowchart BT
5351

5452
%% level 6
5553
span(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/span.hpp">span.hpp</a>)
56-
span ----> memory
5754
span ----> iterator
5855
span --> bit
5956
byterator(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/byterator.hpp">byterator.hpp</a>)
60-
byterator ----> memory
6157
byterator --> bit
6258
cx_set(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/cx_set.hpp">cx_set.hpp</a>)
6359
cx_set ---> cx_map

docs/index.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ include::intrusive_forward_list.adoc[]
3333
include::intrusive_list.adoc[]
3434
include::iterator.adoc[]
3535
include::latched.adoc[]
36-
include::memory.adoc[]
3736
include::numeric.adoc[]
3837
include::optional.adoc[]
3938
include::panic.adoc[]

docs/intro.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ The following headers are available:
8888
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/intrusive_list.hpp[`intrusive_list.hpp`]
8989
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/iterator.hpp[`iterator.hpp`]
9090
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/latched.hpp[`latched.hpp`]
91-
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/memory.hpp[`memory.hpp`]
9291
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/numeric.hpp[`numeric.hpp`]
9392
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/optional.hpp[`optional.hpp`]
9493
* https://github.com/intel/cpp-std-extensions/blob/main/include/stdx/panic.hpp[`panic.hpp`]

docs/memory.adoc

Lines changed: 0 additions & 7 deletions
This file was deleted.

include/stdx/byterator.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
#include <stdx/bit.hpp>
44
#include <stdx/concepts.hpp>
5-
#include <stdx/memory.hpp>
65
#include <stdx/type_traits.hpp>
76
#include <stdx/utility.hpp>
87

98
#include <cstddef>
109
#include <cstring>
11-
#include <functional>
1210
#include <iterator>
11+
#include <memory>
1312
#include <type_traits>
1413

1514
namespace stdx {
@@ -45,7 +44,7 @@ template <typename T> class byterator {
4544
[[nodiscard]] friend constexpr auto operator==(byterator const &x, It y)
4645
-> bool {
4746
return static_cast<void const *>(x.ptr) ==
48-
static_cast<void const *>(stdx::to_address(y));
47+
static_cast<void const *>(std::to_address(y));
4948
}
5049

5150
[[nodiscard]] friend constexpr auto operator<=>(byterator const &x,
@@ -56,7 +55,7 @@ template <typename T> class byterator {
5655
requires std::is_same_v<detail::iterator_value_t<It>, T>
5756
[[nodiscard]] friend constexpr auto operator<=>(byterator const &x, It y) {
5857
return static_cast<void const *>(x.ptr) <=>
59-
static_cast<void const *>(stdx::to_address(y));
58+
static_cast<void const *>(std::to_address(y));
6059
}
6160

6261
public:
@@ -67,7 +66,7 @@ template <typename T> class byterator {
6766
using iterator_category = std::random_access_iterator_tag;
6867

6968
template <detail::byteratorish It>
70-
explicit byterator(It it) : ptr(bit_cast<byte_t *>(stdx::to_address(it))) {}
69+
explicit byterator(It it) : ptr(bit_cast<byte_t *>(std::to_address(it))) {}
7170

7271
[[nodiscard]] constexpr auto operator->() const -> byte_t * { return ptr; }
7372
[[nodiscard]] constexpr auto operator*() const -> byte_t & { return *ptr; }

include/stdx/memory.hpp

Lines changed: 0 additions & 33 deletions
This file was deleted.

include/stdx/span.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
#include <stdx/compiler.hpp>
55
#include <stdx/concepts.hpp>
66
#include <stdx/iterator.hpp>
7-
#include <stdx/memory.hpp>
87
#include <stdx/type_traits.hpp>
98

109
#include <algorithm>
1110
#include <array>
1211
#include <cstddef>
1312
#include <iterator>
1413
#include <limits>
14+
#include <memory>
1515
#include <type_traits>
1616

1717
namespace stdx {
@@ -85,12 +85,12 @@ class span : public detail::span_base<T, Extent> {
8585
template <typename It, typename SizeOrEnd>
8686
requires(dependent_extent<It> != dynamic_extent)
8787
explicit constexpr span(It first, SizeOrEnd)
88-
: ptr{stdx::to_address(first)} {}
88+
: ptr{std::to_address(first)} {}
8989

9090
template <typename It, typename SizeOrEnd>
9191
requires(dependent_extent<It> == dynamic_extent)
9292
constexpr span(It first, SizeOrEnd sore)
93-
: base_t{first, sore}, ptr{stdx::to_address(first)} {}
93+
: base_t{first, sore}, ptr{std::to_address(first)} {}
9494

9595
template <typename U, std::size_t N>
9696
constexpr explicit(false) span(std::array<U, N> &arr LIFETIMEBOUND) noexcept
@@ -120,13 +120,13 @@ class span : public detail::span_base<T, Extent> {
120120
template <typename R>
121121
requires(dependent_extent<R> != dynamic_extent)
122122
explicit constexpr span(R &&r)
123-
: ptr{stdx::to_address(std::begin(std::forward<R>(r)))} {}
123+
: ptr{std::to_address(std::begin(std::forward<R>(r)))} {}
124124

125125
template <typename R>
126126
requires(dependent_extent<R> == dynamic_extent)
127127
explicit constexpr span(R &&r)
128128
: base_t{std::begin(std::forward<R>(r)), std::end(std::forward<R>(r))},
129-
ptr{stdx::to_address(std::begin(std::forward<R>(r)))} {}
129+
ptr{std::to_address(std::begin(std::forward<R>(r)))} {}
130130

131131
template <class U, std::size_t N>
132132
requires(dependent_extent<U> != dynamic_extent and N == dynamic_extent)

test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ add_tests(
5656
is_constant_evaluated
5757
iterator
5858
latched
59-
memory
6059
numeric
6160
optional
6261
overload

test/byterator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
#include <array>
66
#include <iterator>
7+
#include <memory>
78

89
TEST_CASE("constructible from an iterator", "[byterator]") {
910
auto const a = std::array{1, 2, 3, 4};
1011
auto const b = stdx::byterator{std::begin(a)};
11-
CHECK(static_cast<void const *>(stdx::to_address(std::begin(a))) ==
12-
static_cast<void const *>(stdx::to_address(b)));
12+
CHECK(static_cast<void const *>(std::to_address(std::begin(a))) ==
13+
static_cast<void const *>(std::to_address(b)));
1314
}
1415

1516
TEST_CASE("equality comparable to iterator", "[byterator]") {

0 commit comments

Comments
 (0)