That is my sample of testing boost::tribool:
#include <iostream>
#include "boost/logic/tribool.hpp"
int main()
{
boost::logic::tribool init;
//init = boost::logic::indeterminate;
init = true;
//init = false;
if (boost::logic::indeterminate(init))
{
std::cout << "indeterminate -> " << std::boolalpha << init << std::endl;
}
else if (init)
{
std::cout << "true -> " << std::boolalpha << init << std::endl;
}
else if (!init)
{
std::cout << "false -> " << std::boolalpha << init << std::endl;
}
bool safe = init.safe_bool(); <<---- error here
if (safe) std::cout << std::boolalpha << safe << std::endl;
return 0;
}
I am trying to use safe_bool() function to convert boost::tribool to plain bool but have complile time error:
Error 1 error C2274 : 'function-style cast' : illegal as right side of '.' operator D : \install\libs\boost\boost_samples\modules\tribool\src\main.cpp 23 1 tribool
Looks like i am using safe_bool() function incorrectly. Could you help me resolve this issue? Thanks.