Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Classes | Namespaces | Typedefs | Functions
variant.hpp File Reference

This file contains the declaration of a two-element variant type. More...

#include <memory>
#include <type_traits>
Include dependency graph for variant.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  smith::detail::variant_storage< T0, T1, SFINAE >
 Storage abstraction to provide trivial destructor when both variant types are trivially destructible. More...
 
struct  smith::detail::variant_storage< T0, T1, std::enable_if_t< std::is_trivially_destructible_v< T0 > &&std::is_trivially_destructible_v< T1 > > >
 
struct  smith::detail::is_variant_assignable< T, T0, T1 >
 Determines if T can be assigned to a variant<T0, T1> More...
 
struct  smith::variant_alternative< 0, T0, T1 >
 Obtains the type at index 0 of a variant<T0, T1> More...
 
struct  smith::variant_alternative< 1, T0, T1 >
 Obtains the type at index 1 of a variant<T0, T1> More...
 
struct  smith::variant< T0, T1 >
 A simple variant type that supports only two elements. More...
 

Namespaces

 smith
 Accelerator functionality.
 
 smith::detail
 Internal solid mechanics builder after coupling fields are assembled.
 

Typedefs

template<typename T >
using smith::detail::MaybeOwningPointer = variant< T *, std::unique_ptr< T > >
 A helper type for uniform semantics over owning/non-owning pointers. More...
 

Functions

template<typename T , typename T0 , typename T1 >
constexpr T & smith::get (variant< T0, T1 > &v)
 Returns the variant member of specified type. More...
 
template<typename T , typename T0 , typename T1 >
constexpr const T & smith::get (const variant< T0, T1 > &v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename Visitor , typename Variant >
constexpr decltype(auto) smith::visit (Visitor visitor, Variant &&v)
 Applies a functor to the active variant element. More...
 
template<typename T , typename T0 , typename T1 >
bool smith::holds_alternative (const variant< T0, T1 > &v)
 Checks whether a variant's active member is of a certain type. More...
 
template<typename T , typename T0 , typename T1 >
T * smith::get_if (variant< T0, T1 > *v)
 Returns the member of requested type if it's active, otherwise nullptr. More...
 
template<typename T , typename T0 , typename T1 >
const T * smith::get_if (const variant< T0, T1 > *v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Detailed Description

This file contains the declaration of a two-element variant type.

This is necessary to work around an issue reported to LC in April 2021 regarding the use of the GCC 8 libstdc++ variant header with NVCC 11. As of July 2021 this has not been fixed. Additionally, the non-recursive implementation here should reduce compile times, though this effect may be limited for a variant with only two alternatives.

Definition in file variant.hpp.