ERROR C2039: ‘vector’: is not a member of ‘std’
Include <vector> in your Hero.h header and consider removing it from your Hero.cpp file as mentioned in the comments below.
Include <vector> in your Hero.h header and consider removing it from your Hero.cpp file as mentioned in the comments below.
You cannot store arrays in a vector or any other container. The type of the elements to be stored in a container (called the container’s value type) must be both copy constructible and assignable. Arrays are neither. You can, however, use an array class template, like the one provided by Boost, TR1, and C++0x: (You’ll … Read more
From C++11 onwards, you should prefer: Live example on Coliru Make sure to reuse the same instance of rng throughout multiple calls to std::shuffle if you intend to generate different permutations every time! Moreover, if you want your program to create different sequences of shuffles each time it is run, you can seed the constructor of the random engine … Read more
In C++11, this is the preferred way: That is, return by value. With C++11, std::vector has move-semantics, which means the local vector declared in your function will be moved on return and in some cases even the move can be elided by the compiler.
If you have a C++11 compiler, I would suggest using a range-based for-loop (see below); or else use an iterator. But you have several options, all of which I will explain in what follows. range-based for-loop (C++11) In C++11 (and later) you can use the new range-based for-loop, which looks like this: The type char … Read more