|
| template<typename... ARGS> |
| constexpr | named (ARGS &&... args) noexcept(std::is_nothrow_constructible_v< T, ARGS... >) |
| template<typename U> |
| constexpr | named (U &&arg) noexcept(std::is_nothrow_move_constructible_v< T >) |
| template<typename U> |
| constexpr | named (U &&arg) noexcept(std::is_nothrow_move_constructible_v< T >) |
| template<typename U> |
| constexpr | named (U &&arg) noexcept(std::is_nothrow_move_constructible_v< T >) |
|
constexpr | named (named const &) noexcept(std::is_nothrow_copy_constructible_v< T >)=default |
|
constexpr | named (named &&) noexcept(std::is_nothrow_move_constructible_v< T >)=default |
|
constexpr named & | operator= (named const &) noexcept(std::is_nothrow_copy_assignable_v< T >)=default |
|
constexpr named & | operator= (named &&) noexcept(std::is_nothrow_move_assignable_v< T >)=default |
| template<typename U> |
| constexpr | named (U &&arg) |
| constexpr T & | operator* () &noexcept |
| constexpr T const & | operator* () const &noexcept |
| constexpr T | operator* () &&noexcept |
| constexpr T * | operator-> () noexcept |
| constexpr T const * | operator-> () const noexcept |
| constexpr T & | get () &noexcept |
| constexpr T const & | get () const &noexcept |
| constexpr T | get () &&noexcept |
| template<typename U> |
| constexpr U | as () noexcept |
| constexpr auto | drop () noexcept(std::is_nothrow_move_constructible_v< T >) |
| template<typename U, detail::FixedString OTHER_PARAMETER, typename... OTHER_CAPABILITIES> |
| constexpr | operator named< U, OTHER_PARAMETER, OTHER_CAPABILITIES... > () const |
| template<typename U> |
| constexpr | operator U () const |
| constexpr | operator bool () const noexcept |
| constexpr | operator base_type () const noexcept |
|
constexpr auto | operator<=> (named const &) const =default |
| template<typename U> |
| constexpr auto | operator<=> (U const &b) const |
| template<typename U> |
| constexpr bool | operator== (U const &b) const |
| constexpr named & | operator++ () |
| constexpr auto | operator+ (self_type const &val) const |
| constexpr auto | operator- () const |
| constexpr auto | operator+ () const |
| constexpr auto & | operator+= (self_type const &val) |
| constexpr auto | operator- (self_type const &val) const |
template<typename LOCATION_TYPE>
requires (has_trait<displacement>) && (traits::applies_to<LOCATION_TYPE, location>) && (traits::named_is_displacement_of<self_type, LOCATION_TYPE>) && (addable::applies_to<self_type, LOCATION_TYPE>) |
| constexpr auto | operator+ (LOCATION_TYPE &&val) const |
| | If we're a displacement, we can be added to a location.
|
template<typename DISPLACEMENT_TYPE>
requires (has_trait<location>) && (traits::applies_to<DISPLACEMENT_TYPE, displacement>) && (traits::named_is_displacement_of<DISPLACEMENT_TYPE, self_type>) && (addable::applies_to<self_type, DISPLACEMENT_TYPE>) |
| constexpr auto | operator+ (DISPLACEMENT_TYPE &&val) const |
| | If we're a location, we can be added to a displacement.
|
template<typename U>
requires has_trait<displacement> && std::constructible_from<T, decltype(std::declval<T>() * std::declval<U>())> |
| constexpr auto | operator* (U &&val) const |
template<typename U>
requires has_trait<displacement> && std::constructible_from<T, decltype(std::declval<T>() / std::declval<U>())> |
| constexpr auto | operator/ (U &&val) const |
| constexpr auto | operator/ (self_type const &val) const |
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
struct ghassanpl::named< T, PARAMETER, TRAITS >
Used to create a strong typedef of T.
By default, it needs to be explicitly constructed from its base type, and is not implicitly convertible to its base type. Most other operations need to be explicitly enabled via the TRAITS template parameter pack.
Usage:
length n = length{10} + length{20};
position n2 = position{100} + length{10};
auto nope = position{100} + position{200};
length yes = position{200} - position{100};
This trait implies the named type is an linear type, that is, a type that has the addition operator d...
Used in conjuction with traits::location, specifies which displacement type this is a location of.
This trait implies the named type is an affine type, that is, a type that does not have the addition ...
- Note
- Using this class involves a trade-off between creating a new type in a declarative style (specifying a base type for storage, and any operations you want this new type to have) and just writing a new struct by hand with all its necessary operators.
Definition at line 132 of file named.h.
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
If this type is marked as a location of a displacement type, this will be the type; if not, this will be void.
Definition at line 211 of file named.h.
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
template<typename U, detail::FixedString OTHER_PARAMETER, typename... OTHER_CAPABILITIES>
| ghassanpl::named< T, PARAMETER, TRAITS >::operator named< U, OTHER_PARAMETER, OTHER_CAPABILITIES... > |
( |
| ) |
const |
|
inlineconstexpr |
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
template<typename DISPLACEMENT_TYPE>
requires (has_trait<location>) && (traits::applies_to<DISPLACEMENT_TYPE, displacement>) && (traits::named_is_displacement_of<DISPLACEMENT_TYPE, self_type>) && (addable::applies_to<self_type, DISPLACEMENT_TYPE>)
| auto ghassanpl::named< T, PARAMETER, TRAITS >::operator+ |
( |
DISPLACEMENT_TYPE && | val | ) |
const |
|
inlineconstexpr |
If we're a location, we can be added to a displacement.
Definition at line 354 of file named.h.
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
template<typename LOCATION_TYPE>
requires (has_trait<displacement>) && (traits::applies_to<LOCATION_TYPE, location>) && (traits::named_is_displacement_of<self_type, LOCATION_TYPE>) && (addable::applies_to<self_type, LOCATION_TYPE>)
| auto ghassanpl::named< T, PARAMETER, TRAITS >::operator+ |
( |
LOCATION_TYPE && | val | ) |
const |
|
inlineconstexpr |
If we're a displacement, we can be added to a location.
Definition at line 342 of file named.h.
template<typename T, detail::FixedString PARAMETER, typename... TRAITS>
template<typename U>
requires has_trait<displacement> && std::constructible_from<T, decltype(std::declval<T>() * std::declval<U>())>
| auto operator* |
( |
U && | val, |
|
|
named< T, PARAMETER, TRAITS > | self ) |
|
friend |