问题标签 [c++-concepts]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - C++ 概念是存在类型的一种形式吗?
我在 Wikipedia ( Existential_types )上查看存在类型的定义,它在某些方面与 C++ 中的概念相似(尤其是概念 lite)。
C++ 概念是存在类型的一种形式吗?
如果不是,两者有什么区别?
c++ - C++ 概念与 static_assert
c++ 概念中究竟有什么新东西?在我的理解中,它们在功能上等同于 using static_assert
,但以一种“很好”的方式意味着编译器错误将更具可读性(正如 Bjarne Stroustup 所说,你不会得到 10 页或错误,而只会得到一个)。
基本上,你可以用你也可以实现的概念做的所有事情是真的static_assert
吗?
有什么我想念的吗?
c++ - 以下小于(<)运算符合法的类型 T 是什么?
在阅读Alexander Stepanov的《编程笔记》一书时,我遇到了他提到的以下问题(第 07 页)。它是关于任何类型 T的小于 (<) 运算符。
- 解释为什么这对任何类 T 都是错误的?
- 解释使这个定义合法的对 T 的要求是什么?
我无法理解上面代码可以正常工作的 T 类型。到目前为止,我认为(第二点)以下类型(指针)可能是合法的。我知道这没有多大意义(比较指针类型不是好主意),这也取决于创建了哪个订单对象。
我在这里遗漏了一些明显的东西吗?有人可以解释这两种情况吗?
c++ - 静态断言类型 A 可以从类型 B 构造
我正在尝试做一个静态断言来检查两种类型 A 和 B;类 A 应该具有签名 A(B& b) 或 A(const B& b) 的公共构造函数。
我想要某种东西来is_constructable_from<A, B>::value
评估true
是否存在公共A(B&b)或A(const B&b)或A(B b)。
我想这与 boost is_convertible type_trait有点不同。
我如何实现这一目标?
我是否错过了可以在 Boost Type Traits 或 Concept Check 库中执行此操作的内容?
现在我需要这个来静态检查表达式A a(b)
是否有效,正如 Sehe 所建议的那样,它比以前的概念限制更少。欢迎为这两种情况提供解决方案。我被允许使用 Boost。
c++ - list of standard concepts?
From what I remember C++ has concepts such as Mergable, Container, Comparable, Sortable, Arithmetic etc. I seen them here and there but I never seen a list. Where can I find a list of standard C++ concepts?
-edit- people are confused but what I mean is the example template line in this slide which has Container and Sortable. What else is there?
c++ - Will C++14 support unconstrained generic functions?
While looking at the GCC 4.9.0 release changes here, I was pleasantly surprised to read the following; under the "New Languages and Language specific improvements" section for C++:
G++ supports unconstrained generic functions as specified by §4.1.2 and §5.1.1 of N3889: Concepts Lite Specification. Briefly, auto may be used as a type-specifier in a parameter declaration of any function declarator in order to introduce an implicit function template parameter, akin to generic lambdas.
I built GCC 4.9.0 and my initial tests worked as expected. I believe that Concepts Lite will remain somehow auxiliary to the upcoming C++14 specification. Is there though any plan for "unconstrained generic functions" to become a part of C++?
c++ - 我们如何在 UML 图中表达概念?
UML 类图是否支持表达概念?
另外,还有其他表达概念的图表吗?
以防万一,我指的是 C++ 和泛型编程中的“概念”。
c++ - 什么是 C++ 运行时概念?
我最近一直在网上寻找有关 C++ 概念的详细信息,并找到了几篇对几篇论文所称的“运行时概念”的引用。它们与编译时概念究竟有什么不同,为什么首先引入它们,它们将如何实现,为什么它们对 C++ 的未来很重要?通过浏览这些文件,我大致了解运行时概念旨在缓解当前存在于面向对象和通用代码之间的紧张关系,但我没有从中得到太多其他信息。