From eaeac13e14000cbdaa184dfcb40b8214f3d1f290 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Wed, 8 Apr 2020 00:01:09 +0200 Subject: [PATCH] Allow some implicit conversions, I don't think it will hurt perf or anything. --- include/vectorwrapper/implem_vec_base.hpp | 3 +++ include/vectorwrapper/vectorwrapper.hpp.in | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/vectorwrapper/implem_vec_base.hpp b/include/vectorwrapper/implem_vec_base.hpp index 803c295..9fbf53a 100644 --- a/include/vectorwrapper/implem_vec_base.hpp +++ b/include/vectorwrapper/implem_vec_base.hpp @@ -80,6 +80,9 @@ namespace vwr { vector_type& data ( void ) { return m_wrapped; } const vector_type& data ( void ) const { return m_wrapped; } + operator vector_type&() {return this->data();} + operator const vector_type&() const {return this->data();} + template const typename std::enable_if::value and directly_convertible::value, V2>::type& cast ( void ) const; template diff --git a/include/vectorwrapper/vectorwrapper.hpp.in b/include/vectorwrapper/vectorwrapper.hpp.in index a467e12..99b6a46 100644 --- a/include/vectorwrapper/vectorwrapper.hpp.in +++ b/include/vectorwrapper/vectorwrapper.hpp.in @@ -231,7 +231,7 @@ namespace vwr { Vec ( void ) = default; Vec ( const Vec& ) = default; - explicit Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } + Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } template explicit Vec ( const typename std::enable_if::value and not std::is_same::value, T>::type& parX ) : implem::VecBase(parX) { } #if defined(VWR_WITH_IMPLICIT_CONVERSIONS) @@ -259,7 +259,7 @@ namespace vwr { Vec ( void ) = default; Vec ( const Vec& ) = default; - explicit Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } + Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } explicit Vec ( const scalar_type parX ) : implem::VecBase(parX) { } Vec ( scalar_type parX, scalar_type parY ) : implem::VecBase(parX, parY) { } #if defined(VWR_WITH_IMPLICIT_CONVERSIONS) @@ -289,7 +289,7 @@ namespace vwr { Vec ( void ) = default; Vec ( const Vec& ) = default; - explicit Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } + Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } explicit Vec ( const scalar_type parX ) : implem::VecBase(parX) { } Vec ( scalar_type parX, scalar_type parY, scalar_type parZ ) : implem::VecBase(parX, parY, parZ) { } #if defined(VWR_WITH_IMPLICIT_CONVERSIONS) @@ -320,7 +320,7 @@ namespace vwr { Vec ( void ) = default; Vec ( const Vec& ) = default; - explicit Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } + Vec ( const vector_type& parIn ) : implem::VecBase(parIn) { } explicit Vec ( const scalar_type parX ) : implem::VecBase(parX) { } Vec ( scalar_type parX, scalar_type parY, scalar_type parZ, scalar_type parW ) : implem::VecBase(parX, parY, parZ, parW) { } #if defined(VWR_WITH_IMPLICIT_CONVERSIONS)