You can define a function alias (with some work) using perfect forwarding:
template <typename... Args>
auto g(Args&&... args) -> decltype(f(std::forward<Args>(args)...)) {
return f(std::forward<Args>(args)...);
}
This solution does apply even if f
is overloaded and/or a function template.
Related Contents:
- Proper way to create unique_ptr that holds an allocated array
- What is the performance penalty of C++11 thread_local variables in GCC 4.8?
- Error “undefined reference to ‘std::cout'”
- std::vector performance regression when enabling C++11
- Clang vs GCC for my Linux Development project
- What are the GCC default include directories?
- error: use of deleted function
- What are the differences between -std=c++11 and -std=gnu++11?
- How does #include work in C++? [duplicate]
- Is cout synchronized/thread-safe?
- Member initialization while using delegated constructor
- Is it intended by the C++ standards committee that in C++11 unordered_map destroys what it inserts?
- Linking libstdc++ statically: any gotchas?
- Is gcc 4.8 or earlier buggy about regular expressions?
- C/C++ with GCC: Statically add resource files to executable/library
- Compilation fails with “relocation R_X86_64_32 against `.rodata.str1.8′ can not be used when making a shared object”
- What exactly does GCC’s -Wpsabi option do? What are the implications of supressing it?
- Compiling multithread code with g++
- generates same number in Linux, but not in Windows
- Can I use C++11 with Xcode?
- When is it necessary to use the flag -stdlib=libstdc++?
- How to update GCC in MinGW on Windows?
- GCC worth using on Windows to replace MSVC?
- .o files vs .a files
- How to get a stack trace for C++ using gcc with line number information?
- Strange code that compiles with g++
- std::put_time implementation status in GCC?
- 😃 (and other Unicode characters) in identifiers not allowed by g++
- What is the difference between MinGW, MinGW-w64 and MinGW-builds?
- Is this C++11 regex error me or the compiler?
- Different results between gcc and clang when compiling a rather simple c++11 program
- version `CXXABI_1.3.8′ not found (required by …) [duplicate]
- Using C++11 futures: Nested calls of std::async crash: Compiler/Standard library bug?
- Implementation C++14 make_integer_sequence
- error: anachronistic old-style base class initializer
- Implicit conversion failure from initializer list
- How to use the __attribute__((visibility(“default”)))?
- Requiring virtual function overrides to use override keyword
- VS Code will not build c++ programs with multiple .ccp source files
- Can nullptr be emulated in gcc?
- How can the compile-time be (exponentially) faster than run-time?
- Why do Clang and VS2013 accept moving brace-initialized default arguments, but not GCC 4.8 or 4.9?
- Why does this snippet using uniform initialization compile with g++4.6 but not g++4.7?
- Are the days of passing const std::string & as a parameter over?
- Undefined reference to vtable
- Why is conversion from string constant to ‘char*’ valid in C but invalid in C++
- Does C++11 allow vector?
- “relocation R_X86_64_32S against ” linking Error
- enum vs constexpr for actual static constants inside classes
- What STL algorithm can determine if exactly one item in a container satisfies a predicate?