Should std::array have move constructor?

前端 未结 3 2003
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-18 20:33

Moving can\'t be implemented efficiently (O(1)) on std::array, so why does it have move constructor ?

3条回答
  •  太阳男子
    2021-02-18 21:32

    To summarize and expand on other answers, array should be moveable (when T itself is moveable) because:

    • T may be efficiently moveable.
    • T may be move-only.

提交回复
热议问题