他们如何在没有显式模型的情况下避免基于概念的重载问题(a.k.a。概念图)

How they avoid problems with concept-based overloading without explicit models (a.k.a. concept maps)

正如 Andrew Sutton 在许多演讲和论文中指出的那样,Concepts Lite 提案确实具有基于概念的重载功能,同时没有概念图的概念,即检查模板参数完全由编译器反对概念。鉴于此,尚不清楚他们将如何解决 Siek 和 Gregor 在 2005 年的论文“Explicit model definitions are necessary”中描述的问题。简而言之,问题可以用论文中的以下引文来说明。

So, there are certain input iterator types (such as istream_iterator) that would be misclassified as forward iterators. What is the danger in this? Some algorithms dispatch based on Input_iterator vs. Forward_iterator.

(不过除了迭代器还有更多例子。)

是的,我知道上面提到的论文考虑了 C++0x 概念,但问题似乎是概念提案的“通用”问题。

n3351 A Concept Design for the STL中的提议是继续使用迭代器类标签:

concept InputIterator<WeakInputIterator I> =
    EqualityComparable<I> &&
    Derived<IteratorCategory<I>, input_iterator_tag>;

根据 n4377 C++ Extensions for Concepts 预期包含在标准中的语法:

template<typename I>
concept bool InputIterator =
    WeakInputIterator<I>() && EqualityComparable<I>() &&
    Derived<IteratorCategory<I>, input_iterator_tag>();

来自前文:

While C++11 makes it possible to evaluate all static requirements [...] we still need to differentiate some concepts based on their semantic requirements. The iterator category solves that problem for us.

一般来说,可以通过检查仅用于断言运行时语义的类型谓词(例如嵌套类型或常量,或类型函数)来表达语义要求。