There is a wrapper for a tuple, it describes the function of access to the elements of the tuple. This wrapper is used in the template function of a class that performs the search for a specified type. Here is the code template function:
template
<
Calculating::CalculateTypes calculateType,
class SourceDataType = typename calculating_list_type::template strategy_type_selector<calculateType>::source_data_type
>
auto calculate(const SourceDataType & sourceData)
-> decltype(typename calculating_list_type::template strategy_type_selector<calculateType>::result_type())
{
auto& strategy = _calculates.lookup<calculateType>(); //error in this place...
strategy.setSourceData(sourceData);
strategy.calculate();
return strategy.getResult();
}
In this context, _calculates is a member of the class, which we call the function, the type of data: calculating_list_type
Here's the code to access the wrapper function tuple:
template<CalculateTypes calculateType>
inline auto lookup()
-> decltype(std::get<Private::IndexOfList<calculateType, StrategyTypes...>::value>(_calculatingTuple))
{
return std::get<Private::IndexOfList<calculateType, StrategyTypes...>::value>(_calculatingTuple);
}
What is most interesting is that a template function access function works perfectly for example:
std::cout << es.getCalculateList().lookup<Calculating::CalculateTypes::MAIN_VOLUME>().getName() << std::endl;// works great...
What did I do wrong?