-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRvoDisabled_5.cpp
44 lines (34 loc) · 956 Bytes
/
RvoDisabled_5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* \file RvoDisabled
* \brief When RVO doesn’t / can’t happen
*
* \see https://shaharmike.com/cpp/rvo/#when-rvo-doesn-t-can-t-happen
*
* Returning Member
*
* In some cases even an unnamed variable can’t RVO:
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
#define RULE_5_OPTION_LOG 1
#include <Idioms/RuleOf/Rule5.h>
//--------------------------------------------------------------------------------------------------
struct Wrapper
{
Rule5 obj;
};
//--------------------------------------------------------------------------------------------------
Rule5 foo()
{
return Wrapper().obj;
}
//--------------------------------------------------------------------------------------------------
int main(int, char **)
{
Rule5 s = ::foo();
return EXIT_SUCCESS;
}
//--------------------------------------------------------------------------------------------------
#if OUTPUT
#endif