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


C++ PointList::empty方法代码示例

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


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

示例1: fastFilterPointList

 boost::optional<Point> fastFilterPointList(
         const PointList& pointList,
         std::vector<Point>& newPointList) const
 {
     assert(!pointList.empty());
     newPointList.reserve(pointList.size() - 1);
     std::copy(
             ++pointList.begin(),
             pointList.end(),
             std::back_inserter(newPointList)
             );
     return boost::optional<Point>(pointList.front());
 } // fastFilterFunctorList
开发者ID:petersohn,项目名称:sokoban,代码行数:13,代码来源:NodeBuilder.hpp

示例2: doBuildNode

        void doBuildNode(
            const typename NodeTypes<Status, T>::ValueList& valueList,
            const PointList& pointList,
            int depthRemaining,
            bool trueBranch,
            const State& collectedState,
            Node<Status, T>& result)
        {
            typedef typename NodeTypes<Status, T>::ValuePtr ValuePtr;
            typedef typename NodeTypes<Status, T>::ValueList ValueList;

            if (valueList.empty() ||
                    pointList.empty() ||
                    depthRemaining == 0) {
                result = createLeaf<Status, T>(valueList, depthRemaining, collectedState);
                return;
            }
            assert(!valueList.empty());
            if (checker_ && !checkState(
                    *checker_,
                    valueList.front()->first.table(),
                    collectedState)) {
                {
                    boost::unique_lock<MutexType> lock(progressMutex_);
                    ++numLeafsSaved_;
                    numLeafsSavedExp_ += static_cast<int>(exp2(depthRemaining));
                }
                result = createLeaf<Status, T>(ValueList(), depthRemaining, collectedState);
                return;
            }

            std::vector<Point> newFunctorList;
            boost::optional<Point> point;
            State newCollectedState(collectedState);
            if (trueBranch) {
                point = fastFilterPointList(
                        pointList, newFunctorList);
                assert(point);
            } else {
                point = filterPointList(
                        valueList, pointList, newFunctorList);
            }
            if (!point) {
                result = createLeaf<Status, T>(valueList, depthRemaining, collectedState);
                return;
            }
            newCollectedState.addStone(*point);

            ValueList falseValues;
            boost::remove_copy_if(valueList,
                    std::back_inserter(falseValues),
                    [&point](const ValuePtr& value)
                    { return isStone(value->first, *point); });

            assert(falseValues.size() != valueList.size());
            result = DecisionNode<Status, T, Node<Status, T>>(*point);
            buildDecisionChildren<Status, T, PointList>(
                    falseValues, valueList,
                    newFunctorList, depthRemaining - 1,
                    collectedState, newCollectedState,
                    result);

        } // doBuildNode
开发者ID:petersohn,项目名称:sokoban,代码行数:63,代码来源:NodeBuilder.hpp


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