Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #5280
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | comparison operators parameter |
| Date | 2011-05-21 19:58 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <ir8ufm$v2m$1@online.de> (permalink) |
Hello,
I' writing a class with a method, that should get a parameter for
comparision like <, <=, > or >=. The method must compare some float
values but the user of the method should be set the comparision. My
first idea is to use an enum with 4 states of comparision, but is there
a better solution?
In pseudocode:
myclass::mymethod( comparision_operator p_comp ) {
float a,b;
if ( p_comp(a,b))
do something
}
Thx
Phil
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar
comparison operators parameter Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-05-21 19:58 +0200 Re: comparison operators parameter Öö Tiib <ootiib@hot.ee> - 2011-05-21 15:29 -0700
csiph-web