Skip to content

Commit e4e869d

Browse files
authored
Fix issue with flag stored value
Storing flag keywords as std::true_type and not bool made some g++ chokes when used in requires clause.
1 parent 2c8e58b commit e4e869d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

include/raberu/impl/keywords.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ namespace rbr
288288

289289
using tag_type = ID;
290290
using keyword_type = flag_keyword;
291-
using stored_value_type = std::true_type;
291+
using stored_value_type = bool;
292292

293293
template<typename Type>
294294
constexpr auto operator=(Type&&) const noexcept { return *this; }
@@ -304,7 +304,7 @@ namespace rbr
304304
return _::type_or_<flag_keyword,call<Func>>{RBR_FWD(v)};
305305
}
306306

307-
constexpr std::true_type operator()(keyword_type const&) const noexcept { return {}; }
307+
constexpr auto operator()(keyword_type const&) const noexcept { return true; }
308308

309309
template<typename O0, typename O1, typename... Os>
310310
constexpr decltype(auto) operator()(O0&&, O1&&, Os&&... ) const

include/raberu/impl/settings.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace rbr
6969
static constexpr auto contains([[maybe_unused]] Key const& kw) noexcept
7070
{
7171
using found = decltype((std::declval<base>())(Key{}));
72-
return std::bool_constant<!stdfix::same_as<found, unknown_key> >{};
72+
return !stdfix::same_as<found, unknown_key>;
7373
}
7474

7575
//==============================================================================================

standalone/raberu/raberu.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ namespace rbr
333333
}
334334
using tag_type = ID;
335335
using keyword_type = flag_keyword;
336-
using stored_value_type = std::true_type;
336+
using stored_value_type = bool;
337337
template<typename Type>
338338
constexpr auto operator=(Type&&) const noexcept { return *this; }
339339
template<typename Type>
@@ -345,7 +345,7 @@ namespace rbr
345345
{
346346
return _::type_or_<flag_keyword,call<Func>>{RBR_FWD(v)};
347347
}
348-
constexpr std::true_type operator()(keyword_type const&) const noexcept { return {}; }
348+
constexpr auto operator()(keyword_type const&) const noexcept { return true; }
349349
template<typename O0, typename O1, typename... Os>
350350
constexpr decltype(auto) operator()(O0&&, O1&&, Os&&... ) const
351351
{
@@ -395,7 +395,7 @@ namespace rbr
395395
static constexpr auto contains([[maybe_unused]] Key const& kw) noexcept
396396
{
397397
using found = decltype((std::declval<base>())(Key{}));
398-
return std::bool_constant<!stdfix::same_as<found, unknown_key> >{};
398+
return !stdfix::same_as<found, unknown_key>;
399399
}
400400
template<concepts::keyword... Keys>
401401
static constexpr auto contains_any(Keys... ks) noexcept { return (contains(ks) || ...); }

test/unit/fetch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ TTS_CASE("Check rbr::fetch_t behavior on options")
5151

5252
TTS_TYPE_IS( (rbr::result::fetch_t<coord_ , opt1_t, opt2_t, opt3_t>), std::string );
5353
TTS_TYPE_IS( (rbr::result::fetch_t<value_ , opt1_t, opt2_t, opt3_t>), float );
54-
TTS_TYPE_IS( (rbr::result::fetch_t<is_modal_, opt1_t, opt2_t, opt3_t>), std::true_type );
54+
TTS_TYPE_IS( (rbr::result::fetch_t<is_modal_, opt1_t, opt2_t, opt3_t>), bool );
5555
TTS_TYPE_IS( (rbr::result::fetch_t<"flop"_kw, opt1_t, opt2_t, opt3_t>), rbr::unknown_key);
5656
};
5757

@@ -64,7 +64,7 @@ TTS_CASE("Check rbr::fetch_t behavior on settings")
6464

6565
TTS_TYPE_IS( (rbr::result::fetch_t<coord_ , opts_t>), std::string );
6666
TTS_TYPE_IS( (rbr::result::fetch_t<value_ , opts_t>), float );
67-
TTS_TYPE_IS( (rbr::result::fetch_t<is_modal_, opts_t>), std::true_type );
67+
TTS_TYPE_IS( (rbr::result::fetch_t<is_modal_, opts_t>), bool );
6868
TTS_TYPE_IS( (rbr::result::fetch_t<"flop"_kw, opts_t>), rbr::unknown_key);
6969
};
7070

0 commit comments

Comments
 (0)