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


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

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


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

示例1: SignedBlobReader

CertReader::CertReader(std::vector<u8>&& bytes) : SignedBlobReader(std::move(bytes))
{
  if (!IsSignatureValid())
    return;

  // XXX: in old GCC versions, capturing 'this' does not work for some lambdas. The workaround
  // is to not use auto for the parameter (even though the type is obvious).
  // This can be dropped once we require GCC 7.
  using CertStructInfo = std::tuple<SignatureType, PublicKeyType, size_t>;
  static constexpr std::array<CertStructInfo, 4> types{{
      {SignatureType::RSA4096, PublicKeyType::RSA2048, sizeof(CertRSA4096RSA2048)},
      {SignatureType::RSA2048, PublicKeyType::RSA2048, sizeof(CertRSA2048RSA2048)},
      {SignatureType::RSA2048, PublicKeyType::ECC, sizeof(CertRSA2048ECC)},
      {SignatureType::ECC, PublicKeyType::ECC, sizeof(CertECC)},
  }};

  const auto info = std::find_if(types.cbegin(), types.cend(), [this](const CertStructInfo& entry) {
    return m_bytes.size() >= std::get<2>(entry) && std::get<0>(entry) == GetSignatureType() &&
           std::get<1>(entry) == GetPublicKeyType();
  });

  if (info == types.cend())
    return;

  m_bytes.resize(std::get<2>(*info));
  m_is_valid = true;
}
开发者ID:AdmiralCurtiss,项目名称:dolphin,代码行数:27,代码来源:Formats.cpp

示例2: return

std::string CArchiveScanner::ArchiveData::GetKeyDescription(const std::string& keyLower)
{
	const auto pred = [&keyLower](const KnownInfoTag& t) { return (t.name == keyLower); };
	const auto iter = std::find_if(knownTags.cbegin(), knownTags.cend(), pred);

	if (iter != knownTags.cend())
		return (iter->desc);

	return "<custom property>";
}
开发者ID:nixtux,项目名称:spring,代码行数:10,代码来源:ArchiveScanner.cpp

示例3: isLibraryNotInExcludeList

bool BinaryDependenciesLdd::isLibraryNotInExcludeList(const PlainText::StringRecord & record)
{
  Q_ASSERT(record.columnCount() > 0);

  const auto cmp = [record](const char * const excludeName){
    LibraryName libName(record.data(0));
    return ( QString::compare( libName.name(), QLatin1String(excludeName), Qt::CaseSensitive ) == 0);
  };
  const auto it = std::find_if( LibrayExcludeListLinux.cbegin(), LibrayExcludeListLinux.cend(), cmp );
  return (it == LibrayExcludeListLinux.cend());
}
开发者ID:scandyna,项目名称:multidiagtools,代码行数:11,代码来源:BinaryDependenciesLdd.cpp

示例4: print_positions

 void print_positions(const std::array<position_t, N>& positions)
 {
    std::for_each(positions.cbegin(), positions.cend(), [](const position_t& pos)
          {
             std::cout << '(' << pos.first << ", " << pos.second << ')' << std::endl;
          });
 }
开发者ID:skgbanga,项目名称:Sandbox,代码行数:7,代码来源:algorithm.cpp

示例5:

void FIRC16xR16x32Decim8::configure(
	const std::array<tap_t, taps_count>& taps,
	const int32_t scale
) {
	std::copy(taps.cbegin(), taps.cend(), taps_.begin());
	output_scale = scale;
	z_.fill({});
}
开发者ID:CCrashBandicot,项目名称:portapack-hackrf,代码行数:8,代码来源:dsp_decimate.cpp

示例6: print_graph

 void print_graph(const std::array<std::vector<char>, N>& graph)
 {
    int position = 0;
    std::for_each(graph.cbegin(), graph.cend(), [&](const std::vector<char>& vec)
          {
             std::cout << position++ << ": ";
             print_vec(vec);
          });
 }
开发者ID:skgbanga,项目名称:Sandbox,代码行数:9,代码来源:algorithm.cpp

示例7:

TEST(ec, Sign)
{
  static constexpr std::array<u8, 20> HASH{{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9,
                                            0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9}};
  const std::array<u8, 60> sig = Common::ec::Sign(PRIVATE_KEY.data(), HASH.data());
  // r and s must be non-null.
  EXPECT_FALSE(std::all_of(sig.cbegin(), sig.cbegin() + 30, [](u8 b) { return b == 0; }));
  EXPECT_FALSE(std::all_of(sig.cbegin() + 30, sig.cend(), [](u8 b) { return b == 0; }));
}
开发者ID:AdmiralCurtiss,项目名称:dolphin,代码行数:9,代码来源:EcTest.cpp

