So, here's my code...
Now, my understanding is that whenever you create an array of objects, you automatically call the default constructor for each of the uninitialized values, so the code above calls the default constructor of value_type once for each element.Code:template <typename RandIter> void compare_sorts (RandIter begin, RandIter end, double entropy = 0) { using std::iterator_traits<RandIter>::value_type; value_type * manip_array; manip_array = new value_type[end - begin]; std::copy (begin, end, manip_array); // ... }
The thing is, immediately after creating the array, I assign in the iterated values. In principle, I should be able to rewrite the above code so that it creates manip_array using only the copy constructor.
Is it possible, and how?