Writer: declare constructors as explicit

Avoids implicit conversion from an `OutputStream` (or an allocator pointer)
to a `Writer` instance.
This commit is contained in:
Philipp A. Hartmann 2014-11-17 13:27:54 +01:00
parent c35bbe54d9
commit 6b69662ce8

View File

@ -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) {}