use std::make_shared where possible

may avoid extra alloc for ref. counter
This commit is contained in:
Michael Davidsaver
2019-12-19 13:55:40 -08:00
parent 71905b314b
commit 68cb777702
7 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -530,7 +530,7 @@ void from_wire_field(Buffer& buf, TypeStore& ctxt, const FieldDesc* desc, const
break;
case TypeCode::Any: {
std::shared_ptr<std::vector<FieldDesc>> descs(new std::vector<FieldDesc>);
auto descs(std::make_shared<std::vector<FieldDesc>>());
TypeDeserContext dc{*descs, ctxt};
from_wire(buf, dc);
@@ -641,7 +641,7 @@ void from_wire_field(Buffer& buf, TypeStore& ctxt, const FieldDesc* desc, const
for(auto& elem : arr) {
if(from_wire_as<uint8_t>(buf)!=0) { // strictly 1 or 0
std::shared_ptr<std::vector<FieldDesc>> descs(new std::vector<FieldDesc>);
auto descs(std::make_shared<std::vector<FieldDesc>>());
TypeDeserContext dc{*descs, ctxt};
from_wire(buf, dc);
@@ -703,7 +703,7 @@ void from_wire_valid(Buffer& buf, TypeStore& ctxt, Value& val)
void from_wire_type_value(Buffer& buf, TypeStore& ctxt, Value& val)
{
std::shared_ptr<std::vector<FieldDesc>> descs(new std::vector<FieldDesc>);
auto descs(std::make_shared<std::vector<FieldDesc>>());
TypeDeserContext dc{*descs, ctxt};
from_wire(buf, dc);