本文整理汇总了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;
}
示例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;
}
示例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__);
}
}