navderm
navderm

Reputation: 819

angle brackets being interpreted as template types in a templated function

modes_[pos].variance = (sigmanew < 4) ? (4) : sigmanew > 5 * variance_ : sigmanew;

I have a line in a templated function of a templated class. The angle brackets in this line are being interpreted as datatype definitions and error is being thrown. How do I resolve such an issue ?

Error is :

/(foldername)/(part_filename)_templated_impl.tpp:312:89: error: found ':' in nested-name-specifier, expected '::'

/(foldername)/(part_filename)_templated_impl.tpp:312:79: error: 'variance_' is not a class or namespace

Upvotes: 1

Views: 123

Answers (1)

Carl Norum
Carl Norum

Reputation: 225002

I don't think there's any problems with the < or the >. Your ternary operator has two colons in it. That's probably not right. What it looks like you're trying is:

modes_[pos].variance = (sigmanew < 4) ? (4) 
                                      : (sigmanew > 5) ? variance_ 
                                                       : sigmanew;

But you mistyped one of the ?s. Why not do this operation on multiple lines instead of trying to cram it all together this way?

Upvotes: 2

Related Questions