Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::pair< First, Second > Struct Template Reference

Type that represents a pair. More...

#include <pair.hpp>

Inheritance diagram for flecs::pair< First, Second >:
[legend]

Public Types

using type = conditional_t<!is_empty<First>::value || is_empty<Second>::value, First, Second>
 The storage type of the pair.
 
using first = First
 The first element type of the pair.
 
using second = Second
 The second element type of the pair.
 

Public Member Functions

 pair (type &v)
 Construct pair from a mutable reference to the storage type.
 
 pair (const type &v)
 Construct pair from a const reference to the storage type.
 
 operator type & ()
 Conversion to mutable reference of the storage type.
 
 operator const type & () const
 Conversion to const reference of the storage type.
 
typeoperator-> ()
 Arrow operator for mutable access.
 
const typeoperator-> () const
 Arrow operator for const access.
 
typeoperator* ()
 Dereference operator for mutable access.
 
const typeoperator* () const
 Dereference operator for const access.
 

Detailed Description

template<typename First, typename Second>
struct flecs::pair< First, Second >

Type that represents a pair.

The pair type can be used to represent a pair at compile time and is able to automatically derive the storage type associated with the pair, accessible through pair::type.

The storage type is derived using the following rules:

The pair type can hold a temporary value so that it can be used in the signatures of queries.

Definition at line 36 of file pair.hpp.

Member Typedef Documentation

◆ first

template<typename First , typename Second >
using flecs::pair< First, Second >::first = First

The first element type of the pair.

Definition at line 38 of file pair.hpp.

◆ second

template<typename First , typename Second >
using flecs::pair< First, Second >::second = Second

The second element type of the pair.

Definition at line 39 of file pair.hpp.

◆ type

template<typename First , typename Second >
using flecs::pair< First, Second >::type = conditional_t<!is_empty<First>::value || is_empty<Second>::value, First, Second>

The storage type of the pair.

Definition at line 37 of file pair.hpp.

Constructor & Destructor Documentation

◆ pair() [1/2]

template<typename First , typename Second >
flecs::pair< First, Second >::pair ( type & v)
inline

Construct pair from a mutable reference to the storage type.

Parameters
vReference to the value.

Definition at line 45 of file pair.hpp.

◆ pair() [2/2]

template<typename First , typename Second >
flecs::pair< First, Second >::pair ( const type & v)
inline

Construct pair from a const reference to the storage type.

This allows the class to be used as a temporary object.

Parameters
vConst reference to the value.

Definition at line 52 of file pair.hpp.

Member Function Documentation

◆ operator const type &()

template<typename First , typename Second >
flecs::pair< First, Second >::operator const type & ( ) const
inline

Conversion to const reference of the storage type.

Definition at line 60 of file pair.hpp.

◆ operator type &()

template<typename First , typename Second >
flecs::pair< First, Second >::operator type & ( )
inline

Conversion to mutable reference of the storage type.

Definition at line 55 of file pair.hpp.

◆ operator*() [1/2]

template<typename First , typename Second >
type & flecs::pair< First, Second >::operator* ( )
inline

Dereference operator for mutable access.

Definition at line 75 of file pair.hpp.

◆ operator*() [2/2]

template<typename First , typename Second >
const type & flecs::pair< First, Second >::operator* ( ) const
inline

Dereference operator for const access.

Definition at line 80 of file pair.hpp.

◆ operator->() [1/2]

template<typename First , typename Second >
type * flecs::pair< First, Second >::operator-> ( )
inline

Arrow operator for mutable access.

Definition at line 65 of file pair.hpp.

◆ operator->() [2/2]

template<typename First , typename Second >
const type * flecs::pair< First, Second >::operator-> ( ) const
inline

Arrow operator for const access.

Definition at line 70 of file pair.hpp.


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