Cătălin Pitiş , - , "" "". ? , - , ?
template<class PageT>
struct StyleOf;
template<>
struct StyleOf<PageA>{
typedef StyleA type;
};
template<>
struct StyleOf<PageB>{
typedef StyleB type;
};
template<class PageT>
typename StyleOf<PageT>::type
GetStyle(const PageT&){
return StyleOf<PageT>::type();
}
, Boost.MPL:
using boost::mpl::map;
using boost::mpl::pair;
typedef map<
pair<PageA, StyleA>,
pair<PageB, StyleB>,
>
PageToStyle;
:
boost::mpl::at<PageToStyle, Page>::type;