Make default constructor non-explicit (#48)

It is better to support copy-initialization with default constructor. cf. LWG Issue 2193. Default constructors for standard library containers are explicit.
This commit is contained in:
Miutsuru kariya
2019-06-13 08:45:11 +09:00
committed by Glen Fernandes
parent 26918f80d5
commit ab192ca5f1
3 changed files with 30 additions and 9 deletions

View File

@@ -144,8 +144,11 @@ public:
typedef bool <a href="#const_reference">const_reference</a>;
<a href=
"#cons0">dynamic_bitset</a>();
explicit <a href=
"#cons1">dynamic_bitset</a>(const Allocator&amp; alloc = Allocator());
"#cons1">dynamic_bitset</a>(const Allocator&amp; alloc);
explicit <a href=
"#cons2">dynamic_bitset</a>(size_type num_bits, unsigned long value = 0,
@@ -570,19 +573,30 @@ The maximum value of <tt>size_type</tt>.
<hr />
<pre>
<a id=
"cons1">dynamic_bitset</a>(const Allocator&amp; alloc = Allocator())
"cons0">dynamic_bitset</a>()
</pre>
<b>Effects:</b> Constructs a bitset of size zero. The allocator
for this bitset is a default-constructed object of type
<tt>Allocator</tt>.<br />
<b>Postconditions:</b> <tt>this-&gt;size() == 0</tt>.<br />
<b>Throws:</b> Nothing unless the default constructor of
<tt>Allocator</tt> throws an exception.<br />
(Required by <a href=
"https://boost.org/sgi/stl/DefaultConstructible.html">Default
Constructible</a>.)
<hr />
<pre>
<a id=
"cons1">dynamic_bitset</a>(const Allocator&amp; alloc)
</pre>
<b>Effects:</b> Constructs a bitset of size zero. A copy of the
<tt>alloc</tt> object will be used in subsequent bitset
operations such as <tt>resize</tt> to allocate memory.<br />
<b>Postconditions:</b> <tt>this-&gt;size() == 0</tt>.<br />
<b>Throws:</b> An allocation error if memory is exhausted
(<tt>std::bad_alloc</tt> if
<tt>Allocator=std::allocator</tt>).<br />
(Required by <a href=
"https://boost.org/sgi/stl/DefaultConstructible.html">Default
Constructible</a>.)
<b>Throws:</b> nothing.
<hr />
<pre>