ICode9

精准搜索请尝试: 精确搜索
  • c – 使用gcc 4.4的模板模板参数和可变参数模板2019-10-07 18:07:08

    我在Debian上使用gcc 4.4.请考虑以下代码. #include <map> #include <string> using std::map; using std::string; // Args lets the user specify additional explicit template arguments template <typename T, template <typename T, typename... Args>

  • c – 命名参数是否用于模板模板参数2019-09-29 05:16:11

    如果我需要使用template-template参数定义模板foo函数,我通常会执行以下操作: // Notice that the template parameter of class T is unnamed. template <template <typename> class T> void f() { std::cout << "Yay!\n"; } 请注意,template-template参数的template参数是未命名

  • c – 模板模板参数和默认值2019-09-27 22:06:32

    参见英文答案 > Deducing first template argument with other template parameters defaulted                                    2个 请考虑以下代码: template<typename T> struct A { }; // same as A, but with one extra defaulted p

  • c – 模板模板参数有哪些用途?2019-09-11 06:08:18

    我已经看到了一些使用模板模板参数(即以模板作为参数的模板)来进行基于策略的类设计的C示例.这种技术有什么其他用途?解决方法:我认为您需要使用模板模板语法来传递一个参数,其类型是依赖于另一个模板的模板,如下所示: template <template<class> class H, class S> void f(const H<

  • C模板作为模板的参数2019-08-28 16:07:24

    我遇到了以下问题.我有以下模板编号: template<int n> struct Number { static const int value = n; }; 现在假设我想在编译时添加两个这样的数字.具体来说,我想让以下代码片段起作用: //The following code should display 7: std::cout << Number_add< Number<3>, Number<4

  • c – 通用模板模板参数2019-08-28 09:08:15

    厌倦了“统一初始化”不是非常统一,我决定编写一个泛型construct()包装器,如果类型是聚合,则使用聚合初始化,否则直接初始化: template <class T, class... Args, std::enable_if_t<std::is_aggregate_v<T>, int> = 0> constexpr auto construct(Args&&... args) ->

  • c – 从元组派生类2019-07-29 00:04:22

    我有一个像这样的std :: tuple: typedef std::tuple<t1, t2, t3> tuple_t; 现在,我想将t3_tuple转换为类似的元组: typedef std::tuple< T<t1>, T<t2>, T<t3> > derived_tuple_t; 在我的例子中,例如,t1,t2和t3是基元,T是std :: stack.一般来说,假设可能有t4等等. 当然,我的第二个

  • c – 使用类型别名如何指定依赖于模板参数的模板模板参数?2019-07-28 08:10:47

    参见英文答案 > Where and why do I have to put the “template” and “typename” keywords?                                    6个 最小的例子: template<template<class ...> class> struct templ {}; template<class T> using speci

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有