Skip to content

Commit 5ab9dcf

Browse files
committed
Fix issues caught by lint
Format errors and such,
1 parent 53f45c1 commit 5ab9dcf

File tree

8 files changed

+54
-96
lines changed

8 files changed

+54
-96
lines changed

etc/gcc-15-toolchain.cmake

100755100644
File mode changed.

include/Beman/Optional26/optional.hpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ concept enable_assign_from_other =
291291

292292
template <class T>
293293
class optional {
294-
static_assert((!std::is_same_v<T, std::remove_cv_t<in_place_t>>) && (!std::is_same_v<std::remove_cv_t<T>, nullopt_t>));
294+
static_assert((!std::is_same_v<T, std::remove_cv_t<in_place_t>>) &&
295+
(!std::is_same_v<std::remove_cv_t<T>, nullopt_t>));
295296

296297
struct empty {};
297298
union {
@@ -317,8 +318,7 @@ class optional {
317318
using iterator = detail::contiguous_iterator<T, optional>; // see [optional.iterators]
318319
using const_iterator = detail::contiguous_iterator<const T, optional>; // see [optional.iterators]
319320

320-
constexpr optional() noexcept
321-
: _(), engaged_(false) {}
321+
constexpr optional() noexcept : _(), engaged_(false) {}
322322

323323
constexpr ~optional()
324324
requires(!std::is_trivially_destructible_v<T>)
@@ -477,15 +477,13 @@ class optional {
477477

478478
/// Returns the stored value if there is one, otherwise returns `u`
479479
template <class U>
480-
constexpr T value_or(U&& u) const&
481-
{
480+
constexpr T value_or(U&& u) const& {
482481
static_assert(std::is_copy_constructible_v<T> && std::is_convertible_v<U&&, T>);
483482
return has_value() ? value() : static_cast<T>(std::forward<U>(u));
484483
}
485484

486485
template <class U>
487-
constexpr T value_or(U&& u) &&
488-
{
486+
constexpr T value_or(U&& u) && {
489487
static_assert(std::is_move_constructible_v<T> && std::is_convertible_v<U&&, T>);
490488
return has_value() ? std::move(value()) : static_cast<T>(std::forward<U>(u));
491489
}
@@ -541,7 +539,7 @@ class optional {
541539
static_assert(!std::is_array_v<U>);
542540
static_assert(!std::is_same_v<U, in_place_t>);
543541
static_assert(!std::is_same_v<U, nullopt_t>);
544-
static_assert(std::is_object_v<U> || std::is_reference_v<U> ); /// References now allowed
542+
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
545543
return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), value_)} : optional<U>{};
546544
}
547545

@@ -551,7 +549,7 @@ class optional {
551549
static_assert(!std::is_array_v<U>);
552550
static_assert(!std::is_same_v<U, in_place_t>);
553551
static_assert(!std::is_same_v<U, nullopt_t>);
554-
static_assert(std::is_object_v<U> || std::is_reference_v<U> ); /// References now allowed
552+
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
555553
return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), std::move(value_))} : optional<U>{};
556554
}
557555

@@ -561,7 +559,7 @@ class optional {
561559
static_assert(!std::is_array_v<U>);
562560
static_assert(!std::is_same_v<U, in_place_t>);
563561
static_assert(!std::is_same_v<U, nullopt_t>);
564-
static_assert(std::is_object_v<U> || std::is_reference_v<U> ); /// References now allowed
562+
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
565563
return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), value_)} : optional<U>{};
566564
}
567565

@@ -571,7 +569,7 @@ class optional {
571569
static_assert(!std::is_array_v<U>);
572570
static_assert(!std::is_same_v<U, in_place_t>);
573571
static_assert(!std::is_same_v<U, nullopt_t>);
574-
static_assert(std::is_object_v<U> || std::is_reference_v<U> ); /// References now allowed
572+
static_assert(std::is_object_v<U> || std::is_reference_v<U>); /// References now allowed
575573
return (has_value()) ? optional<U>{std::invoke(std::forward<F>(f), value_)} : optional<U>{};
576574
}
577575

@@ -658,17 +656,15 @@ class optional {
658656
/// Constructs the value in-place, destroying the current one if there is
659657
/// one.
660658
template <class... Args>
661-
constexpr T& emplace(Args&&... args)
662-
{
659+
constexpr T& emplace(Args&&... args) {
663660
static_assert(std::is_constructible_v<T, Args&&...>);
664661
*this = nullopt;
665662
construct(std::forward<Args>(args)...);
666663
return value();
667664
}
668665

669666
template <class U, class... Args>
670-
constexpr T& emplace(std::initializer_list<U> il, Args&&... args)
671-
{
667+
constexpr T& emplace(std::initializer_list<U> il, Args&&... args) {
672668
static_assert(std::is_constructible_v<T, std::initializer_list<U>&, Args&&...>);
673669
*this = nullopt;
674670
construct(il, std::forward<Args>(args)...);
@@ -1086,7 +1082,7 @@ class optional<T&> {
10861082
}
10871083

10881084
template <class U>
1089-
constexpr optional& operator=(optional<U>&& rhs) = delete;
1085+
constexpr optional& operator=(optional<U>&& rhs) = delete;
10901086

10911087
template <class U>
10921088
requires(!detail::is_optional<std::decay_t<U>>)

src/Beman/Optional26/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ target_include_directories(
1313
PUBLIC
1414
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../include>
1515
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../src/>
16-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}> # <prefix>/include/scratch
16+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_LOWER_PROJECT_NAME}>
1717
)
1818

1919
install(

src/Beman/Optional26/tests/CMakeLists.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,21 @@
66
include(GoogleTest)
77

88
# Tests
9-
add_executable(
10-
beman_optional26_test
11-
)
9+
add_executable(beman_optional26_test)
1210

1311
target_sources(
1412
beman_optional26_test
15-
PRIVATE
16-
optional_monadic.t.cpp
17-
optional_range_support.t.cpp
18-
optional_ref_monadic.t.cpp
19-
optional_ref.t.cpp
20-
optional.t.cpp
21-
optional_constexpr.t.cpp
22-
test_types.cpp
23-
test_utilities.cpp)
13+
PRIVATE optional_monadic.t.cpp
14+
optional_range_support.t.cpp
15+
optional_ref_monadic.t.cpp
16+
optional_ref.t.cpp
17+
optional.t.cpp
18+
optional_constexpr.t.cpp
19+
test_types.cpp
20+
test_utilities.cpp)
2421

25-
target_link_libraries(
26-
beman_optional26_test
27-
PRIVATE
28-
beman_optional26
29-
GTest::gtest
30-
GTest::gtest_main)
22+
target_link_libraries(beman_optional26_test
23+
PRIVATE beman_optional26 GTest::gtest GTest::gtest_main)
3124

3225
# Issue #32: Re-enable ASAN run CI/clang-19.
3326
#

0 commit comments

Comments
 (0)