Issue with is_copy_constructible
Should the type trait be able to handle cases such as std::vector <
std::unique_ptr <int> > and detect that it's not copy constructible?
Here's an example at https://ideone.com/gbcRUa (running g++ 4.8.1)
#include <type_traits>
#include <vector>
#include <iostream>
#include <memory>
int main()
{
// This prints 1, implying that it's copy constructible.
std::cout << std::is_copy_constructible<
std::vector<std::unique_ptr<int> > >::value << std::endl;
return 0;
}
If this is the correct behavior for is_copy_constructible, is there a way
to detect that the copy construction is ill formed? Well, beyond just
having it fail to compile.
No comments:
Post a Comment