mardi 27 octobre 2015

std::is_signed does not work for strongly typed enums : int

Can anyone please explain, why

#include <iostream>
#include <type_traits>
using namespace std;
enum E : signed int { a=-1, b = 1,};
int main() {
    std::cout << std::boolalpha;
    cout << "strong typed enum E:int should be signed, but is_signed returns " 
    << is_signed<E>() << "\n";
    return 0;
}

std::is_signed<> does not do, what it says on the tin? Thanks...

Aucun commentaire:

Enregistrer un commentaire