template< class S > struct remove_modifier { template< class T > struct remove_constref_sub{ typedef T out_type; }; template< class T > struct remove_constref_sub< const T >{ typedef T out_type; }; template< class T > struct remove_constref_sub< T& >{ typedef T out_type; }; template< class T > struct remove_constref_sub< const T& >{ typedef T out_type; }; typedef typename remove_constref_sub< S >::out_type base_type; };
なるほどね、こう書けばconstや参照などの修飾語をとった基底型を取り出せるってわけだ。(これはつまり、一番上のremove_constref_sub内部テンプレートクラスに対し、その下の3つの特殊化版を記述してあるわけで、それぞれconst修飾子、参照演算子、const参照、の3つの場合の特殊化版となっているわけです。)
これは便利。parse_tuple もこれを使って書き直そう。
あとmy_bind1st_refも。