Move Constructors and Static Arrays
I've been exploring the possibilities of Move Constructors in C++, and I was wondering what are some ways of taking advantage of this feature in an example such as below. Consider this code: template<unsigned int N> class Foo { public: Foo() { for (int i = 0; i < N; ++i) _nums[i] = 0; } Foo(const Foo<N>& other) { for (int i = 0; i < N; ++i) _nums[i] = other._nums[i]; } Foo(Foo<N>&& other) { // ??? How can we take advantage of move constructors here? } // ... other methods and members virtual ~Foo() { /* no action required */ } private: int _nums[N]; }; Foo<5> bar() { Foo<5> result; // Do stuff