non-type

    1热度

    2回答

    考虑以下代码: #include <array> template < int... Ints > constexpr std::array<int,sizeof...(Ints)> theIntArray = {Ints...}; template < size_t NN > constexpr void test(const std::array<int,NN>& xx) {

    5热度

    2回答

    我努力实现以下目标: template<template<typename> bool Function_, typename ... Types_> constexpr auto find(Tuple<Types_ ... >) noexcept { // ... } ,其中一个可能的功能可能是: template<typename T> inline constexpr

    0热度

    3回答

    我有一个非类型模板类: template<int N> class MyClass; // prototype 和通用模板函数: template<class T> Parameters validParams(); // prototype 什么是使用非类型模板正确的语法类模板化的功能?如果我不使用模板类,那么正确的语法是: template<> Parameters validPara

    4热度

    1回答

    我试图专注Expr: #include <tuple> #include <type_traits> #include <iostream> template<class Tp, class List> struct Expr { Expr(){std::cout << "0"<< std::endl;}; }; //specialization #1 template

    0热度

    1回答

    我想使我的应用程序的std::map s'键不是int s,而是更强烈类型为模板非类型enum定义为一个成员struct。下面的第一个程序显示了我的应用程序目前如何使用map s的概念。它编译并运行正常。 #include <map> template<int> struct NummedMap { typedef std::map< int, NummedMap > Numab

    0热度

    1回答

    我编写了下面的代码来简单地在python中实现一个二叉树。当我调用“find_Node”方法时,我得到“AttributeError:'NoneType'对象没有属性'data'”。我知道这个错误是什么,但我无法找到为什么当我打电话“find_Node”的方法出现。任何线索将不胜感激。 这里是我的代码: #!/usr/bin/env python2 class BinaryTree:

    1热度

    1回答

    我的问题可能与this one有关,但我认为我没有“部分专用的非类型参数表达式”,或者不理解关系。 下面的代码产生具有MSVC14编译器(CPP11)一个内部错误: template<typename T, T... Elmts> struct NonTyped { }; template<typename T> struct is_NonTyped_of_type {

    1热度

    1回答

    的C++ 17标准说: 模板参数的用于非类型模板参数应是 转换常量表达式... 而 常量表达式的值不应不得的 的 地址 一个字符串 的子对象 其他一些产生的异常... 按我的理解字符串文字除外背后的基本原理是,根据它可以执行在不同翻译单元中出现的A<"abc">可能导致不同的实例化(因为字符串文字具有内部链接),或者可能是字符串文字的地址在linki ng时间(因为字符串文字存储在一些特殊的只读存

    0热度

    1回答

    实现优先级队列时NoneType AttributeError的 class Node: def __init__(self, data=None, priority='L', next=None): self.data = data self.priority = priority self.next = next def __str__

    3热度

    1回答

    考虑this代码: #include <type_traits> template <int> struct II { }; template < const int& > struct RR { }; template < template <auto> typename Class, typename Type > struct Check : std::false_type { }