本文整理汇总了C++中OperationArgs::evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ OperationArgs::evaluate方法的具体用法?C++ OperationArgs::evaluate怎么用?C++ OperationArgs::evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationArgs
的用法示例。
在下文中一共展示了OperationArgs::evaluate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
extern "C" closure builtin_function_show(OperationArgs& Args)
{
auto x = Args.evaluate(0);
object_ptr<String> v (new String);
if (x.is_double())
*v = convertToString<double>(x.as_double());
else if (x.is_int())
*v = convertToString<int>(x.as_int());
else if (x.is_log_double())
*v = "LD"+convertToString<double>(x.as_log_double().log());
else if (x.is_char())
{
std::string s;
s = x.as_char();
*v = s;
}
else if (x.is_a<String>())
*v = x.as_<String>();
else
throw myexception()<<"show: object '"<<x.print()<<"' is not double, int, log_double, char, or string'";
return v;
}
示例2: assert
extern "C" closure builtin_function_floor(OperationArgs& Args)
{
double x = Args.evaluate(0).as_double();
assert(x > 0.0);
return {floor(x)};
}
示例3: M
shared_ptr<const Object> Model::operator()(OperationArgs& Args) const
{
shared_ptr<Model> M (clone());
for(int i=0;i<n_parameters();i++)
M->set_parameter_value(i,Args.evaluate(i));
return M->result();
}
示例4: constructor
extern "C" closure builtin_function_putStrLn(OperationArgs& Args)
{
std::string message = Args.evaluate(0).as_<String>();
std::cout<<message<<std::endl;
return constructor("()",0);
}
示例5: myexception
extern "C" closure builtin_function_read_int(OperationArgs& Args)
{
string s = Args.evaluate(0).as_<String>();
int i;
if (can_be_converted_to(s,i))
return {i};
throw myexception()<<"Cannot convert string '"<<s<<"' to int!";
}
示例6:
boost::shared_ptr<const Object> model_prior::operator()(OperationArgs& Args) const
{
expression_ref R = Args.evaluate(0);
vector<expression_ref> v = get_ref_vector_from_tuple(R);
shared_ptr<Model> M2 (M->clone());
for(int i=0;i<M2->n_parameters();i++)
M2->set_parameter_value(i,v[i]);
return shared_ptr<const Object>(new Log_Double(M2->prior()));
}