I have a non-template class that is itself used as a template parameter of another class. This class is used to abstract the underlying representation of some data. Ideally, one of the method of this class should be integer parameterized.
E.g : typedef double Price;
enum Side
{
BUY,
SELL
};
struct Book
{
template <Side side>
int getLimit(Price price) const
{
return 0;
}
};
struct Spotter
{
template <typename Book>
Price compute(Price startPrice, const Book& book)
{
int limit = book.getLimit<BUY>(startPrice);
return 0;
}
};
Now when compiling with gcc, I get "error: no match for 'operator<' in book->Book::getLimit < (Side)0u"
It looks like a parsing error as if the grammar does not allow object.method(args) to be written in the first place.
Note that in my real code, the compute() method is itself parameterized by a side parameter, which is forwarded to the getLimit() method.
Is there a way to make this work ?