AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::ChatCommands::Variant< T1, Ts > Struct Template Reference

#include "ChatCommandTags.h"

Inheritance diagram for Acore::ChatCommands::Variant< T1, Ts >:

Public Types

using base = std::variant< T1, Ts... >
 
using first_type = Acore::Impl::ChatCommands::tag_base_t< T1 >
 

Public Member Functions

template<bool C = have_operators>
std::enable_if_t< C, first_typeoperator* () const
 
template<bool C = have_operators>
 operator std::enable_if_t< C, first_type > () const
 
template<bool C = have_operators>
 operator std::enable_if_t< C &&!std::is_same_v< first_type, size_t > &&std::is_convertible_v< first_type, size_t >, size_t > () const
 
template<bool C = have_operators>
std::enable_if_t< C, bool > operator! () const
 
template<typename T >
Variantoperator= (T &&arg)
 
template<size_t index>
constexpr decltype(auto) get ()
 
template<size_t index>
constexpr decltype(auto) get () const
 
template<typename type >
constexpr decltype(auto) get ()
 
template<typename type >
constexpr decltype(auto) get () const
 
template<typename T >
constexpr decltype(auto) visit (T &&arg)
 
template<typename T >
constexpr decltype(auto) visit (T &&arg) const
 
template<typename T >
constexpr bool holds_alternative () const
 

Static Public Attributes

static constexpr bool have_operators = Acore::Impl::ChatCommands::are_all_assignable<first_type, Acore::Impl::ChatCommands::tag_base_t<Ts>...>::value
 

Friends

template<bool C = have_operators>
std::enable_if_t< C, std::ostream & > operator<< (std::ostream &os, Acore::ChatCommands::Variant< T1, Ts... > const &v)
 

Detailed Description

template<typename T1, typename... Ts>
struct Acore::ChatCommands::Variant< T1, Ts >

Member Typedef Documentation

◆ base

template<typename T1 , typename... Ts>
using Acore::ChatCommands::Variant< T1, Ts >::base = std::variant<T1, Ts...>

◆ first_type

template<typename T1 , typename... Ts>
using Acore::ChatCommands::Variant< T1, Ts >::first_type = Acore::Impl::ChatCommands::tag_base_t<T1>

Member Function Documentation

◆ get() [1/4]

template<typename T1 , typename... Ts>
template<size_t index>
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( )
inlineconstexpr
289{ return std::get<index>(static_cast<base&>(*this)); }
std::variant< T1, Ts... > base
Definition: ChatCommandTags.h:259

Referenced by debug_commandscript::HandleDebugSetValueCommand(), modify_commandscript::HandleModifyRepCommand(), and Acore::ChatCommands::PlayerIdentifier::TryConsume().

◆ get() [2/4]

template<typename T1 , typename... Ts>
template<typename type >
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( )
inlineconstexpr
293{ return std::get<type>(static_cast<base&>(*this)); }

◆ get() [3/4]

template<typename T1 , typename... Ts>
template<size_t index>
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( ) const
inlineconstexpr
291{ return std::get<index>(static_cast<base const&>(*this)); }

◆ get() [4/4]

template<typename T1 , typename... Ts>
template<typename type >
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( ) const
inlineconstexpr
295{ return std::get<type>(static_cast<base const&>(*this)); }

◆ holds_alternative()

template<typename T1 , typename... Ts>
template<typename T >
constexpr bool Acore::ChatCommands::Variant< T1, Ts >::holds_alternative ( ) const
inlineconstexpr

◆ operator std::enable_if_t< C &&!std::is_same_v< first_type, size_t > &&std::is_convertible_v< first_type, size_t >, size_t >()

template<typename T1 , typename... Ts>
template<bool C = have_operators>
Acore::ChatCommands::Variant< T1, Ts >::operator std::enable_if_t< C &&!std::is_same_v< first_type, size_t > &&std::is_convertible_v< first_type, size_t >, size_t > ( ) const
inline
278 {
279 return operator*();
280 }
std::enable_if_t< C, first_type > operator*() const
Definition: ChatCommandTags.h:265

References Acore::ChatCommands::Variant< T1, Ts >::operator*().

◆ operator std::enable_if_t< C, first_type >()

template<typename T1 , typename... Ts>
template<bool C = have_operators>
Acore::ChatCommands::Variant< T1, Ts >::operator std::enable_if_t< C, first_type > ( ) const
inline
272 {
273 return operator*();
274 }

References Acore::ChatCommands::Variant< T1, Ts >::operator*().

◆ operator!()

template<typename T1 , typename... Ts>
template<bool C = have_operators>
std::enable_if_t< C, bool > Acore::ChatCommands::Variant< T1, Ts >::operator! ( ) const
inline
283{ return !**this; }

◆ operator*()

template<typename T1 , typename... Ts>
template<bool C = have_operators>
std::enable_if_t< C, first_type > Acore::ChatCommands::Variant< T1, Ts >::operator* ( ) const
inline

◆ operator=()

template<typename T1 , typename... Ts>
template<typename T >
Variant & Acore::ChatCommands::Variant< T1, Ts >::operator= ( T &&  arg)
inline
286{ base::operator=(std::forward<T>(arg)); return *this; }

◆ visit() [1/2]

template<typename T1 , typename... Ts>
template<typename T >
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::visit ( T &&  arg)
inlineconstexpr
298{ return std::visit(std::forward<T>(arg), static_cast<base&>(*this)); }

Referenced by Acore::ChatCommands::Variant< T1, Ts >::operator*().

◆ visit() [2/2]

template<typename T1 , typename... Ts>
template<typename T >
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::visit ( T &&  arg) const
inlineconstexpr
300{ return std::visit(std::forward<T>(arg), static_cast<base const&>(*this)); }

Friends And Related Function Documentation

◆ operator<<

template<typename T1 , typename... Ts>
template<bool C = have_operators>
std::enable_if_t< C, std::ostream & > operator<< ( std::ostream &  os,
Acore::ChatCommands::Variant< T1, Ts... > const &  v 
)
friend
307 {
308 return (os << *v);
309 }

Member Data Documentation

◆ have_operators

template<typename T1 , typename... Ts>
constexpr bool Acore::ChatCommands::Variant< T1, Ts >::have_operators = Acore::Impl::ChatCommands::are_all_assignable<first_type, Acore::Impl::ChatCommands::tag_base_t<Ts>...>::value
staticconstexpr