From ed126a2d5e9441f62c5e66660b1f37bb632c83ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 15 Dec 2018 20:40:14 +0100 Subject: [PATCH] Optional type - Don't use target() in operators --- include/ebcl/inline/Types.hh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ebcl/inline/Types.hh b/include/ebcl/inline/Types.hh index d3717bc..5a3d2ac 100644 --- a/include/ebcl/inline/Types.hh +++ b/include/ebcl/inline/Types.hh @@ -891,7 +891,7 @@ template< typename T > inline T const& T_Optional< T >::operator*( ) const { if ( present_ ) { - return *target( ); + return *reinterpret_cast< T const* >( &storage_ ); } throw std::bad_cast( ); } @@ -900,7 +900,7 @@ template< typename T > inline T& T_Optional< T >::operator*( ) { if ( present_ ) { - return *target( ); + return *reinterpret_cast< T* >( &storage_ ); } throw std::bad_cast( ); } @@ -909,7 +909,7 @@ template< typename T > inline T const* T_Optional< T >::operator->( ) const { if ( present_ ) { - return target( ); + return reinterpret_cast< T const* >( &storage_ ); } throw std::bad_cast( ); } @@ -918,7 +918,7 @@ template< typename T > inline T* T_Optional< T >::operator->( ) { if ( present_ ) { - return target( ); + return reinterpret_cast< T* >( &storage_ ); } throw std::bad_cast( ); }