本文整理汇总了C++中Promise::expose方法的典型用法代码示例。如果您正苦于以下问题:C++ Promise::expose方法的具体用法?C++ Promise::expose怎么用?C++ Promise::expose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Promise
的用法示例。
在下文中一共展示了Promise::expose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wrapInPromises
void ArgList::wrapInPromises(Environment* env)
{
if (m_status == PROMISED)
Rf_error("Internal error:"
" ArgList already wrapped in Promises");
if (m_status == EVALUATED)
env = 0;
else if (m_first_arg_env && env != m_first_arg_env)
Rf_error("Internal error: first arg of ArgList"
" previously evaluated in different environment");
GCStackRoot<const PairList> oldargs(list());
setList(0);
PairList* lastout = 0;
for (const PairList* inp = oldargs; inp; inp = inp->tail()) {
RObject* rawvalue = inp->car();
if (rawvalue == DotsSymbol) {
Frame::Binding* binding = env->findBinding(DotsSymbol);
if (binding) {
RObject* dval = binding->forcedValue();
if (!dval || dval->sexptype() == DOTSXP) {
ConsCell* dotlist = static_cast<ConsCell*>(dval);
while (dotlist) {
Promise* prom;
if (!m_first_arg_env)
prom = new Promise(dotlist->car(), env);
else {
prom = new Promise(m_first_arg, 0);
m_first_arg = 0;
m_first_arg_env = 0;
}
prom->expose();
const Symbol* tag = tag2Symbol(dotlist->tag());
PairList* cell = PairList::cons(prom, 0, tag);
lastout = append(cell, lastout);
dotlist = dotlist->tail();
}
} else if (dval != Symbol::missingArgument())
Rf_error(_("'...' used in an incorrect context"));
}
} else {
const Symbol* tag = tag2Symbol(inp->tag());
RObject* value = Symbol::missingArgument();
if (m_first_arg_env) {
value = CXXR_NEW(Promise(m_first_arg, 0));
m_first_arg = 0;
m_first_arg_env = 0;
} else if (rawvalue != Symbol::missingArgument())
value = CXXR_NEW(Promise(rawvalue, env));
PairList* cell = PairList::cons(value, 0, tag);
lastout = append(cell, lastout);
}
}
m_status = PROMISED;
}