Yume
Public Member Functions | List of all members
yume::ast::AnyBase< T > Class Template Reference

Represents "any" kind of ast node of type T. See AnyExpr, AnyStmt and AnyType. More...

#include <ast.hpp>

Inheritance diagram for yume::ast::AnyBase< T >:
Inheritance graph
[legend]
Collaboration diagram for yume::ast::AnyBase< T >:
Collaboration graph
[legend]

Public Member Functions

 AnyBase ()=delete
 
 AnyBase (T *raw_ptr)
 
template<std::convertible_to< unique_ptr< T > > U>
 AnyBase (U uptr) noexcept
 
 AnyBase (OptionalAnyBase< T > &&other)
 
auto operator-> () const -> const T *
 
auto operator* () const -> const T &
 
auto operator-> () -> T *
 
auto operator* () -> T &
 
auto raw_ptr () const -> const T *
 
auto raw_ptr () -> T *
 
- Public Member Functions inherited from yume::ast::OptionalAnyBase< T >
 OptionalAnyBase ()
 
 OptionalAnyBase (T *raw_ptr)
 
template<std::convertible_to< unique_ptr< T > > U>
 OptionalAnyBase (U uptr)
 
 OptionalAnyBase (std::nullopt_t)
 
 OptionalAnyBase (optional< unique_ptr< T > > opt_uptr)
 
auto operator-> () const -> const T *
 
auto operator* () const -> const T &
 
auto operator-> () -> T *
 
auto operator* () -> T &
 
 operator bool () const
 
auto has_value () const -> bool
 
auto raw_ptr () const -> const T *
 
auto raw_ptr () -> T *
 

Detailed Description

template<typename T>
class yume::ast::AnyBase< T >

Represents "any" kind of ast node of type T. See AnyExpr, AnyStmt and AnyType.

This template exists to avoid passing around unique_ptr<T>s around in code that deals with AST nodes containing other generic nodes, such as Compound. This class also has strict nullptr checks when constructing, and cannot be default constructed. See OptionalAnyBase for a similar class which may be null.

Definition at line 184 of file ast.hpp.

Constructor & Destructor Documentation

◆ AnyBase() [1/4]

template<typename T >
yume::ast::AnyBase< T >::AnyBase ( )
delete

◆ AnyBase() [2/4]

template<typename T >
yume::ast::AnyBase< T >::AnyBase ( T *  raw_ptr)
inlineexplicit

Definition at line 189 of file ast.hpp.

References yume::ast::AnyBase< T >::raw_ptr(), and YUME_ASSERT.

◆ AnyBase() [3/4]

template<typename T >
template<std::convertible_to< unique_ptr< T > > U>
yume::ast::AnyBase< T >::AnyBase ( uptr)
inlinenoexcept

Definition at line 190 of file ast.hpp.

◆ AnyBase() [4/4]

template<typename T >
yume::ast::AnyBase< T >::AnyBase ( OptionalAnyBase< T > &&  other)
inline

Definition at line 193 of file ast.hpp.

Member Function Documentation

◆ operator*() [1/2]

template<typename T >
auto yume::ast::AnyBase< T >::operator* ( ) -> T&
inline

Definition at line 198 of file ast.hpp.

◆ operator*() [2/2]

template<typename T >
auto yume::ast::AnyBase< T >::operator* ( ) const -> const T&
inline

Definition at line 196 of file ast.hpp.

◆ operator->() [1/2]

template<typename T >
auto yume::ast::AnyBase< T >::operator-> ( ) -> T*
inline

Definition at line 197 of file ast.hpp.

◆ operator->() [2/2]

template<typename T >
auto yume::ast::AnyBase< T >::operator-> ( ) const -> const T*
inline

Definition at line 195 of file ast.hpp.

◆ raw_ptr() [1/2]

template<typename T >
auto yume::ast::AnyBase< T >::raw_ptr ( ) -> T*
inline

Definition at line 201 of file ast.hpp.

◆ raw_ptr() [2/2]

template<typename T >
auto yume::ast::AnyBase< T >::raw_ptr ( ) const -> const T*
inline

The documentation for this class was generated from the following file: