int myints[] = { 10, 20, 30 ,40 };
int * p;
p = std::find (myints,myints+4,30);
// I see that here myints returns 0 and myints+4 returns 3 because pointer to *p is set to first element in the array.
// The find() applied on array searches elements 10,20,30 and returns iterator to 30 which is value 3.
Now in the code std::vector<int> myvector (myints, myints+4);
what exactly meant this convention in rounded brackets? I though, that the second parameter is used to initiate the elements to some value, but from this example this looks like it defines the range 0-4 which is 3 elements to search. Why not to type just std::vector<int> myvector (myints+4);
or std::vector<int> myvector (4);
to define the size of vector?
So you create an m instance of string class -> the constructor returns the string which is in input of the construct parameter.
Then you create an rm instance, but the construct accepts two parameters called parameter range (?), which iterates the string in reversed order, just like vectors (or arrays) can be iterated.
Thanks for your explanation. I think it is clear to me now.
According the link you pasted, there is 4 forms of constructor use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
default (1)
explicit vector (const allocator_type& alloc = allocator_type());
fill (2)
explicit vector (size_type n, const value_type& val = value_type(),
const allocator_type& alloc = allocator_type());
range (3)
template <class InputIterator>
vector (InputIterator first, InputIterator last,
const allocator_type& alloc = allocator_type());
copy (4)
vector (const vector& x);
But there are examples on the page bellow:
1 2 3 4 5
// constructors used in the same order as described above:
std::vector<int> first; // empty vector of ints
std::vector<int> second (4,100); // four ints with value 100
std::vector<int> third (second.begin(),second.end()); // iterating through second
std::vector<int> fourth (third); // a copy of third