• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BOOST_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BOOST_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_ASSERT函数的具体用法?C++ BOOST_ASSERT怎么用?C++ BOOST_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: SimpleLogger

/**
 * Creates the nodes in the edge expanded graph from edges in the node-based graph.
 */
void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
{
    SimpleLogger().Write() << "Identifying components of the (compressed) road network";

    // Run a BFS on the undirected graph and identify small components
    TarjanSCC<NodeBasedDynamicGraph> component_explorer(m_node_based_graph, *m_restriction_map,
                                                        m_barrier_nodes);

    component_explorer.run();

    SimpleLogger().Write() << "identified: "
                           << component_explorer.get_number_of_components() - removed_node_count
                           << " (compressed) components";
    SimpleLogger().Write() << "identified "
                           << component_explorer.get_size_one_count() - removed_node_count
                           << " (compressed) SCCs of size 1";
    SimpleLogger().Write() << "generating edge-expanded nodes";

    Percent progress(m_node_based_graph->GetNumberOfNodes());

    // loop over all edges and generate new set of nodes
    for (const auto node_u : osrm::irange(0u, m_node_based_graph->GetNumberOfNodes()))
    {
        BOOST_ASSERT(node_u != SPECIAL_NODEID);
        BOOST_ASSERT(node_u < m_node_based_graph->GetNumberOfNodes());
        progress.printStatus(node_u);
        for (EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(node_u))
        {
            const EdgeData &edge_data = m_node_based_graph->GetEdgeData(e1);
            BOOST_ASSERT(e1 != SPECIAL_EDGEID);
            const NodeID node_v = m_node_based_graph->GetTarget(e1);

            BOOST_ASSERT(SPECIAL_NODEID != node_v);
            // pick only every other edge, since we have every edge as an outgoing
            // and incoming egde
            if (node_u > node_v)
            {
                continue;
            }

            BOOST_ASSERT(node_u < node_v);

            // Note: edges that end on barrier nodes or on a turn restriction
            // may actually be in two distinct components. We choose the smallest
            const unsigned size_of_component =
                std::min(component_explorer.get_component_size(node_u),
                         component_explorer.get_component_size(node_v));

            const unsigned id_of_smaller_component = [node_u, node_v, &component_explorer]
            {
                if (component_explorer.get_component_size(node_u) <
                    component_explorer.get_component_size(node_v))
                {
                    return component_explorer.get_component_id(node_u);
                }
                return component_explorer.get_component_id(node_v);
            }();

            const bool component_is_tiny = size_of_component < 1000;

            // we only set edgeBasedNodeID for forward edges
            if (edge_data.edgeBasedNodeID == SPECIAL_NODEID)
            {
                InsertEdgeBasedNode(node_v, node_u,
                                    (component_is_tiny ? id_of_smaller_component + 1 : 0));
            }
            else
            {
                InsertEdgeBasedNode(node_u, node_v,
                                    (component_is_tiny ? id_of_smaller_component + 1 : 0));
            }
        }
    }

    SimpleLogger().Write() << "Generated " << m_edge_based_node_list.size()
                           << " nodes in edge-expanded graph";
}
开发者ID:alan-leslie,项目名称:osrm-backend,代码行数:80,代码来源:edge_based_graph_factory.cpp


示例2: ispunct

 static int
 ispunct(int ch)
 {
     BOOST_ASSERT(isascii_(ch));
     return (ascii_char_types[ch] & BOOST_CC_PUNCT);
 }
开发者ID:DanielParra159,项目名称:EngineAndGame,代码行数:6,代码来源:ascii.hpp


示例3: isupper

 static int
 isupper(int ch)
 {
     BOOST_ASSERT(isascii_(ch));
     return (ascii_char_types[ch] & BOOST_CC_UPPER);
 }
开发者ID:DanielParra159,项目名称:EngineAndGame,代码行数:6,代码来源:ascii.hpp


示例4: isalpha

 static int
 isalpha(int ch)
 {
     BOOST_ASSERT(isascii_(ch));
     return (ascii_char_types[ch] & BOOST_CC_ALPHA);
 }
开发者ID:DanielParra159,项目名称:EngineAndGame,代码行数:6,代码来源:ascii.hpp


示例5: iscntrl

 static int
 iscntrl(int ch)
 {
     BOOST_ASSERT(isascii_(ch));
     return (ascii_char_types[ch] & BOOST_CC_CTRL);
 }
开发者ID:DanielParra159,项目名称:EngineAndGame,代码行数:6,代码来源:ascii.hpp


