Multiple variables inline compare

I'd like to do something like this


if(a==b==c==d==e){
...
}


Of course this won't work, i'd like to know if there some easy way to do that without doing

if((a==b)&&(b==c)&&(c==d)&&(d==e)){

wich sounds simple but it isn't with long names

Thanks
If these variables are of an integral type, you can use if ((a&b&c&d&e)==a)...
Disch wrote:
(a&b&c&d&e) == (a|b|c|d|e)

@Athar:
((4&6)==4) -> true
Last edited on
1
2
3
#include <boost/tuple/tuple_comparison.hpp>

if( boost::tie( a, b, c, d ) == boost::tie( b, c, d, e ) )


is the shortest (and most obfuscated) way I can think of.

Just do what you are doing.
Topic archived. No new replies allowed.