My internal sanity check failed so I'm rerunning it on Stackoverflow.
The following code:
#include <iostream>
#include <typeinfo>
#include <utility>
int main()
{
constexpr auto pair_of_ints = std::make_pair(1, 2);
std::cerr << typeid(pair_of_ints).name();
//static_assert(std::is_same<decltype(pair_of_ints), std::pair<int, int>>::value, "WTF");
}
produces the mangled symbol name for std::__1::pair<int, int>
on my system (XCode Clang 8.x).
If I then enable the static_assert
, it fails. I have no idea why. How can I make this work? I have a function that returns a pair or tuple depending on the arguments passed to it and would like to verify it actually returns a pair or tuple in the correct cases.
Aucun commentaire:
Enregistrer un commentaire