look-up table for std::binary_function's

F

Frank Bergemann

i don't manage to get this compiled:

template <typename ForType>
struct CompareOperator {
enum Id {equal = 0, less = 1 };
typedef std::binary_function<ForType, ForType, bool> fn_type;

static std::equal_to<ForType> m_equal_to;
static std::less<ForType> m_less;

static fn_type lookup[];
};

template <typename ForType>
std::equal_to<ForType> CompareOperator<ForType>::m_equal_to;

template <typename ForType>
std::less<ForType> CompareOperator<ForType>::m_less;


template <typename ForType>
typename CompareOperator<ForType>::fn_type
CompareOperator<ForType>::lookup[]
= { m_equal_to, m_less } ;


It fails for using - e.g. here:

switch (this->m_type) {
case IDBMint32_c:
return CompareOperator<IDBMint32_t>::lookup[ComparatorId]
(m_data.int_32_val, cd.m_data.int_32_val);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top