It has been mentioned in several sources that C++0x will include better language-level support for Unicode(including types and literals).
If the language is going to add these new features, it's only natural to assume that the standard library will as well.
However, I am currently unable to find any references to the new standard librar...
I'm trying to get a simple delete every pointer in my vector/list/... function written with an ultra cool lambda function. Mind you, I don't know c**p about those things :)
template <typename T>
void delete_clear(T const& cont)
{
for_each(T.begin(), T.end(), [](???){ ???->delete() } );
}
I have no clue what to fill in for the ???'...
The working draft explicitly calls out that defaulted-functions must be special member functions (eg copy-constructor, default-constructor, etc, (§8.4.2.1-1)). Which makes perfect sense.
However, I don't see any such restriction on deleted-functions(§8.4.3). Is that right?
Or in other words are these three examples valid c++0?
struc...
I am confused with unique_ptr and rvalue move philosophy.
Let's say we have two collections:
std::vector<std::auto_ptr<int>> autoCollection;
std::vector<std::unique_ptr<int>> uniqueCollection;
Now I would expect the following to fail, as there is no telling what the algorithm is doing internally and maybe making internal pivot copies...
Is it allowed by the Boost License to just add the source code of the stuff I need to my project (accompanied by the license of course?). I couldn't find any "descriptive" confirmation. I would have seperate Include/boost and Source/boost directories for easy access.
PS: Seeing as boost::filesystem is going into C++0x TR2, and lambda, r...
How do the Lambda Expressions / Closures in C++0x complicate the memory management in C++? Why do some people say that closures have no place in languages with manual memory management? Is their claim valid and if yes, what are the reasons behind it?
...
I don't know how to build Boost with C++0x compilers. Which option must be given to bjam? Should the user.config file be modified?Can someone help me?
Best,
Vicente
...
Using C++0x, how do I capture a variable when I have a lambda within a lambda? For example:
std::vector<int> c1;
int v = 10; <--- I want to capture this variable
std::for_each(
c1.begin(),
c1.end(),
[v](int num) <--- This is fine...
{
std::vector<int> c2;
std::for_each(
c2.begin(),
...
In C++0x SFINAE rules have been simplified such that any invalid expression or type that occurs in the "immediate context" of deduction does not result in a compiler error but rather in deduction failure (SFINAE).
My question is this:
If I take the address of an overloaded function and it can not be resolved, is that failure in the im...
I have a class factory where I'm using variadic templates for the c'tor parameters (code below). However, when I attempt to use it, I get compile errors; when I originally wrote it without parameters, it worked fine.
Here is the class:
template< class Base, typename KeyType, class... Args >
class GenericFactory
{
public:
GenericFac...
n3035 says:
A variable is introduced by the declaration of an object. The variable's name denotes the object.
n3090 says:
A variable is introduced by the declaration of a reference other than a non-static data member or of an object. The variable's name denotes the reference or object.
I wonder what motivated this change. Doe...
Hi,
i need to help with structures, inheritance and definition.
//define struct
struct tStruct1{
int a;
};
//definition
tStruct1 struct1{1};
and inheritance
struct tStruct2:tStruct1{
int b;
};
How can I define it in declaration line?
tStruct2 struct2{ ????? };
One more question, how can i use inheritance for structures ...
I'm doing a library that makes extensive use of a thread local variable.
Can you point to some benchmarks that test the performances of the different ways to get thread local variables in C++:
C++0x thread_local variables
compiler extension (Gcc __thread, ...)
boost::threads_specific_ptr
pthread
Windows
...
Does C++0x thread_local ...
The current C++0x draft states on section 29.3.9 and 29.3.10, pages 1111-1112 that in the following example:
// Thread 1
r1 = y.load(memory_order_relaxed);
x.store(1, memory_order_relaxed);
// Thread 2
r2 = x.load(memory_order_relaxed);
y.store(1, memory_order_relaxed);
The outcome r1 = r2 = 1 is possible since the operations of each...
I have the below simple program using boost threads, what would be the changes needed to do the same in c++0X
#include<iostream>
#include<boost/thread/thread.hpp>
boost::mutex mutex;
struct count
{
count(int i): id(i){}
void operator()()
{
boost::mutex::scoped_lock lk(mutex);
for(int i = 0 ; i < 10000 ; i+...
What do i have to do to this code to make it compile, it's braking around this line:
auto val = what.getObject();
#include<iostream>
using namespace std;
class CUP{
public:
void whatsHappening(){}
};
class MUG{
public:
void whatsHappening(){}
};
class CupThrower{
public:
CUP cp;
CUP getObj...
I am trying to learn how to use implicitly typed variables in c++.
Should i be using 'auto' from C++0x? If so how?
Can some one provide me with a simple example or a good tutorial on this?
Thank you.
...
As someone who hasn't followed the C++0x - now C++1x - story and developments closely, I am considering that it is nearing the time when I need to come up to speed with the 'released' version. I also am not really interested in looking over the standard immediately. Therefore:
What resources are there that give the "effective changelo...
Anyone know of a good C++0x website out there, other than wikipedia?
Thanks.
...
For example, "Don't return objects by value if they are expensive to copy" (RVO can't always be used). This advice might change because of rvalue references.
The same might be said about storing collections of pointers to objects, because copying them by value into the collection was too expensive; this reason might no longer be valid.
...