diff --git a/README.md b/README.md index f87cdf49..b96fa2a4 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository implements `std::optional` extensions targeting C++26. The `Bema **Implements**: -* [Give *std::optional* Range Support (P3168R1)](https://wg21.link/P3168R1) +* [Give *std::optional* Range Support (P3168R2)](https://wg21.link/P3168R2) * [`std::optional` (P2988R5)](https://wg21.link/P2988R5) ## License @@ -23,13 +23,13 @@ Full runable examples can be found in `examples/` - please check [./examples/REA ### range_loop -The next code snippet shows optional range support added in [Give *std::optional* Range Support (P3168R1)](https://wg21.link/P3168R1): +The next code snippet shows optional range support added in [Give *std::optional* Range Support (P3168R2)](https://wg21.link/P3168R2): ```cpp #include ... -// Example from P3168R1: basic range loop over C++26 optional. +// Example from P3168R2: basic range loop over C++26 optional. beman::optional26::optional empty_opt{}; for ([[maybe_unused]] const auto& i : empty_opt) { diff --git a/examples/README.md b/examples/README.md index 4129ab63..3992a36d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -35,9 +35,9 @@ std_vs_beman: .value() matches?: yes $ .build/gcc-14/examples/RelWithDebInfo/concept_checks ``` -## Range Support (P3168R1) +## Range Support (P3168R2) -Range support added in [*Give std::optional Range Support* (P3168R1)](https://wg21.link/P3168R1) examples: +Range support added in [*Give std::optional Range Support* (P3168R2)](https://wg21.link/P3168R2) examples: * local [./range_loop.cpp](./range_loop.cpp) or [range_loop.cpp@Compiler Explorer](https://godbolt.org/z/f8dWaxsGo) * local [./pythagorean_triples.cpp](./pythagorean_triples.cpp) or [pythagorean_triples.cpp@Compiler Explorer](https://godbolt.org/z/fGr8jYM6P) diff --git a/examples/pythagorean_triples.cpp b/examples/pythagorean_triples.cpp index fa0fda03..b8987652 100644 --- a/examples/pythagorean_triples.cpp +++ b/examples/pythagorean_triples.cpp @@ -10,7 +10,7 @@ #include int main() { - // Example from P3168R1: generate an infinite sequence of Pythagorean triples. + // Example from P3168R2: generate an infinite sequence of Pythagorean triples. // (x, y, z) is a Pythagorean triple if 1 <= x <= y <= z and x^2 + y^2 = z^2. constexpr auto yield_if = [](bool b, T x) -> beman::optional26::optional { return b ? beman::optional26::optional{std::move(x)} : beman::optional26::nullopt; diff --git a/examples/range_loop.cpp b/examples/range_loop.cpp index 6830a183..5b4c2445 100644 --- a/examples/range_loop.cpp +++ b/examples/range_loop.cpp @@ -5,7 +5,7 @@ #include int main() { - // Example from P3168R1: basic range loop over C++26 optional. + // Example from P3168R2: basic range loop over C++26 optional. beman::optional26::optional empty_opt{}; for ([[maybe_unused]] const auto& i : empty_opt) { diff --git a/include/Beman/Optional26/optional.hpp b/include/Beman/Optional26/optional.hpp index c715c3c6..f3885a29 100644 --- a/include/Beman/Optional26/optional.hpp +++ b/include/Beman/Optional26/optional.hpp @@ -212,7 +212,7 @@ class optional; } // namespace beman::optional26 namespace std { -// Since P3168R1: Give std::optional Range Support. +// Since P3168R2: Give std::optional Range Support. template inline constexpr bool ranges::enable_view> = true; @@ -220,7 +220,7 @@ inline constexpr bool ranges::enable_view> = true template inline constexpr bool ranges::enable_borrowed_range> = true; -// Since P3168R1: Give std::optional Range Support. +// Since P3168R2: Give std::optional Range Support. #if defined(__cpp_lib_format_ranges) template inline constexpr auto format_kind> = range_format::disabled; @@ -318,7 +318,7 @@ class optional { public: using value_type = T; - // Since P3168R1: Give std::optional Range Support. + // Since P3168R2: Give std::optional Range Support. using iterator = detail::contiguous_iterator; // see [optional.iterators] using const_iterator = detail::contiguous_iterator; // see [optional.iterators] @@ -688,7 +688,7 @@ class optional { swap(engaged, rhs.engaged); } - // Since P3168R1: Give std::optional Range Support. + // Since P3168R2: Give std::optional Range Support. // [optional.iterators], iterator support constexpr iterator begin() noexcept { return iterator(has_value() ? std::addressof(value_) : nullptr); } constexpr const_iterator begin() const noexcept { @@ -941,7 +941,7 @@ class optional { using value_type = T&; // Since ${PAPER_NUMBER}: ${PAPER_TITLE}. // Note: P3168 and P2988 may have different flows inside LEWG/LWG. - // Implementation of the range support for optional reflects P3168R1 for now. + // Implementation of the range support for optional reflects P3168R2 for now. // [optional.iterators], iterator support using iterator = detail::contiguous_iterator; // see [optional.iterators] using const_iterator = detail::contiguous_iterator; // see [optional.iterators] @@ -1076,7 +1076,7 @@ class optional { // Since ${PAPER_NUMBER}: ${PAPER_TITLE}. // Note: P3168 and P2988 may have different flows inside LEWG/LWG. - // Implementation of the range support for optional reflects P3168R1 for now. + // Implementation of the range support for optional reflects P3168R2 for now. // [optional.iterators], iterator support constexpr iterator begin() noexcept { return iterator(has_value() ? value_ : nullptr); }; constexpr const_iterator begin() const noexcept { return const_iterator(has_value() ? value_ : nullptr); }; diff --git a/src/Beman/Optional26/tests/optional_range_support.t.cpp b/src/Beman/Optional26/tests/optional_range_support.t.cpp index 8093bb84..6dca54a6 100644 --- a/src/Beman/Optional26/tests/optional_range_support.t.cpp +++ b/src/Beman/Optional26/tests/optional_range_support.t.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception /** - * This file contains tests for the range support. Check P3168R1: "Give std::optional Range Support". + * This file contains tests for the range support. Check P3168R2: "Give std::optional Range Support". * * RangeSupportTest: test suite for the range support. * @@ -211,7 +211,7 @@ TEST(RangeSupportTest, LoopOverNonEmptyRange) { } TEST(RangeSupportTest, LoopOptionalAccess) { - // Example from P3168R1: should access the value from an optional object. + // Example from P3168R2: should access the value from an optional object. const int expected_value = 0xCAFEBABE; const auto get_optional = [&]() -> beman::optional26::optional { return expected_value; }; ASSERT_TRUE(get_optional().has_value()); @@ -222,7 +222,7 @@ TEST(RangeSupportTest, LoopOptionalAccess) { } TEST(RangeSupportTest, LoopOptionalAssignment) { - // Example from P3168R1: should mutate the value from an optional object. + // Example from P3168R2: should mutate the value from an optional object. const int initial_expected_value = 0xCAFEBABE; const int expected_value = 0xDEADBEEF; const auto get_optional = [&]() -> beman::optional26::optional { return initial_expected_value; }; @@ -239,7 +239,7 @@ TEST(RangeSupportTest, LoopOptionalAssignment) { } TEST(RangeSupportTest, RangeChainExample) { - // Example from P3168R1: start from a set of values, apply multiple range operations involving optional values. + // Example from P3168R2: start from a set of values, apply multiple range operations involving optional values. std::unordered_set s{1, 3, 7, 9}; const auto flt = [&](int i) -> beman::optional26::optional { if (s.contains(i)) { @@ -261,7 +261,7 @@ TEST(RangeSupportTest, RangeChainExample) { } TEST(RangeSupportTest, PythagoreanTriples) { - // Example from P3168R1: generate an infinite sequence of Pythagorean triples. + // Example from P3168R2: generate an infinite sequence of Pythagorean triples. // (x, y, z) is a Pythagorean triple if 1 <= x <= y <= z and x^2 + y^2 = z^2. constexpr auto yield_if = [](bool b, T x) -> beman::optional26::optional { return b ? beman::optional26::optional{std::move(x)} : beman::optional26::nullopt;