I've been trying to read a bit of the C++ standard to figure out how enum's work. There's actually more there than I originally thought.
For a scoped enumeration, it's clear that the underlying type is int unless otherwise specified with an enum-base clause (it can be any integral type).
enum class color { red, green, blue}; // these ...
OK, I am considering of getting into c++ development in coming months (there is no set date). I am vaguely familiar with the language (primarily C), as well as some basics of OO, MI, templates, exceptions, patterns, used STL. And now I am at the point in time where I would like to master the language in depth. And the natural question i...
I'm buiding an API that allows me to fetch strings in various encodings, including utf8, utf16, utf32 and wchar_t (that may be utf32 or utf16 according to OS).
New C++ standard had introduced new types char16_t and char32_t that do not have this sizeof ambiguity and should be used in future, so I would like to support them as well, but...
Dear StackOverFlowers,
I will be parsing 60GB of text and doing a lot of insert and lookups in maps.
I just started using boost::unordered_set and boost::unordered_map
As my program starts filling in these containers they start growing bigger and bigger and i was wondering if this would be a good idea to pre allocate memory for these c...
I would like to see how this example of existing code would be able to take advantage of the C++0x initializer list feature.
Example0:
#include <vector>
#include <string>
struct Ask {
std::string prompt;
Ask(std::string a_prompt):prompt(a_prompt){}
};
struct AskString : public Ask{
int min;
int max;
AskString(std::s...
Does anyone know good URLs/Sites/mailing lists to track the current implementation progress of C++0x features in MSVC and GCC?
BTW: Yes I know there is boost but because I'm also very interested in the new language features I only want to know the progress in MSVC and GCC (as those are the two compilers we use for our projects).
...
Most of the compilers already support C++0x. Have you started using C++0x or are you waiting for the definition of x? I have to do some refactoring of my code; should I start using the new features?
...
In actual C++ standard creating collections satisfying following rules is hard if not impossible:
exception safety,
cheap internal operations (in actual STL containers: the operations are copies),
automatic memory management.
To satisfy (1) a collection can't store raw pointers. To satisfy (2) a collection must store raw pointers. To...
In C++ I would like to define some strings that will be used within a class but the values will be common over all instances. In C I would have used #defines. Here is an attempt at it:
#include <string>
class AskBase {
public:
AskBase(){}
private:
static std::string const c_REQ_ROOT = "^Z";
static std::string const c_REQ_PRE...
One of the C++0x improvements that will allow to write more efficient C++ code is the unique_ptr smart pointer (too bad, that it will not allow moving through memmove() like operations: the proposal didn't make into the draft).
What are other performance improvements in upcoming standard? Take following code for example:
vector<char *>...
Is there a compiler that has good support for the new C++0x?
I use GCC but unfortunately the current version 4.4 has a poor support for the new features.
...
What are excellent C++ IDE options that support the new standard c++0x (windows os friendly) besides visual .net 2010 (the beta is way too slow/clunky)?
...
I do know:
It wasn't in the CTP
It's slated to be in the final release
I can't find it in Beta 1
I want to play with it
...
For some reason, the following code never calls Event::Event(Event&& e)
Event a;
Event b;
Event temp;
temp = move(a);
a = move(b);
b = move(temp);
why not?
Using std::swap calls it once.
class Event {
public:
Event(): myTime(0.0), myNode(NULL) {}
Event(fpreal t, Node* n);
Event(Event&& other);
Event(Event const& othe...
We've been waiting forever to see if it's going to become a full-fledged language, and yet there doesn't seem to be a release of the formal definition. Just committees and discussions and revising.
Does anyone know of a planned deadline for C++0x, or are we going to have to start calling it C++1x?
...
The Evolution WG Issues List of 14 February 2004 has ...
EP003. #nomacros. See EI001. Note by
Stroustrup to be written.
In rough (or exact) terms, what is #nomacros, and is it available as an extension anywhere? It would have been a useful diagnostic tool in a recent project involving porting thousands of files of 1995-vintage C...
For example the c++0x interfaces
I am having a hard time figuring out when to use which of these things (cv, mutex and lock).
Can anyone please explain or point to a resource?
thanks in regard
...
Are there any differences between boost::shared_ptr, std::tr1::shared_ptr and the upcoming (in C++0x) std::shared_ptr?
Will porting from one to another have any overhead or are they basically the same?
...
I've been looking at the new features in c++0x and it really looks like it will be possible to program in a very functional programming style using it. I've gotten use to using the types List, Seq, Array in f# and I see no reason why their members couldn't be ported into some sort of c++0x template. It looks like microsoft is trying to...
I'm trying to learn the currently accepted features of c++0x and I'm having trouble with auto and decltype. As a learning exercise I'm extending the std class list with some generic functions.
template<class _Ty, class _Ax = allocator<_Ty>>
class FList : public std::list<_Ty, _Ax>
{
public:
void iter(const function<void (_Ty)>& f)
...