On Aug 9, 8:45*pm, thomas <FreshTho...@gmail.comwrote:
for c++ stl, is there any container or algorithm that can help
calculate result of a bool expression?
e.g.
input: *1&&~0&&0||1
output: 1
Did you try just that?
int main()
{
bool answer = 1&&~0&&0||1; // Ta Da!
// that's it.
}
you could be cute and even get this answer printed to your screen at
compile time. (i.e. you don't even have to run the program).
something like:
template<typename A>
class Answer {
private:
Answer(){}
};
int main()
{
const bool answer = 1&&~0&&0||1;
Answer<answeris;
}
The answer will appear in the error message you receive trying to
compile the program.
Joe Cook