summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-03-06 23:54:24 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-03-06 23:54:24 +0000
commit6b1ee2e9fcd92b8c7b57981831d472a2fbd16794 (patch)
tree7156a255628ae15d30b06aa0964d9d5eddbc9579 /staging_vespalib
parent7489a256cdad97cff15644f55e89023d103c2c05 (diff)
Use reference wrapper.
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/objects/object2slime.cpp22
-rw-r--r--staging_vespalib/src/vespa/vespalib/objects/object2slime.h4
2 files changed, 13 insertions, 13 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/objects/object2slime.cpp b/staging_vespalib/src/vespa/vespalib/objects/object2slime.cpp
index 7bfacc778bd..dc2bc3ef01c 100644
--- a/staging_vespalib/src/vespa/vespalib/objects/object2slime.cpp
+++ b/staging_vespalib/src/vespa/vespalib/objects/object2slime.cpp
@@ -6,7 +6,7 @@
namespace vespalib {
Object2Slime::Object2Slime(slime::Cursor & cursor)
- : _cursor(&cursor),
+ : _cursor(cursor),
_stack()
{
}
@@ -21,10 +21,10 @@ Object2Slime::openStruct(const vespalib::string &name, const vespalib::string &t
_stack.push_back(_cursor);
if (name.empty()) {
- _cursor = & _cursor->setObject(type);
+ _cursor = _cursor.get().setObject(type);
} else {
- _cursor = & _cursor->setObject(name);
- _cursor->setString("[type]", type);
+ _cursor = _cursor.get().setObject(name);
+ _cursor.get().setString("[type]", type);
}
}
@@ -38,37 +38,37 @@ Object2Slime::closeStruct()
void
Object2Slime::visitBool(const vespalib::string &name, bool value)
{
- _cursor->setBool(name, value);
+ _cursor.get().setBool(name, value);
}
void
Object2Slime::visitInt(const vespalib::string &name, int64_t value)
{
- _cursor->setLong(name, value);
+ _cursor.get().setLong(name, value);
}
void
Object2Slime::visitFloat(const vespalib::string &name, double value)
{
- _cursor->setDouble(name, value);
+ _cursor.get().setDouble(name, value);
}
void
Object2Slime::visitString(const vespalib::string &name, const vespalib::string &value)
{
- _cursor->setString(name, value);
+ _cursor.get().setString(name, value);
}
void
Object2Slime::visitNull(const vespalib::string &name)
{
- _cursor->setNix(name);
+ _cursor.get().setNix(name);
}
void
Object2Slime::visitNotImplemented()
{
- _cursor->setNix("not_implemented");
+ _cursor.get().setNix("not_implemented");
}
-} // namespace vespalib
+}
diff --git a/staging_vespalib/src/vespa/vespalib/objects/object2slime.h b/staging_vespalib/src/vespa/vespalib/objects/object2slime.h
index f4bd66275ed..50d22b29969 100644
--- a/staging_vespalib/src/vespa/vespalib/objects/object2slime.h
+++ b/staging_vespalib/src/vespa/vespalib/objects/object2slime.h
@@ -15,8 +15,8 @@ namespace slime { class Cursor; }
class Object2Slime : public ObjectVisitor
{
private:
- slime::Cursor * _cursor;
- std::vector<slime::Cursor *> _stack;
+ std::reference_wrapper<slime::Cursor> _cursor;
+ std::vector<std::reference_wrapper<slime::Cursor>> _stack;
public:
Object2Slime(slime::Cursor & cursor);