示例8: sizeof

typename std::enable_if<	
	(std::is_integral<T>::value && std::is_floating_point<U>::value && sizeof(T) < sizeof(U)) ||
	(std::is_floating_point<T>::value && std::is_floating_point<U>::value &&
	sizeof(T) <= sizeof(U)) ||
	(std::is_integral<T>::value && std::is_integral<U>::value &&
	((std::is_unsigned<T>::value && std::is_unsigned<U>::value) ||
	(std::is_signed<T>::value && std::is_signed<U>::value)) &&
	sizeof(T) <= sizeof(U)), void>::type
Copy(const std::array<T, N> &src, std::array<U, N> &dst)
{
	std::copy(src.cbegin(), src.cend(), dst.begin());
}
开发者ID:leepedro,项目名称:StdArray_VS2012,代码行数:12,代码来源:tests.cpp

示例9: SetUp

	void SetUp() override
	{
		m_nodeIds[0] = 3;
		m_nodeIds[1] = 1;
		m_nodeIds[2] = 14;
		m_nodeIds[3] = 9;
		m_nodeIdsAsVector.assign(m_nodeIds.cbegin(), m_nodeIds.cend());

		m_restState.setNumDof(3, 15);
		m_invalidState.setNumDof(3, 15);
		Vector& x0 = m_restState.getPositions();
		Vector& invalidx0 = m_invalidState.getPositions();
		std::array<Vector3d, 4> points = {{
				Vector3d(0.0, 0.0, 0.0), Vector3d(1.0, 0.0, 0.0),
				Vector3d(0.0, 1.0, 0.0), Vector3d(0.0, 0.0, 1.0)
			}
		};

		// Tet is aligned with the axis (X,Y,Z), centered on (0.0, 0.0, 0.0), embedded in a cube of size 1
		for (size_t nodeId = 0; nodeId < 4; ++nodeId)
		{
			SurgSim::Math::getSubVector(x0, m_nodeIds[nodeId], 3) = points[nodeId];
			SurgSim::Math::getSubVector(invalidx0, m_nodeIds[nodeId], 3) = points[nodeId];
		}
		// In the invalid state, the tetrahedron is degenerated to a triangle (last 2 points are equal)
		SurgSim::Math::getSubVector(invalidx0, m_nodeIds[3], 3) = points[2];

		m_rho = 1000.0;
		m_E = 1e6;
		m_nu = 0.45;

		Vector3d axis(1.0, 0.2, -0.3);
		axis.normalize();
		m_rotation = SurgSim::Math::makeRotationMatrix(4.1415, axis);
		m_R12x12 = Eigen::Matrix<double, 12, 12>::Zero();
		for (size_t nodeId = 0; nodeId < 4; ++nodeId)
		{
			m_R12x12.block<3, 3>(3 * nodeId, 3 * nodeId) = m_rotation;
		}
		m_translation = Vector3d(1.2, 2.3, 3.4);
	}
开发者ID:simquest,项目名称:opensurgsim,代码行数:41,代码来源:Fem3DElementCorotationalTetrahedronTests.cpp

示例10:

void app::benchmark::task_func()
{
  #if(APP_BENCHMARK_TYPE == APP_BENCHMARK_TYPE_CRC32)

    const std::array<std::uint8_t, 9U> data =
    {{
      0x31U, 0x32U, 0x33U, 0x34U, 0x35U, 0x36U, 0x37U, 0x38U, 0x39U
    }};

    typedef mcal::benchmark::benchmark_port_type port_type;

    mcal::irq::disable_all();
    port_type::set_pin_high();

    app_benchmark_crc = math::checksums::crc32_mpeg2(data.cbegin(),
                                                     data.cend());

    port_type::set_pin_low();
    mcal::irq::enable_all();

    if(app_benchmark_crc == UINT32_C(0x0376E6E7))
    {
      // The benchmark is OK.
      // Perform one nop and leave.

      mcal::cpu::nop();
    }
    else
    {
      // The benchmark result is not OK!
      // Remain in a blocking loop and crash the system.

      for(;;) { mcal::cpu::nop(); }
    }

  #endif // APP_BENCHMARK_TYPE == APP_BENCHMARK_TYPE_CRC32
}
开发者ID:caomw,项目名称:real-time-cpp,代码行数:37,代码来源:app_benchmark.cpp


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