adding value compare to nullptr

This commit is contained in:
Daniel Larimer 2012-10-29 17:55:33 -04:00
parent 4ed6a02c39
commit e8d4297f89
2 changed files with 9 additions and 0 deletions

View file

@ -86,6 +86,7 @@ namespace fc {
value& operator=( value&& v ); value& operator=( value&& v );
value& operator=( const value& v ); value& operator=( const value& v );
/** /**
* Include fc/value_cast.hpp for implementation * Include fc/value_cast.hpp for implementation
*/ */
@ -137,6 +138,8 @@ namespace fc {
aligned<24> holder; aligned<24> holder;
}; };
bool operator == ( const value& v, std::nullptr_t );
bool operator != ( const value& v, std::nullptr_t );
struct value::key_val { struct value::key_val {
key_val(){}; key_val(){};

View file

@ -250,6 +250,12 @@ value::value( value::object& a ){
static_assert( sizeof(holder) >= sizeof( detail::value_holder_impl<value::object> ), "size check" ); static_assert( sizeof(holder) >= sizeof( detail::value_holder_impl<value::object> ), "size check" );
new (holder) detail::value_holder_impl<value::object>(a); new (holder) detail::value_holder_impl<value::object>(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 ){ value& value::operator=( value&& v ){
decltype(holder) tmp; decltype(holder) tmp;