From e8d4297f89f376558e93d2b9f3c3e18da2010212 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 29 Oct 2012 17:55:33 -0400 Subject: [PATCH] adding value compare to nullptr --- include/fc/value.hpp | 3 +++ src/value.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/include/fc/value.hpp b/include/fc/value.hpp index 84ca8f5..11d1354 100644 --- a/include/fc/value.hpp +++ b/include/fc/value.hpp @@ -86,6 +86,7 @@ namespace fc { value& operator=( value&& v ); value& operator=( const value& v ); + /** * Include fc/value_cast.hpp for implementation */ @@ -137,6 +138,8 @@ namespace fc { aligned<24> holder; }; + bool operator == ( const value& v, std::nullptr_t ); + bool operator != ( const value& v, std::nullptr_t ); struct value::key_val { key_val(){}; diff --git a/src/value.cpp b/src/value.cpp index fdce710..a3c0f2b 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -250,6 +250,12 @@ value::value( value::object& a ){ static_assert( sizeof(holder) >= sizeof( detail::value_holder_impl ), "size check" ); new (holder) detail::value_holder_impl(a); } +bool operator == ( const value& v, std::nullptr_t ) { + return v.is_null(); +} +bool operator != ( const value& v, std::nullptr_t ) { + return v.is_null(); +} value& value::operator=( value&& v ){ decltype(holder) tmp;