Description:
Discussion about C++ language, library, standards. (Moderated)
|
|
|
Moving cv-qualified objects
|
| |
Hi,
I find it a little surprising that 'std::move' doesn't strip away
cv-ness. Cv-ness only matters (other than minor technicalities) during
the lifetime of an object: both the constructor and the destructor
operate on a cv-less object. As moving is, logically, somewhat of an
early destruction, It seems only reasonable to expect that once an... more »
|
|
Smart pointer comparison - why a difference?
|
| |
In C++11, operator< for unique_ptr [unique.ptr.special] is defined as
std::less<CT>()(x.get(), y.get())
where CT is the common_type of the unique_ptr's internal pointer typedefs.
On the other hand, operator< for shared_ptr [util.smartptr.shared.cmp]
is defined as
std::less<V>()(a.get(), b.get())... more »
|
|
Atomic ordering: extended total order memory_order_seq_cst for locks
|
| |
There's this note in 29.3-p3: [ Note: Although it is not explicitly
required that S include locks, it can always be extended to an order
that does include lock and unlock operations, since the ordering
between those is already included in the "happens before" ordering. -
end note ]
What does it mean by "always"?... more »
|
|
An "intermediate value" in two-phase initialization
|
| |
Hi,
It looks like a global object (non-local variable with static storage
duration) can be initialized in two phases (not to mention the
"constant initialization"). So, there is a moment when the first phase
-- zero-initialization -- has set the variable to value 0, but the
dynamic initialization has not yet started; and at this point it may... more »
|
|
Different begin and end types in range-based for
|
| |
I'm not sure whether this is should be submitted as a DR or if I should
just live with it, but it would be convenient to have more flexibility
in implementing containers with range-based for.
6.5.4 [stmt.ranged] defines this statement:
for ( for-range-declaration : expression ) statement
as equivalent to:... more »
|
|
Reserve(n) for unordered containers reserves for n-1 elements.
|
| |
Hello,
When calling 'x.reserve(n)' for an unordered container I'd expect to
be able to insert n elements without invalidating iterators. But as
the standard is written, the guarantee only holds for n-1 elements.
For a container with max_load_factor of 1, reserve(n) is equivalent to
rehash(ceil(n/1)), which is rehash(n). rehash(n) requires that the... more »
|
|
Towards an object class for C++
|
| |
Hello all,
I would like to put here, in order to be discussed, what I think it's
still a missing point in the C++ standard library.
I'm trying to implement an object class for c++, like C# and java
have, but adapted to the c++ needs. My class is targeted at c++11 (not
c++03 for now). The main goals I want to achieve are:... more »
|
|
Diffs between C++98 and C++2003?
|
| |
I was, at one time, a fairly active participant in this group, and very
familiar with the C++98 standard. However, my job gave me no
opportunities to use what I knew about C++, so I had very little actual
experience with it. I lost interest in following C++ standardization
issues around the time the 2003 standard was being developed.... more »
|
|
make_shared and friends.
|
| |
Does the C++11 specification allow you to say that the `make_shared`
template is a friend, and thus guarantee that it can access the
appropriate private constructors of a class? Yes, there is syntax that
would make `make_shared` a friend. But does the spec *require* that
the constructors are called directly from `make_shared` itself, since... more »
|
|
|