language: C++11 (gcc-4.7.2)
date: 650 days 19 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <memory>
 
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
    return std::unique_ptr<T>(new T(std::forward(args)...));
}
 
struct A { A(int,int) {} };
 
int main() {
  auto p = make_unique<A>(1, 2); (void)p;
}
prog.cpp: In function 'std::unique_ptr<T> make_unique(Args&& ...) [with T = A, Args = {int, int}]':
prog.cpp:12:31:   instantiated from here
prog.cpp:6:59: error: no matching function for call to 'forward(int&)'