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


C++ optional::emplace方法代码示例

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


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

示例1:

static const abi_serializer& get_abi_serializer() {
   static optional<abi_serializer> _abi_serializer;
   if (!_abi_serializer) {
      _abi_serializer.emplace(eosio_contract_abi(abi_def()));
   }

   return *_abi_serializer;
}
开发者ID:wood19910377,项目名称:eos,代码行数:8,代码来源:eosio_contract.cpp

示例2: create_pipeline

	// Creates the graphics pipeline object
	void create_pipeline() {
		// Vulkan shader stage descriptors
		auto shader_stage_descriptors = get_layout().shader_stage_descriptors();

		// Blend operation descriptor for each attachment
		lib::vector<vk::vk_blend_op_descriptor> attachment_blend_ops;
		for (auto &a : fb_layout) {
			const framebuffer_attachment_layout &attachment = a.second;

			// Blend operation is only applicable for color attachments
			const bool is_depth_attachment = format_is_depth(attachment.image_format);
			if (is_depth_attachment)
				continue;

			vk::vk_blend_op_descriptor desc = attachment.blend;
			attachment_blend_ops.push_back(std::move(desc));
		}

		// Set viewport and scissor as dynamic states
		lib::vector<VkDynamicState> dynamic_states = {
			static_cast<VkDynamicState>(pipeline_dynamic_state::viewport),
			static_cast<VkDynamicState>(pipeline_dynamic_state::scissor),
		};

		// Create the graphics pipeline object
		graphics_pipeline.emplace(ctx.get().device(),
								  shader_stage_descriptors,
								  get_layout(),
								  device_renderpass.get(),
								  0,
								  VkViewport{},
								  VkRect2D{},
								  vertex_input_descriptor.vertex_input_binding_descriptors,
								  vertex_input_descriptor.vertex_input_attribute_descriptors,
								  static_cast<VkPrimitiveTopology>(pipeline_settings.topology),
								  pipeline_settings.rasterizer_op,
								  pipeline_settings.depth_op,
								  attachment_blend_ops,
								  pipeline_settings.blend_constants,
								  dynamic_states,
								  pipeline_name.data(),
								  &ctx.get().device().pipeline_cache().current_thread_cache());
	}
开发者ID:ssteinberg,项目名称:ste,代码行数:44,代码来源:device_pipeline_graphics.hpp

示例3: create_renderpass

	// Creates the Vulkan renderpass object
	void create_renderpass() {
		auto renderpass = fb_layout.create_compatible_renderpass(ctx.get());
		device_renderpass.emplace(std::move(renderpass));
	}
开发者ID:ssteinberg,项目名称:ste,代码行数:5,代码来源:device_pipeline_graphics.hpp


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