22 May 2013 23:11
From CppNow 2013
Among the CppNow 2013 slide packs I have found two interesting things: https://github.com/boostcon/cppnow_presentations_2013 ---------------------- One is from "Concepts Lite: Constraining Templates with Predicates" by Andrew Suttoon, Bjarne Stroustrup et al: https://github.com/boostcon/cppnow_presentations_2013/blob/master/thu/concepts-lite.pdf?raw=true This is a D version of C++13 code that uses Concepts Lite: void sort(C)(C cont) if (SortableContainer!C) {} They suggest to allow a syntax like this, usable when the template constraint has only one argument: void sort(SortableContainer cont) {} It's handy especially for lambdas: (Regular x) => x == y; If you have two or more types, they must be the same (if you don't want this, you have to use the normal longer syntax): void foo(isRandomAccessRange a, isRandomAccessRange b) {(Continue reading)
RSS Feed