Why can I evaluate a function receiving a std::pair at compile-time, but not assert it? [duplicate]
问题 This question already has answers here : constexpr function parameters as template arguments (4 answers) C++11 constexpr function pass parameter (3 answers) Closed 12 months ago . I wrote a function that receives a variadic number of std::pairs. It takes the pairs, subtracts the 2nd element against the 1st element of each pair, and returns a tuple of the newly generated values like this: #include <tuple> #include <utility> template<typename... pairs> inline constexpr auto foo(pairs&& ...p)