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


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

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


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

示例1: recentProfile

    bool recentProfile( adcontrols::MassSpectrum& ms
                        , const std::array< std::shared_ptr< const acqrscontrols::ap240::waveform >, max_protocol >& v
                        , tdcdoc::mass_assignee_t assignee ) const {

        if ( !v.empty() && v[ 0 ] ) {

            waveform::translate( ms, v[ 0 ], assignee );

            for ( uint32_t proto = 1; proto < protocolCount_; ++proto ) {
                auto sp = std::make_shared< adcontrols::MassSpectrum >();
                if ( auto& w = v[ proto ] )
                    waveform::translate( *sp, w, assignee );
                ms << std::move(sp);
            }
            return true;
        }
        return false;
    }
开发者ID:qtplatz,项目名称:qtplatz,代码行数:18,代码来源:tdcdoc.cpp

示例2: recentHistogram

    bool recentHistogram( adcontrols::MassSpectrum& ms
                          , const std::array< std::shared_ptr< adcontrols::TimeDigitalHistogram >, max_protocol >& v
                          , tdcdoc::mass_assignee_t assignee ) const {

        if ( !v.empty() && v[ 0 ] ) {

            adcontrols::TimeDigitalHistogram::translate( ms, *v[ 0 ], assignee );

            for ( uint32_t proto = 1; proto < protocolCount_; ++proto ) {

                auto sp = std::make_shared< adcontrols::MassSpectrum >();

                if ( auto& hgrm = v[ proto ] )
                    adcontrols::TimeDigitalHistogram::translate( *sp, *hgrm, assignee );

                ms << std::move(sp);
            }
        }
        return true;
    }
开发者ID:qtplatz,项目名称:qtplatz,代码行数:20,代码来源:tdcdoc.cpp

示例3: nmsCpu

    void nmsCpu(T* targetPtr, int* kernelPtr, const T* const sourcePtr, const T threshold,
                const std::array<int, 4>& targetSize, const std::array<int, 4>& sourceSize,
                const Point<T>& offset)
    {
        try
        {
            // Security checks
            if (sourceSize.empty())
                error("sourceSize cannot be empty.", __LINE__, __FUNCTION__, __FILE__);
            if (targetSize.empty())
                error("targetSize cannot be empty.", __LINE__, __FUNCTION__, __FILE__);
            if (threshold < 0 || threshold > 1.0)
                error("threshold value invalid.", __LINE__, __FUNCTION__, __FILE__);

            // Params
            const auto channels = targetSize[1]; // 57
            const auto sourceHeight = sourceSize[2]; // 368
            const auto sourceWidth = sourceSize[3]; // 496
            const auto targetPeaks = targetSize[2]; // 97
            const auto targetPeakVec = targetSize[3]; // 3
            const auto sourceChannelOffset = sourceWidth * sourceHeight;
            const auto targetChannelOffset = targetPeaks * targetPeakVec;

            // Per channel operation
            for (auto c = 0 ; c < channels ; c++)
            {
                auto* currKernelPtr = &kernelPtr[c*sourceChannelOffset];
                const T* currSourcePtr = &sourcePtr[c*sourceChannelOffset];

                for (auto y = 0; y < sourceHeight; y++)
                    for (auto x = 0; x < sourceWidth; x++)
                        nmsRegisterKernelCPU(currKernelPtr, currSourcePtr, sourceWidth, sourceHeight, threshold, x, y);

                auto currentPeakCount = 1;
                auto* currTargetPtr = &targetPtr[c*targetChannelOffset];
                for (auto y = 0; y < sourceHeight; y++)
                {
                    for (auto x = 0; x < sourceWidth; x++)
                    {
                        const auto index = y*sourceWidth + x;
                        // Find high intensity points
                        if (currentPeakCount < targetPeaks)
                        {
                            if (currKernelPtr[index] == 1)
                            {
                                // Accurate Peak Position
                                nmsAccuratePeakPosition(&currTargetPtr[currentPeakCount*3], currSourcePtr, x, y,
                                                        sourceWidth, sourceHeight, offset);
                                currentPeakCount++;
                            }
                        }

                    }
                }
                currTargetPtr[0] = currentPeakCount-1;
            }
        }
        catch (const std::exception& e)
        {
            error(e.what(), __LINE__, __FUNCTION__, __FILE__);
        }
    }
开发者ID:CHIKKIZZY,项目名称:openpose,代码行数:62,代码来源:nmsBase.cpp


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