C++ container with non-copyable non-movable element type
问题 I need a container of elements that are neither copyable nor movable. These elements are not default constructible, but their constructors get identical arguments. The size of the container does not change during it's lifetime. It should be as simple as a built-in array, but it's size is determined at run-time when the constructor is called. Is there an easy way to implement that without the overhead of memory allocation and indirection incurred by using std::vector<std::unique_ptr<T>> ? 回答1: