Erich Keane
Erich.Keane@verizon.net
Gabriel Dos Reis
// Make names from std.io module available
import std.io;
// declare module M
module M;
// import & export names from std.random
export module std.random;
// Define & export Point
export struct Point { int x, y;}; // m1.ixx
module M;
export int sq(int i){return i*i;}
// m2.cxx
import M;
int main(){
return sq(9);
// sq imported from Module M
}GGor Nishanov, Jens Maurer, Richard Smith, Daveed Vandevoorde
Jens Maurer
Alan Talbot
Mike Spertus, Faisal Vali, Richard Smith
// Example Given:
lock_guard<shared_timed_mutex,
shared_lock<shared_timed_mutex>>
lock(mut, r1);
// Could be:
lock_guard lock(mut, r1);
Also:
template<class T>
struct Foo{ Foo(T t) {} };
//Currently would need to do:
Foo<int> f(5);
// Could be:
Foo f(5);
//If T is a lambda, really hard today!
auto lambda = [](int i){...};
Foo f<decltype(lambda)>(lambda);
// Could be:
Foo f([](int i) {...});
Gabriel Dos Reis, Herb Sutter, Jonathan Caves
// Unspecified Behavior
int i = 0;
foo(i++, i++, i++, i++);
// Chaining is a problem! No gaurantee WHEN find is going to be executed here:
void f() {
std::string s = "but I have heard it works even if you don’t believe in it"
s.replace(0, 4, "").replace(s.find(“even”), 4, "only").replace(s.find(" don’t"), 6, "");
assert(s == "I have heard it works only if you believe in it");
}Rein Halbersma
//Trivial Definition:
namespace std {
inline namespace literals {
inline namespace support_literals {
constexpr size_t operator "" zu(unsigned long long v){
return static_cast<size_t>(unsigned long v);
}
}
}
}Andrew Tomazos
// uses tF 'text file' literal to print contents of the .txt file
std::cout << tF"datafile.txt";
// uses the bF 'binary file' literal to fill variable f
constexpr auto f = bF"foo.bin";
Gabriel Dos Reis, Jose Daniel Garcia, John Lakos, Alisdar Meredith, N. Myers, Bjarne Stroustrup
void push(queue &q)
//expects/ensures can also
// be on declarations
[[ expects: !q.full() ]]
[[ ensures: !q.empty() ]]
{
...
[[ assert: q.is_ok() ]];
}
fin