Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The value of template type like std::false_type

Tags:

c++

templates

If std::false_type is a type, what is the valid value for this type? If I just want to implement a function like below whose return type is std::false_type, how could I achieve this?

typename std::false_type operator()(){
   return declval<std::false_type>();
}
like image 475
Bostonian Avatar asked May 03 '18 00:05

Bostonian


Video Answer


1 Answers

Try return std::false_type{}; or return {}; as suggested in the comment.

like image 193
xskxzr Avatar answered Oct 21 '22 15:10

xskxzr