Description:
Discussion about C++ language, library, standards. (Moderated)
|
|
|
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 »
|
|
Container adaptor - missing container support operation
|
| |
Hi,
I read N3337's Container adaptors specification.
I think missing support operation : emplace_back().
23.6.3.1 queue definition
Any sequence container supporting operations front(), back(),
push_back() and pop_front() can be used to instantiate queue.
=> add emplace_back().
23.6.4 Class template priority_queue... more »
|
|
ADL: should this compile?
|
| |
GCC version 4.7 seems to have fixed a bug
([link]), but I'm wondering
if it caused another.
Should this C++ code compile? I think ADL requires it to, but I'm not certain.
template<class T>
int t(T i)
{
return f(i);
...
struct a{};
int f(a i)... more »
|
|
The evolution of C++
|
| |
hello, world\n
I'm writing a lexer aiming to be able to tokenize all the variations of
the C and C++ languages. My knowledge of the C++ side of things is
likely incomplete, so I ask the C++ community to tell me where I'm
missing something. So far I have come up with this matrix of token
additions since K&R.... more »
|
|
Typo in the Working Draft of the C++ Standard # 3337
|
| |
I found a typo in the Working Draft of the C++ Standard #3337 in
paragraph #2 of the section 11.3 Friends. There is the following
example
[ Example:
class A {
class B { };
friend class X;
...struct X : A::B { // OK: A::B accessible to friend
A::B mx; // OK: A::B accessible to member of friend... more »
|
|
|