示例6: recompute

 void recompute(std::vector<hpx::naming::id_type> const& search_objects)
 {
     BOOST_ASSERT(gid_);
     this->base_type::recompute(gid_, search_objects);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例7: ModelObjectInspectorView

WaterUseEquipmentDefinitionInspectorView::WaterUseEquipmentDefinitionInspectorView(bool isIP, const openstudio::model::Model& model, QWidget * parent)
    : ModelObjectInspectorView(model, true, parent)
{
    m_isIP = isIP;
    bool isConnected = false;

    QWidget* visibleWidget = new QWidget();
    this->stackedWidget()->addWidget(visibleWidget);

    QGridLayout* mainGridLayout = new QGridLayout();
    mainGridLayout->setContentsMargins(7,7,7,7);
    mainGridLayout->setSpacing(14);
    visibleWidget->setLayout(mainGridLayout);

    // Name

    QLabel* label = new QLabel("Name: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,0,0);

    m_nameEdit = new OSLineEdit();
    mainGridLayout->addWidget(m_nameEdit,1,0,1,3);

    // End Use Subcategory

    label = new QLabel("End Use Subcategory: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,2,0);

    m_endUseSubcategoryEdit = new OSLineEdit();
    mainGridLayout->addWidget(m_endUseSubcategoryEdit,3,0,1,3);

    // Peak Flow Rate

    label = new QLabel("Peak Flow Rate: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,4,0);

    m_peakFlowRateEdit = new OSQuantityEdit(m_isIP);
    isConnected = connect(this, SIGNAL(toggleUnitsClicked(bool)), m_peakFlowRateEdit, SLOT(onUnitSystemChange(bool)));
    BOOST_ASSERT(isConnected);
    mainGridLayout->addWidget(m_peakFlowRateEdit,5,0,1,3);

    // Target Temperature Schedule

    label = new QLabel("Target Temperature Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,6,0);

    m_targetTemperatureScheduleVC = new TargetTemperatureScheduleVC();
    m_targetTemperatureScheduleDZ = new OSDropZone(m_targetTemperatureScheduleVC);
    m_targetTemperatureScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_targetTemperatureScheduleDZ,7,0,1,3);

    // Sensible Fraction Schedule

    label = new QLabel("Sensible Fraction Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,8,0);

    m_sensibleFractionScheduleVC = new SensibleFractionScheduleVC();
    m_sensibleFractionScheduleDZ = new OSDropZone(m_sensibleFractionScheduleVC);
    m_sensibleFractionScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_sensibleFractionScheduleDZ,9,0,1,3);

    // Latent Fraction Schedule

    label = new QLabel("Latent Fraction Schedule: ");
    label->setObjectName("H2");
    mainGridLayout->addWidget(label,10,0);

    m_latentFractionScheduleVC = new LatentFractionScheduleVC();
    m_latentFractionScheduleDZ = new OSDropZone(m_latentFractionScheduleVC);
    m_latentFractionScheduleDZ->setMaxItems(1);
    mainGridLayout->addWidget(m_latentFractionScheduleDZ,11,0,1,3);

    // Stretch

    mainGridLayout->setRowStretch(12,100);

    mainGridLayout->setColumnStretch(3,100);
}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:82,代码来源:WaterUseEquipmentInspectorView.cpp


示例8: enforce_async

 lcos::future<void> enforce_async(std::vector<hpx::naming::id_type> const& master_gids,double dt,
                                        std::size_t n,std::size_t N)
 {
     BOOST_ASSERT(gid_);
     return this->base_type::enforce_async(gid_,master_gids,dt,n,N);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:6,代码来源:point.hpp


示例9: move

 void move(double dt,double time)
 {
     BOOST_ASSERT(gid_);
     this->base_type::move(gid_,dt,time);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例10: move_async

 lcos::future<void> move_async(double dt,double time)
 {
     BOOST_ASSERT(gid_);
     return this->base_type::move_async(gid_,dt,time);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例11: adjust_async

 lcos::future<void> adjust_async(double dt)
 {
     BOOST_ASSERT(gid_);
     return this->base_type::adjust_async(gid_,dt);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例12: get_poly

 polygon_type get_poly() const
 {
     BOOST_ASSERT(gid_);
     return this->base_type::get_poly(gid_);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例13: BOOST_ASSERT

void EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u,
                                                const NodeID node_v,
                                                const unsigned component_id)
{
    // merge edges together into one EdgeBasedNode
    BOOST_ASSERT(node_u != SPECIAL_NODEID);
    BOOST_ASSERT(node_v != SPECIAL_NODEID);

    // find forward edge id and
    const EdgeID edge_id_1 = m_node_based_graph->FindEdge(node_u, node_v);
    BOOST_ASSERT(edge_id_1 != SPECIAL_EDGEID);

    const EdgeData &forward_data = m_node_based_graph->GetEdgeData(edge_id_1);

    // find reverse edge id and
    const EdgeID edge_id_2 = m_node_based_graph->FindEdge(node_v, node_u);
    BOOST_ASSERT(edge_id_2 != SPECIAL_EDGEID);

    const EdgeData &reverse_data = m_node_based_graph->GetEdgeData(edge_id_2);

    if (forward_data.edgeBasedNodeID == SPECIAL_NODEID &&
        reverse_data.edgeBasedNodeID == SPECIAL_NODEID)
    {
        return;
    }

    BOOST_ASSERT(m_geometry_compressor.HasEntryForID(edge_id_1) ==
                 m_geometry_compressor.HasEntryForID(edge_id_2));
    if (m_geometry_compressor.HasEntryForID(edge_id_1))
    {
        BOOST_ASSERT(m_geometry_compressor.HasEntryForID(edge_id_2));

        // reconstruct geometry and put in each individual edge with its offset
        const std::vector<GeometryCompressor::CompressedNode> &forward_geometry =
            m_geometry_compressor.GetBucketReference(edge_id_1);
        const std::vector<GeometryCompressor::CompressedNode> &reverse_geometry =
            m_geometry_compressor.GetBucketReference(edge_id_2);
        BOOST_ASSERT(forward_geometry.size() == reverse_geometry.size());
        BOOST_ASSERT(0 != forward_geometry.size());
        const unsigned geometry_size = static_cast<unsigned>(forward_geometry.size());
        BOOST_ASSERT(geometry_size > 1);

        // reconstruct bidirectional edge with individual weights and put each into the NN index

        std::vector<int> forward_dist_prefix_sum(forward_geometry.size(), 0);
        std::vector<int> reverse_dist_prefix_sum(reverse_geometry.size(), 0);

        // quick'n'dirty prefix sum as std::partial_sum needs addtional casts
        // TODO: move to lambda function with C++11
        int temp_sum = 0;

        for (const auto i : osrm::irange(0u, geometry_size))
        {
            forward_dist_prefix_sum[i] = temp_sum;
            temp_sum += forward_geometry[i].second;

            BOOST_ASSERT(forward_data.distance >= temp_sum);
        }

        temp_sum = 0;
        for (const auto i : osrm::irange(0u, geometry_size))
        {
            temp_sum += reverse_geometry[reverse_geometry.size() - 1 - i].second;
            reverse_dist_prefix_sum[i] = reverse_data.distance - temp_sum;
            // BOOST_ASSERT(reverse_data.distance >= temp_sum);
        }

        NodeID current_edge_source_coordinate_id = node_u;

        if (SPECIAL_NODEID != forward_data.edgeBasedNodeID)
        {
            max_id = std::max(forward_data.edgeBasedNodeID, max_id);
        }
        if (SPECIAL_NODEID != reverse_data.edgeBasedNodeID)
        {
            max_id = std::max(reverse_data.edgeBasedNodeID, max_id);
        }

        // traverse arrays from start and end respectively
        for (const auto i : osrm::irange(0u, geometry_size))
        {
            BOOST_ASSERT(current_edge_source_coordinate_id ==
                         reverse_geometry[geometry_size - 1 - i].first);
            const NodeID current_edge_target_coordinate_id = forward_geometry[i].first;
            BOOST_ASSERT(current_edge_target_coordinate_id != current_edge_source_coordinate_id);

            // build edges
            m_edge_based_node_list.emplace_back(
                forward_data.edgeBasedNodeID, reverse_data.edgeBasedNodeID,
                current_edge_source_coordinate_id, current_edge_target_coordinate_id,
                forward_data.nameID, forward_geometry[i].second,
                reverse_geometry[geometry_size - 1 - i].second, forward_dist_prefix_sum[i],
                reverse_dist_prefix_sum[i], m_geometry_compressor.GetPositionForID(edge_id_1),
                component_id, i, forward_data.travel_mode, reverse_data.travel_mode);
            current_edge_source_coordinate_id = current_edge_target_coordinate_id;

            BOOST_ASSERT(m_edge_based_node_list.back().IsCompressed());

            BOOST_ASSERT(node_u != m_edge_based_node_list.back().u ||
                         node_v != m_edge_based_node_list.back().v);
//.........这里部分代码省略.........
开发者ID:alan-leslie,项目名称:osrm-backend,代码行数:101,代码来源:edge_based_graph_factory.cpp


示例14: recompute_async

 lcos::future<void> recompute_async(std::vector<hpx::naming::id_type> const& search_objects)
 {
     BOOST_ASSERT(gid_);
     return this->base_type::recompute_async(gid_, search_objects);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例15: adjust

 void adjust(double dt)
 {
     BOOST_ASSERT(gid_);
     this->base_type::adjust(gid_,dt);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例16: search

 int search(std::vector<hpx::naming::id_type> const& search_objects)
 {
     BOOST_ASSERT(gid_);
     return this->base_type::search(gid_, search_objects);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例17: enforce

 void enforce(std::vector<hpx::naming::id_type> const& master_gids,double dt,
              std::size_t n,std::size_t N)
 {
     BOOST_ASSERT(gid_);
     this->base_type::enforce(gid_,master_gids,dt,n,N);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:6,代码来源:point.hpp


示例18: get_poly_async

 lcos::future<polygon_type> get_poly_async() const
 {
     BOOST_ASSERT(gid_);
     return this->base_type::get_poly_async(gid_);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例19: get_Y_async

 lcos::future<double> get_Y_async()  const
 {
     BOOST_ASSERT(gid_);
     return this->base_type::get_Y_async(gid_);
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:5,代码来源:point.hpp


示例20: BOOST_ASSERT

network_boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type l_max_cache_size)
{
    typedef typename object_cache<Key, Object>::data object_data;
    typedef typename map_type::size_type map_size_type;
    static object_data s_data;

    //
    // see if the object is already in the cache:
    //
    map_iterator mpos = s_data.index.find(k);
    if(mpos != s_data.index.end())
    {
        //
        // Eureka!
        // We have a cached item, bump it up the list and return it:
        //
        if(--(s_data.cont.end()) != mpos->second)
        {
            // splice out the item we want to move:
            list_type temp;
            temp.splice(temp.end(), s_data.cont, mpos->second);
            // and now place it at the end of the list:
            s_data.cont.splice(s_data.cont.end(), temp, temp.begin());
            BOOST_ASSERT(*(s_data.cont.back().second) == k);
            // update index with new position:
            mpos->second = --(s_data.cont.end());
            BOOST_ASSERT(&(mpos->first) == mpos->second->second);
            BOOST_ASSERT(&(mpos->first) == s_data.cont.back().second);
        }
        return s_data.cont.back().first;
    }
    //
    // if we get here then the item is not in the cache,
    // so create it:
    //
    network_boost::shared_ptr<Object const> result(new Object(k));
    //
    // Add it to the list, and index it:
    //
    s_data.cont.push_back(value_type(result, static_cast<Key const*>(0)));
    s_data.index.insert(std::make_pair(k, --(s_data.cont.end())));
    s_data.cont.back().second = &(s_data.index.find(k)->first);
    map_size_type s = s_data.index.size();
    BOOST_ASSERT(s_data.index[k]->first.get() == result.get());
    BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
    BOOST_ASSERT(s_data.index.find(k)->first == k);
    if(s > l_max_cache_size)
    {
        //
        // We have too many items in the list, so we need to start
        // popping them off the back of the list, but only if they're
        // being held uniquely by us:
        //
        list_iterator pos = s_data.cont.begin();
        list_iterator last = s_data.cont.end();
        while((pos != last) && (s > l_max_cache_size))
        {
            if(pos->first.unique())
            {
                list_iterator condemmed(pos);
                ++pos;
                // now remove the items from our containers,
                // then order has to be as follows:
                BOOST_ASSERT(s_data.index.find(*(condemmed->second)) != s_data.index.end());
                s_data.index.erase(*(condemmed->second));
                s_data.cont.erase(condemmed);
                --s;
            }
            else
                ++pos;
        }
        BOOST_ASSERT(s_data.index[k]->first.get() == result.get());
        BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
        BOOST_ASSERT(s_data.index.find(k)->first == k);
    }
    return result;
}
开发者ID:glynos,项目名称:uri,代码行数:77,代码来源:object_cache.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BOOST_ASSERT_MSG函数代码示例发布时间:2022-05-30
下一篇:
C++ BOOST_ASIO_TEST_CASE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap