c++0x

How the C++0x standard defines C++ Auto multiple declarations?

mmm, I have just a little confusion about multiple auto declarations in the upcoming C++0x standard. auto a = 10, b = 3.f , * c = new Class(); somewhere I read it is not allowed. The reason was(?) because it was not clear if the consecutive declarations should have the same type of the first one , (int in the example) , or not. Poss...

C++0x atomic template implementation

I know that similar template exits in Intel's TBB, besides that I can't find any implementation on google or in Boost library. ...

C++0x: Range overloads for standard algorithms?

std::sort(range(c)); as opposed to std::sort(c.begin(), c.end(); Do you expect the next standard to provide range overloads for standard algorithms? Boost's range iterators are something similar, and Bjarne Stroustrup's iseq()s mentioned in TC++PL3e are also the same idea. I have looked at the latest draft I could find but didn't ...

Copy-on-write with shared_ptr when multithreading

In the absence of multithreading, the implementation of copy-on-write for shared_ptr (either from boost or tr1) using unique() is straightforward. Which changes need to be made when multithreading? The reference count is atomic so I assume I can create, copy-construct, read and destroy instances of shared_ptr without further concerns. H...

Does C++0x support std::wstring conversion to/from UTF-8 byte sequence ?

I saw that C++0x will add support for UTF-8, UTF-16 and UTF-32 literals. But what about conversions between the three representations ? I plan to use std::wstring everywhere in my code. But I also need to manipulate UTF-8 encoded data when dealing with files and network. Will C++0x provide also support for these operations ? ...

templated typedef ?

I'm using libgc, a garbage collector for C and C++. To make STL containers garbage collectible one must use the gc_allocator. Instead of writing std::vector<MyType> one has to write std::vector<MyType,gc_allocator<MyType> > Could there be a way to define something like template<class T> typedef std::vector<T,gc_allocator<T> ...

C++ compiler that supports C++0x features?

Is where any C++ compiler that supports C++0x features already? ...

C++0x, How do I expand a tuple into variadic template function arguments?

Consider the case of a templated function with variadic template arguments: template<typename Tret, typename... T> Tret func(const T&... t); Now, I have a tuple t of values. How do I call func() using the tuple values as arguments? I've read about the bind() function object, with call() function, and also the apply() function in diffe...

Template Meta-programming with Char Arrays as Parameters.

I'm playing around with TMP in GCC 4.3.2's half-implementation of C++0x, and I was wondering if there was a way to somehow do the following: template <char x, char... c> struct mystruct { ... }; int main () { mystruct<"asdf">::go(); } It obviously won't let me do it just like that, and I thought I'd get lucky by using user-defin...

Preparing for the next C++ standard

The spate of questions regarding BOOST_FOREACH prompts me to ask users of the Boost library what (if anything) they are doing to prepare their code for portability to the proposed new C++ standard (aka C++0x). For example, do you write code like this if you use shared_ptr: #ifdef CPPOX #include <memory> #else #include "boost/shared_ptr....

How do I use regex_replace from TR1?

I've not been able to get regex_replace from TR1 working. #include <iostream> #include <string> #include <tr1/regex> int main() { std::string str = "Hello world"; std::tr1::regex rx("world"); std::string replacement = "planet"; std::string str2 = std::tr1::regex_replace(str, rx, replacement); std::cout << str2 << "\n"; } str2 is an ...

Should I reject C++ because it's becoming a juggernaut?

I have tried to keep up with C++ since they introduced 1998 ANSI/ISO C++. I absorbed the new concepts and tried to understand them. I learned about exception handling, templates, and namespaces. I've read about the new cast mechanisms and worked with the STL library. All of these concepts required a lot of energy. But now I am somewhat ...

Which are the features of C++0x that will remain for sure (if any)?

Are there any features of C++0x that are known to be there for sure? Like, maybe, threads in the standard library? ...

are they adding copy_if to c++0x?

It's very annoying that copy_if is not in C++. Does anyone know if it will be in C++0x? ...

What's the point in defaulting functions in C++0x

C++0x adds the ability for telling the compiler to create a default implementation or any of the special member functions, while I can see the value of deleting a function where's the value of explicitly defaulting a function? Just leave it blank and the compiler will do it anyway. The only point I can see is that a default constructor ...

how do I use STL algorithms with a vector of pointers

I have a vector of pointers that are not owned by the container. How do I use algorithms on the targets of the pointers. I tried to use boost's ptr_vector, but it tries to delete the pointers when it goes out of scope. Here is some code that needs to work: vector<int*> myValues; // ... myValues is populated bool consistent = count(my...

C++0x: a new language?

Hi all. Recently I started reading (just a bit) the current draft for the future C++0x standard. There are lots of new features, some of them already available via Boost Libs. Of course, I'm pretty happy with this new standard and I'd like to play with all the new features as soon as possibile. Anyway, speaking about this draft with ...

Why are C++0x rvalue reference not the default?

One of the cool new features of the upcoming C++ standard, C++0x, are "rvalue references." An rvalue reference is similar to an lvalue (normal) reference, except that it can be bound to a temporary value (normally, a temporary can only be bound to a const reference): void FunctionWithLValueRef(int& a) {...} void FunctionWithRValueRef(in...

What is R-Value reference that is about to come in next c++ standard?

What is R-Value reference that is about to come in next c++ standard? ...

C++0x: how to ask for a small addition? (syntax of pure virtual functions)

Hi all. In the current C++0x draft I've noticed they introduced some new explicit keywords to highlight expected behaviors (great move!). Examples: defaulted/deleted functions (= default and = delete), the new nullptr constant, the explicit keyword usable also for conversion operators, ... So I expected to see also a = pure syntax for...