diff options
Diffstat (limited to 'src/include/rustic.hpp')
-rw-r--r-- | src/include/rustic.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/rustic.hpp b/src/include/rustic.hpp index f986a91d..84e98b31 100644 --- a/src/include/rustic.hpp +++ b/src/include/rustic.hpp @@ -69,6 +69,11 @@ public: return m_data; } + void if_set(::std::function<void (const T&)> f) const { + if( m_set ) { + return f(m_data); + } + } //template<typename U/*, class FcnSome, class FcnNone*/> //U match(::std::function<U(const T&)> if_some, ::Std::function<U()> if_none) const { // if( m_set ) { @@ -97,6 +102,11 @@ public: assert(is_some()); return *m_ptr; } + void if_set(::std::function<void (const T&)> f) const { + if( m_ptr ) { + return f(*m_ptr); + } + } //template<typename U/*, class FcnSome, class FcnNone*/> //U match(::std::function<U(const T&)> if_some, ::Std::function<U()> if_none) const { |