当前位置: 首页>>代码示例>>C++>>正文


C++ Choice::alternatives方法代码示例

本文整理汇总了C++中Choice::alternatives方法的典型用法代码示例。如果您正苦于以下问题:C++ Choice::alternatives方法的具体用法?C++ Choice::alternatives怎么用?C++ Choice::alternatives使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Choice的用法示例。


在下文中一共展示了Choice::alternatives方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SpaceIllegalAlternative

 void
 Space::_trycommit(const Choice& c, unsigned int a) {
   if (a >= c.alternatives())
     throw SpaceIllegalAlternative("Space::commit");
   if (failed())
     return;
   if (Brancher* b = brancher(c._id)) {
     // There is a matching brancher
     if (b->commit(*this,c,a) == ES_FAILED)
       fail();
   }
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:12,代码来源:core.cpp

示例2: SpaceIllegalAlternative

 void
 Space::_commit(const Choice& c, unsigned int a) {
   if (a >= c.alternatives())
     throw SpaceIllegalAlternative();
   if (failed())
     return;
   /*
    * Due to weakly monotonic propagators the following scenario might
    * occur: a brancher has been committed with all its available
    * choices. Then, propagation determines less information
    * than before and the brancher now will create new choices.
    * Later, during recomputation, all of these choices
    * can be used together, possibly interleaved with 
    * choices for other branchers. That means all branchers
    * must be scanned to find the matching brancher for the choice.
    *
    * b_commit tries to optimize scanning as it is most likely that
    * recomputation does not generate new choices during recomputation
    * and hence b_commit is moved from newer to older branchers.
    */
   Brancher* b_old = b_commit;
   // Try whether we are lucky
   while (b_commit != Brancher::cast(&bl))
     if (c._id != b_commit->id())
       b_commit = Brancher::cast(b_commit->next());
     else
       goto found;
   if (b_commit == Brancher::cast(&bl)) {
     // We did not find the brancher, start at the beginning
     b_commit = Brancher::cast(bl.next());
     while (b_commit != b_old)
       if (c._id != b_commit->id())
         b_commit = Brancher::cast(b_commit->next());
       else
         goto found;
   }
   // There is no matching brancher!
   throw SpaceNoBrancher();
 found:
   // There is a matching brancher
   if (b_commit->commit(*this,c,a) == ES_FAILED)
     fail();
 }
开发者ID:lquan,项目名称:CSAI,代码行数:43,代码来源:core.cpp


注:本文中的Choice::alternatives方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。