jeudi 5 octobre 2017

How to use std::is_volatile?

I am trying to disallow a specific operation on volatile types. To accomplish this I am trying to use std::is_volatile, but the code below is compiling without errors, which is not what I want.

Why is is_volatile::value false in the case below?

#include <type_traits>

template<typename T>
inline void DoStuff(T val) {
    static_assert(!std::is_volatile<T>::value, "No volatile types plz");
    //...
}

int main() {
    volatile char sometext[261];
    DoStuff(sometext);
}

Aucun commentaire:

Enregistrer un commentaire