Template Deduction Guide

Template Deduction Guide is used to tell the compiler that the type of the passed parameter(s) should meet the requirement stated by the guide. It usually used alongside with #202204181611. Its replacement will be 202203281200# in C++20.

An example of such usage is shown below:

template<typename Iter>
Vector(Iter, Iter) -> Vector<typename std::iterator_traits<Iterator>::value_type>;

Note: The left-hand side of the statement does not mean to match to the class constructor. It merely serves as a matching guide to the parameters.

Links to this page
#metaprogramming #cpp