diff options
author | Philipp A. Hartmann <pah@qo.cx> | 2014-11-17 15:27:54 +0300 |
---|---|---|
committer | Philipp A. Hartmann <pah@qo.cx> | 2014-11-17 15:27:54 +0300 |
commit | 6b69662ce8d34f72f4789497fef4034ca8e494c5 (patch) | |
tree | a749745f1d1dd39156838d3fd3a4b7da33eab151 /include/rapidjson/writer.h | |
parent | c35bbe54d9f34f6b054f664243492731e32224aa (diff) |
Writer: declare constructors as explicit
Avoids implicit conversion from an `OutputStream` (or an allocator pointer)
to a `Writer` instance.
Diffstat (limited to 'include/rapidjson/writer.h')
-rw-r--r-- | include/rapidjson/writer.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index dc41a1b1..02d66803 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -62,9 +62,11 @@ public: \param stackAllocator User supplied allocator. If it is null, it will create a private one.
\param levelDepth Initial capacity of stack.
*/
+ explicit
Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) :
os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), hasRoot_(false) {}
+ explicit
Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) :
os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), hasRoot_(false) {}
|