File variant.hxx#
Variant utilities
All in namespace bout::utils
variantvisitholds_alternativegetvariantEqualTovariantStaticCastOrThrowvariantToString
Internal implementation in bout::utils::details
Defines
-
__VARIANT_HXX__#
-
namespace bout
Information about the version of BOUT++
The build system will update this file on every commit, which may result in files that include it getting rebuilt. Therefore it should be included in as few places as possible
Information about the version of BOUT++
The build system will update this file at configure-time
Explicit inversion of a 3x3 matrix
aIf the matrix is singular (ill conditioned), the determinant is return. Otherwise, an empty
std::optionalis return-
namespace utils
Functions
-
template<typename Variant, typename T>
bool variantEqualTo(const Variant &v, const T &t)# Return true only if the given variant
vhas the same type and value astNote: Handles the case that
tis not of a type whichvcan hold.
-
template<typename T, typename ...ALL_T>
struct isVariantMember<T, variant<ALL_T...>> : public bout::utils::details::disjunction<std::is_same<T, ALL_T>...># Is type
Ta member of variantvariant<ALL_T>?
-
namespace details#
-
template<typename T, typename U>
struct CompareTypes# Compare two values. Different types -> false
-
template<typename T>
struct CompareTypes<T, T># Compare two values Same type -> use
==operator to compare
-
template<typename T>
struct IsEqual# A visitor for std::variant which compares the value stored in the variant with a given value using CompareTypes
Public Functions
-
template<class B1, class ...Bn>
struct disjunction<B1, Bn...> : public std::conditional_t<bool(B1::value), B1, disjunction<Bn...>>#
-
template<typename Target>
struct StaticCastOrThrow# Functor to perform static casting with std::visit If the Target cannot be constructed from the Source then an exception (std::bad_cast) will be thrown at run time.
Note: This needs to be at runtime because the particular type which a variant is holding is only known at runtime.
-
struct ToString#
-
template<typename T, typename U>
-
template<typename Variant, typename T>
-
namespace utils