Decoded value - returning non-const primitives by ref

Reviewers: mferencevic, mislav.bradac

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D820
This commit is contained in:
florijan 2017-09-21 15:56:52 +02:00
parent 383175d85f
commit f2a82f4f58
2 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,10 @@
namespace communication::bolt {
#define DEF_GETTER_BY_VAL(type, value_type, field) \
value_type &DecodedValue::Value##type() { \
if (type_ != Type::type) throw DecodedValueException(); \
return field; \
} \
value_type DecodedValue::Value##type() const { \
if (type_ != Type::type) throw DecodedValueException(); \
return field; \

View File

@ -122,6 +122,7 @@ class DecodedValue {
Type type() const { return type_; }
#define DECL_GETTER_BY_VALUE(type, value_type) \
value_type &Value##type(); \
value_type Value##type() const;
DECL_GETTER_BY_VALUE(Bool, bool)