
On 11/06/2013 06:38 PM, Viktor Sehr wrote:
Example usage: class Foo { public: Foo() {} DEFAULT_EVERYTHING(Foo, ( (int)(a) ) ( (std::vector<int>)(b) ) ( (float)(c) ) ); };
Any interest, suggestions or ideas?
(vector2<member_type&, member_type&>(member, other.member)), swap_functor()); }
If we are going to specify the member variables in a funny way, it may be worth considering a solution based on Boost.Fusion. For example, swap() can be made like this: class Foo { public: Foo() { member.a = 0; member.c = 0.0; } // swap and swap_functor should be turned into a macro public: void swap(Foo& other) { using namespace boost::fusion; for_each(zip_view< vector2<member_type&, member_type&> private: struct swap_functor { template <typename T> void operator()(const boost::fusion::vector2<T,T>& data) const { using namespace boost::fusion; boost::swap(at_c<0>(data), at_c<1>(data)); } }; private: BOOST_FUSION_DEFINE_STRUCT_INLINE (member_type, // Member variables (int, a) (std::vector<int>, b) (float, c) ) member_type member; };