2 ms·
Here's another example: Test code: #include <memory> int main() { std::unique_ptr<int> pPointer = std::make_unique<int>(); return 0; } He
by geezerjay 9y ago
Here's another example:
Test code:
#include <memory>
int main()
{
std::unique_ptr<int> pPointer = std::make_unique<int>();
return 0;
}
Here's the GCC output (v4.9.2) with C++14:
geezerjay@debian:tmp$ g++ --std=c++14 main.c++
geezerjay@debian:tmp$
And now the GCC output with C++11:
geezerjay@debian:tmp$ g++ --std=c++14 main.c++
main.c++: In function ‘int main()’:
main.c++:5:34: error: ‘make_unique’ is not a member of ‘std’
std::unique_ptr<int> pPointer = std::make_unique<int>();
^
main.c++:5:51: error: expected primary-expression before ‘int’
std::unique_ptr<int> pPointer = std::make_unique<int>();
geezerjay@debian:tmp$
Perhaps recent GCC versions catch this issue, but errors are indeed thrown if make_unique, a C++14 feature, is present while compiling C++11 code.
- deleted 9y ago[deleted]