2.10.0
Freundlich's C++ toolkit
Classes | Functions
fcppt.ref

Description

Reference wrappers for incomplete types.

Classes

struct  fcppt::add_reference< Type >
 Metafunction that adds fcppt::reference. More...
 
struct  fcppt::is_reference< Type >
 Tests if a type is an fcppt::reference. More...
 
class  fcppt::reference< Type >
 A simple reference wrapper that supports incomplete types. More...
 
struct  fcppt::reference< Type >>
 A hash for fcppt::reference that hashes pointers. More...
 

Functions

template<typename Type >
fcppt::reference< Type const > fcppt::make_cref (Type const &_ref) noexcept
 Convenience function to create const references. More...
 
template<typename Type >
fcppt::reference< Type > fcppt::make_ref (Type &_ref) noexcept
 Convenience function to create references. More...
 
template<typename T >
bool fcppt::operator== (fcppt::reference< T > const &_a, fcppt::reference< T > const &_b) noexcept
 Compares two references for equality. More...
 
template<typename T >
bool fcppt::operator!= (fcppt::reference< T > const &_a, fcppt::reference< T > const &_b) noexcept
 Compares two references for inequality. More...
 
template<typename T >
bool fcppt::operator< (fcppt::reference< T > const &_a, fcppt::reference< T > const &_b) noexcept
 Compares two references lexicographically. More...
 
template<typename T , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits > & fcppt::operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::reference< T > const &_ref)
 Outputs a reference wrapper to a stream. More...
 
template<typename Base , typename Type >
fcppt::reference< Base > fcppt::reference_to_base (fcppt::reference< Type > const _ref) noexcept
 Converts a reference to a base class. More...
 
template<typename Type >
fcppt::reference< Type const > fcppt::reference_to_const (fcppt::reference< Type > const _ref) noexcept
 Converts a reference to a const reference. More...
 

Function Documentation

◆ make_cref()

template<typename Type >
fcppt::reference< Type const> fcppt::make_cref ( Type const &  _ref)
inlinenoexcept

Convenience function to create const references.

◆ make_ref()

template<typename Type >
fcppt::reference< Type> fcppt::make_ref ( Type &  _ref)
inlinenoexcept

Convenience function to create references.

◆ operator!=()

template<typename T >
bool fcppt::operator!= ( fcppt::reference< T > const &  _a,
fcppt::reference< T > const &  _b 
)
noexcept

Compares two references for inequality.

Compares _a and _b for inequality. Equal to !(_a == _b).

Parameters
_aThe first reference
_bThe second reference

◆ operator<()

template<typename T >
bool fcppt::operator< ( fcppt::reference< T > const &  _a,
fcppt::reference< T > const &  _b 
)
noexcept

Compares two references lexicographically.

Compares _a and _b lexicographically by comparing the stored pointers via std::less.

Parameters
_aThe first reference
_bThe second reference

◆ operator<<()

template<typename T , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits>& fcppt::operator<< ( std::basic_ostream< Ch, Traits > &  _stream,
fcppt::reference< T > const &  _ref 
)

Outputs a reference wrapper to a stream.

◆ operator==()

template<typename T >
bool fcppt::operator== ( fcppt::reference< T > const &  _a,
fcppt::reference< T > const &  _b 
)
noexcept

Compares two references for equality.

Compares _a and _b for equality. Two references are equal if they refer to the same object.

Parameters
_aThe first reference
_bThe second reference

◆ reference_to_base()

template<typename Base , typename Type >
fcppt::reference< Base> fcppt::reference_to_base ( fcppt::reference< Type > const  _ref)
inlinenoexcept

Converts a reference to a base class.

Template Parameters
BaseMust be a base class of Type

◆ reference_to_const()

template<typename Type >
fcppt::reference< Type const> fcppt::reference_to_const ( fcppt::reference< Type > const  _ref)
inlinenoexcept

Converts a reference to a const reference.

Template Parameters
TypeMust not be const