Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 5e403e0

Browse files
authored
Pass AttributeValueRef by value to AttributeValue constructor. (#40)
This can potentially avoid materializing the AttributeValueRef object, which is essentially POD and has no destructor.
1 parent 63cbc76 commit 5e403e0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

opencensus/trace/exporter/attribute_value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AttributeValue final {
3838
// The type of value held by this object.
3939
using Type = AttributeValueRef::Type;
4040

41-
explicit AttributeValue(const AttributeValueRef& ref);
41+
explicit AttributeValue(AttributeValueRef ref);
4242
~AttributeValue();
4343

4444
// AttributeValue is copyable and movable.

opencensus/trace/internal/attribute_value.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ namespace opencensus {
2525
namespace trace {
2626
namespace exporter {
2727

28-
AttributeValue::AttributeValue(const AttributeValueRef& ref)
29-
: type_(ref.type()) {
28+
AttributeValue::AttributeValue(AttributeValueRef ref) : type_(ref.type()) {
3029
switch (type_) {
3130
case Type::kString:
3231
new (&string_value_) std::string(ref.string_value());

0 commit comments

Comments
 (0)