Types - T_Optional access
Changed so it's relatively similar to the interface of pointers.
This commit is contained in:
parent
82fc8406b3
commit
46fa84d967
5 changed files with 48 additions and 21 deletions
include/ebcl/inline
|
@ -103,12 +103,12 @@ inline size_t T_SRDLocation::byte( ) const noexcept
|
|||
|
||||
inline bool T_SRDLocation::isChained( ) const noexcept
|
||||
{
|
||||
return chaining_.present( );
|
||||
return chaining_;
|
||||
}
|
||||
|
||||
inline T_SRDLocationChaining const& T_SRDLocation::chaining( ) const noexcept
|
||||
{
|
||||
return chaining_;
|
||||
return *chaining_;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -864,11 +864,17 @@ inline void T_Optional< T >::clear( ) noexcept
|
|||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
template< typename T >
|
||||
inline constexpr bool T_Optional< T >::present( ) const noexcept
|
||||
inline constexpr T_Optional< T >::operator bool( ) const noexcept
|
||||
{
|
||||
return present_;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline constexpr bool T_Optional< T >::operator!( ) const noexcept
|
||||
{
|
||||
return !present_;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline constexpr T const* T_Optional< T >::target( ) const noexcept
|
||||
{
|
||||
|
@ -882,7 +888,7 @@ inline constexpr T* T_Optional< T >::target( ) noexcept
|
|||
}
|
||||
|
||||
template< typename T >
|
||||
inline T_Optional< T >::operator T const&( ) const
|
||||
inline T const& T_Optional< T >::operator*( ) const
|
||||
{
|
||||
if ( present_ ) {
|
||||
return *target( );
|
||||
|
@ -891,7 +897,7 @@ inline T_Optional< T >::operator T const&( ) const
|
|||
}
|
||||
|
||||
template< typename T >
|
||||
inline T_Optional< T >::operator T& ( )
|
||||
inline T& T_Optional< T >::operator*( )
|
||||
{
|
||||
if ( present_ ) {
|
||||
return *target( );
|
||||
|
@ -899,6 +905,24 @@ inline T_Optional< T >::operator T& ( )
|
|||
throw std::bad_cast( );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T const* T_Optional< T >::operator->( ) const
|
||||
{
|
||||
if ( present_ ) {
|
||||
return target( );
|
||||
}
|
||||
throw std::bad_cast( );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T* T_Optional< T >::operator->( )
|
||||
{
|
||||
if ( present_ ) {
|
||||
return target( );
|
||||
}
|
||||
throw std::bad_cast( );
|
||||
}
|
||||
|
||||
|
||||
/*= T_Union ==================================================================*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue