19namespace seqan3::detail
30enum struct strong_type_skill
42 bitwise_lshift = 1 << 9,
43 bitwise_rshift = 1 << 10,
44 logical_and = 1 << 11,
46 logical_not = 1 << 13,
51 additive = add | subtract,
52 multiplicative = multiply | divide | modulo,
53 bitwise_logic = bitwise_and | bitwise_or | bitwise_xor | bitwise_not,
54 bitwise_shift = bitwise_lshift | bitwise_rshift,
55 logic = logical_and | logical_or | logical_not
66inline constexpr bool add_enum_bitwise_operators<seqan3::detail::strong_type_skill> =
true;
70namespace seqan3::detail
74template <
typename,
typename, strong_type_skill>
100template <
typename strong_type_t>
101concept derived_from_strong_type =
requires (strong_type_t && obj) {
108 requires std::derived_from<std::remove_cvref_t<strong_type_t>,
109 strong_type<typename std::remove_reference_t<strong_type_t>::value_type,
169template <
typename value_t,
typename derived_t, strong_type_skill skills_ = strong_type_skill::none>
174 static constexpr strong_type_skill skills = skills_;
176 using value_type = value_t;
182 constexpr strong_type() noexcept = default;
183 constexpr strong_type(strong_type const &) noexcept = default;
184 constexpr strong_type(strong_type &&) noexcept = default;
185 constexpr strong_type & operator=(strong_type const &) noexcept = default;
186 constexpr strong_type & operator=(strong_type &&) noexcept = default;
187 ~strong_type() noexcept = default;
190 constexpr explicit strong_type(value_t _value) : value(
std::move(_value))
198 constexpr value_t &
get() &
noexcept
204 constexpr value_t
const &
get() const & noexcept
210 constexpr value_t &&
get() &&
noexcept
212 return std::move(value);
216 constexpr value_t
const &&
get() const && noexcept
218 return std::move(value);
228 constexpr derived_t operator+(strong_type
const & other)
229 requires ((skills & strong_type_skill::add) != strong_type_skill::none)
231 return derived_t{
get() + other.get()};
235 constexpr derived_t operator-(strong_type
const & other)
236 requires ((skills & strong_type_skill::subtract) != strong_type_skill::none)
238 return derived_t{
get() - other.get()};
248 constexpr derived_t operator*(strong_type
const & other)
249 requires ((skills & strong_type_skill::multiply) != strong_type_skill::none)
251 return derived_t{
get() * other.get()};
255 constexpr derived_t
operator/(strong_type
const & other)
256 requires ((skills & strong_type_skill::divide) != strong_type_skill::none)
258 return derived_t{
get() / other.get()};
262 constexpr derived_t operator%(strong_type
const & other)
263 requires ((skills & strong_type_skill::modulo) != strong_type_skill::none)
265 return derived_t{
get() % other.get()};
276 constexpr derived_t operator&(strong_type
const & other)
277 requires ((skills & strong_type_skill::bitwise_and) != strong_type_skill::none)
279 return derived_t{
get() & other.get()};
283 constexpr derived_t
operator|(strong_type
const & other)
284 requires ((skills & strong_type_skill::bitwise_or) != strong_type_skill::none)
286 return derived_t{
get() | other.get()};
290 constexpr derived_t operator^(strong_type
const & other)
291 requires ((skills & strong_type_skill::bitwise_xor) != strong_type_skill::none)
293 return derived_t{
get() ^ other.get()};
297 constexpr derived_t operator~()
298 requires ((skills & strong_type_skill::bitwise_not) != strong_type_skill::none)
300 return derived_t{~get()};
311 constexpr derived_t operator<<(strong_type
const & other)
312 requires ((skills & strong_type_skill::bitwise_lshift) != strong_type_skill::none)
314 return derived_t{
get() << other.get()};
318 template <std::
integral
integral_t>
319 constexpr derived_t operator<<(integral_t
const shift)
320 requires ((skills & strong_type_skill::bitwise_lshift) != strong_type_skill::none)
322 return derived_t{
get() << shift};
326 constexpr derived_t operator>>(strong_type
const & other)
327 requires ((skills & strong_type_skill::bitwise_rshift) != strong_type_skill::none)
329 return derived_t{
get() >> other.get()};
333 template <std::
integral
integral_t>
334 constexpr derived_t operator>>(integral_t
const shift)
335 requires ((skills & strong_type_skill::bitwise_rshift) != strong_type_skill::none)
337 return derived_t{
get() >> shift};
348 constexpr bool operator&&(strong_type
const & other)
349 requires ((skills & strong_type_skill::logical_and) != strong_type_skill::none)
351 return get() && other.get();
355 constexpr bool operator||(strong_type
const & other)
356 requires ((skills & strong_type_skill::logical_or) != strong_type_skill::none)
358 return get() || other.get();
362 constexpr bool operator!()
363 requires ((skills & strong_type_skill::logical_not) != strong_type_skill::none)
375 constexpr derived_t & operator++()
376 requires ((skills & strong_type_skill::increment) != strong_type_skill::none)
379 return static_cast<derived_t &
>(*this);
383 constexpr derived_t operator++(
int)
384 requires ((skills & strong_type_skill::increment) != strong_type_skill::none)
386 derived_t tmp{
get()};
392 constexpr derived_t & operator--()
393 requires ((skills & strong_type_skill::decrement) != strong_type_skill::none)
396 return static_cast<derived_t &
>(*this);
400 constexpr derived_t operator--(
int)
401 requires ((skills & strong_type_skill::decrement) != strong_type_skill::none)
403 derived_t tmp{
get()};
418 constexpr bool operator==(strong_type
const & rhs)
const
419 requires ((skills & strong_type_skill::comparable) != strong_type_skill::none)
421 return get() == rhs.get();
425 constexpr bool operator!=(strong_type
const & rhs)
const
426 requires ((skills & strong_type_skill::comparable) != strong_type_skill::none)
428 return !(*
this == rhs);
438 explicit constexpr operator value_t() const
439 requires ((skills & strong_type_skill::convert) != strong_type_skill::none)
458template <detail::derived_from_strong_type strong_type_t>
459struct strong_type_printer<strong_type_t>
467 template <
typename stream_t,
typename arg_t>
468 constexpr void operator()(stream_t & stream, arg_t && arg)
const
Provides seqan3::add_enum_bitwise_operators.
Provides various type traits on generic types.
Provides seqan3::debug_stream and related types.
auto operator|(validator1_type &&vali1, validator2_type &&vali2)
Enables the chaining of validators.
Definition validators.hpp:1117
@ none
No flag is set.
Definition debug_stream_type.hpp:33
constexpr auto convert
A view that converts each element in the input range (implicitly or via static_cast).
Definition utility/views/convert.hpp:66
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
SeqAn specific customisations in the standard namespace.