Skip to content

Commit 322a59d

Browse files
committed
polymorphic info members use value semantics
Wherever std::unique_ptr was used for polymorphic members of Info objects, the pointer addresses were being used in comparisons instead of the dereferenced values, which only returned true when both were nullptr. #fix
1 parent 6f9bd07 commit 322a59d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1777
-861
lines changed

include/mrdocs/ADT/Optional.hpp

+14-13
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#include <concepts>
1717
#include <type_traits>
1818
#include <utility>
19+
#include <ranges>
1920

20-
namespace clang {
21-
namespace mrdocs {
21+
namespace clang::mrdocs {
2222

2323
/** The default empty predicate.
2424
@@ -27,21 +27,23 @@ namespace mrdocs {
2727
*/
2828
struct DefaultEmptyPredicate
2929
{
30-
template<class T>
31-
constexpr bool operator()(T const& t) const noexcept
32-
requires requires
33-
{
34-
{ t.empty() } -> std::convertible_to<bool>;
35-
}
30+
template <std::ranges::range T>
31+
constexpr
32+
bool
33+
operator()(T const& t) const noexcept
3634
{
37-
return t.empty();
35+
return std::ranges::empty(t);
3836
}
3937

4038
template<class T>
41-
constexpr bool operator()(T const& t) const noexcept
39+
constexpr
40+
bool
41+
operator()(T const& t) const noexcept
4242
{
43-
return ! t;
43+
return !t;
4444
}
45+
46+
4547
};
4648

4749
/** A compact optional.
@@ -138,7 +140,6 @@ class Optional
138140
}
139141
};
140142

141-
} // mrdocs
142-
} // clang
143+
} // clang::mrdocs
143144

144145
#endif

0 commit comments

Comments
 (0)