fork download
  1. #include <array>
  2. #include <iostream>
  3.  
  4. class Foo
  5. {
  6. public:
  7. Foo(int){}
  8. Foo(const Foo &) = delete;
  9.  
  10.  
  11. Foo(Foo &&)
  12. {
  13. std::cout<<"Moved\n";
  14. }
  15. };
  16.  
  17. template<class... Type>
  18. constexpr std::array<typename std::common_type<Type...>::type, sizeof...(Type)> make_array(Type&&... t)
  19. {
  20. return {std::forward<Type>(t)...};
  21. }
  22.  
  23. int main() {
  24. auto arr = make_array(Foo{1}, Foo{2});
  25. return 0;
  26. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Moved
Moved