Speclib  0.1.2
The library for writing better CUDA libraries
sp::Variable< Name, T > Class Template Referencefinal

A variable that can be bound at run time. More...

#include <Var.hpp>

Inheritance diagram for sp::Variable< Name, T >:
[legend]

Public Types

using ValueType = T
 Type of the value the variable will bind to. More...
 
using Vars = VariableNames< Name >
 
template<VariableName N>
using VarType = std::conditional_t< N==Name, Variable< Name, T >, void >
 
template<typename... >
using ReplaceChildren = Variable< Name, T >
 
- Public Types inherited from sp::VariableUser< Variable< Name, sp::AnyType > >
using Substitute = std::conditional_t< std::is_same_v< Variable< Name, sp::AnyType >, Old >, New, typename DeferSubclass< Old >::template ReplaceChildren< typename Children::template Substitute< Old, New >... > >
 Recursively substitute the given old user with the given new user. More...
 
using Vars = typename sp::cat_integer_sequences< typename Children::Vars... >::template sort<>::template unique<>
 The set of unbound variable names. More...
 
using VarType = typename VarTypeHelper< typename Children::template VarType< Name >... >::type
 The type of a named variable. More...
 
using ChildType = typename sp::TypeList< Children... >::template get< I >
 The type of the Ith child. More...
 

Public Member Functions

template<VariableName N, typename U >
constexpr auto bind (U &&value) const
 
template<typename U >
constexpr auto bind (U &&value) const
 
- Public Member Functions inherited from sp::VariableUser< Variable< Name, sp::AnyType > >
constexpr decltype(auto) operator() (Ts &&... values) const
 Calls operator() on the result of binding this object to a set of variables. More...
 
constexpr auto & get ()
 Get the Ith child. More...
 
constexpr const auto & get () const
 Get the Ith child. More...
 
constexpr auto bind (Ts &&... values) const
 Bind a specified set of values to the corresponding variables in this expression. More...
 
constexpr auto bind (Ts &&... values) const
 Bind a set of values to the expression's variables. More...
 
constexpr auto substitute (const New &newValue) const
 Substitute all instances of the given type with the the given new value. More...
 
constexpr auto replaceChildren (NewChildren &&... newChildren) const
 Replace the children of this variable user with the given new children. More...
 

Static Public Attributes

static constexpr bool IsAnyType = std::is_same_v<std::remove_cvref_t<T>, AnyType>
 True if bind()-time type deduction is used rather than adopting a type specified by the variable. More...
 
static constexpr bool IsFullyBound = false
 
- Static Public Attributes inherited from sp::VariableUser< Variable< Name, sp::AnyType > >
static constexpr bool IsFullyBound
 True if there are no unbound variables, and false if there are. More...
 
static constexpr bool IsFullyUnbound
 False if there are any bound variables, and true if there aren't. More...
 
static constexpr int ChildCount
 The number of children. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from sp::VariableUser< Variable< Name, sp::AnyType > >
static constexpr VariableName getUnusedVariableName (int i=0)
 Get an unused variable name. More...
 
- Protected Member Functions inherited from sp::VariableUser< Variable< Name, sp::AnyType > >
constexpr VariableUser (Ts &&... children)
 Copy the arguments into the children tuple. More...
 

Detailed Description

template<VariableName Name, typename T = sp::AnyType>
class sp::Variable< Name, T >

A variable that can be bound at run time.

Template Parameters
NameThe name of the variable (currently, a single 32-bit character).
TThe type of the variable. If AnyType, then the type is not determined until bind() is called. A reference typed bound variable can be formed by specifying a type like const AnyType &.

Member Typedef Documentation

◆ ValueType

template<VariableName Name, typename T = sp::AnyType>
using sp::Variable< Name, T >::ValueType = T

Type of the value the variable will bind to.

Member Data Documentation

◆ IsAnyType

template<VariableName Name, typename T = sp::AnyType>
constexpr bool sp::Variable< Name, T >::IsAnyType = std::is_same_v<std::remove_cvref_t<T>, AnyType>
staticconstexpr

True if bind()-time type deduction is used rather than adopting a type specified by the variable.