AzerothCore 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, std::size_t > &&std::is_convertible_v< first_type, std::size_t >, std::size_t > () const
 
template<bool C = have_operators>
std::enable_if_t< C, bool > operator! () const
 
template<typename T >
Variantoperator= (T &&arg)
 
template<std::size_t index>
constexpr decltype(auto) get ()
 
template<std::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<std::size_t index>
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( )
inlineconstexpr
288{ return std::get<index>(static_cast<base&>(*this)); }
std::variant< T1, Ts... > base
Definition: ChatCommandTags.h:258

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
292{ return std::get<type>(static_cast<base&>(*this)); }

◆ get() [3/4]

template<typename T1 , typename... Ts>
template<std::size_t index>
constexpr decltype(auto) Acore::ChatCommands::Variant< T1, Ts >::get ( ) const
inlineconstexpr
290{ 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
294{ 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, std::size_t > &&std::is_convertible_v< first_type, std::size_t >, std::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, std::size_t > &&std::is_convertible_v< first_type, std::size_t >, std::size_t > ( ) const
inline
277 {
278 return operator*();
279 }
std::enable_if_t< C, first_type > operator*() const
Definition: ChatCommandTags.h:264

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
271 {
272 return operator*();
273 }

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
282{ 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
285{ 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
297{ 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
299{ 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
306 {
307 return (os << *v);
308 }

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