False positive with is_copy_constructible on vector

后端 未结 2 1087
时光取名叫无心
时光取名叫无心 2020-11-27 21:54

Should the type trait be able to handle cases such as std::vector < std::unique_ptr > and detect that it\'s not copy constructible?

H

2条回答
  •  自闭症患者
    2020-11-27 22:02

    Table 49 of the C++11 standard lists what conditions a class has to fulfil for is_copy_constructable::value to be true, and that's unfortunately not much:

    is_constructable::value is true

    So if std::vector has a copy constructor it passes the test.

提交回复
热议问题