In general, the new keyword auto
in C++11 indicates that the type of the expression (in this case the return type of a function) should be inferred from the result of the expression, in this case, what occurs after the ->
.
Without it, the function would have no type (thus not being a function), and the compiler would end up confused.
Related Contents:
- Passing capturing lambda as function pointer
- Is cout synchronized/thread-safe?
- C++0x has no semaphores? How to synchronize threads?
- Generate random numbers using C++11 random library
- When does a constexpr function get evaluated at compile time?
- Conveniently Declaring Compile-Time Strings in C++
- How well is Unicode supported in C++11?
- How do I pass a unique_ptr argument to a constructor or a function?
- Converting std::__cxx11::string to std::string
- using extern template (C++11)
- Can I implement an autonomous `self` member type in C++?
- How std::unordered_map is implemented
- Should the trailing return type syntax style become the default for new C++11 programs? [closed]
- How to pass parameters correctly?
- Why no default move-assignment/move-constructor?
- How to check if a std::thread is still running?
- How to parse a date string into a c++11 std::chrono time_point or similar?
- ‘colon’ and ‘auto’ in for loop c++? need some help understanding the syntax
- Is constexpr supported with lambda functions / expressions?
- Reading from ifstream won’t read whitespace
- Should we pass a shared_ptr by reference or by value?
- Does this code from “The C++ Programming Language” 4th edition section 36.3.6 have well-defined behavior?
- C++: Can a macro expand “abc” into ‘a’, ‘b’, ‘c’?
- What is the easiest way to print a variadic parameter pack using std::ostream?
- Volatile in C++11
- Move-only version of std::function
- Why is the new random library better than std::rand()?
- C++11 – static_assert within constexpr function?
- What does std::match_results::size return?
- std::shared_ptr thread safety explained
- C++ Modules – why were they removed from C++0x? Will they be back later on?
- Check at Compile-Time if Template Argument is void
- declare template friend function of template class
- std::bind a bound function
- How to construct std::array object with initializer list? [duplicate]
- Constexpr pointer value
- C++11: The range-based for statement: “range-init” lifetime?
- Is a Union Member’s Destructor Called
- C++ memory model and race conditions on char arrays
- Get function pointer from std::function when using std::bind
- Why does the standard differentiate between direct-list-initialization and copy-list-initialization?
- Should I delete the move constructor and the move assignment of a smart pointer?
- Function returning a lambda expression
- Is the ranged based for loop beneficial to performance?
- What does the void() in decltype(void()) mean exactly?
- C++ terminate called without an active exception
- error::make_unique is not a member of ‘std’
- enum vs constexpr for actual static constants inside classes
- C++ priority_queue with lambda comparator error
- std::unique_ptr with derived class