Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int LegacyFunction(const char *s) {
- // do something with s, like print it to standard output
- // this function does NOT retain any pointer to s after it returns.
- return strlen(s);
- }
- std::string ModernFunction() {
- // do something that returns a string
- return "Hello";
- }
- LegacyFunction(ModernFunction().c_str());
- LegacyFunction(ModernFunction().c_str());
- struct S {
- S(int i): I(i) { }
- int& v() { return I; }
- private:
- int I;
- };
- S s1(1); // full-expression is call of S::S(int)
- S s2 = 2; // full-expression is call of S::S(int)
- void f() {
- if (S(3).v()) // full-expression includes lvalue-to-rvalue and
- // int to bool conversions, performed before
- // temporary is deleted at end of full-expression
- { }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement