Top "Typetraits" questions

Type traits are syntactic extensions that allow the developer to determine at compile time various characteristics of a type.

Find out whether a C++ object is callable

Is it possible to write a type trait, say is_callable<T> which tells if an object has …

c++ metaprogramming traits typetraits
Check if a variable type is iterable?

Is there any way to check if an arbitrary variable type is iterable? So to check if it has indexed …

c++ templates typetraits iterable
trivial vs. standard layout vs. POD

In layman's terms, what's the difference between trivial types, standard layout types and PODs? Specifically, I want to determine whether …

c++ constructor initialization pod typetraits
Checking a member exists, possibly in a base class, C++11 version

In https://stackoverflow.com/a/1967183/134841, a solution is provided for statically checking whether a member exists, possibly in a subclass …

c++ c++11 final template-meta-programming typetraits
Get the return type of a method from a member function pointer

I'm trying to declare a variable so that its type is the same as the return type of a member …

c++ typetraits member-function-pointers decltype
How do I use std::is_integral<> to select an implementation?

I'm trying to return an int64_t if std::is_integral<>::value is true. Otherwise, I would like …

c++ templates c++11 typetraits
What is decltype with two arguments?

Edit, in order to avoid confusion: decltype does not accept two arguments. See answers. The following two structs can be …

c++ c++11 sfinae typetraits decltype
How do I use std::enable_if with a self-deducing return type?

C++14 will have functions whose return type can be deduced based on the return value. auto function(){ return "hello world"; } …

c++ template-meta-programming typetraits c++14 enable-if
C++ Compile-Time offsetof inside a template

I have the need to use offsetof from a template with a member selector. I've come up with a way, …

c++ c++11 typetraits offsetof
Differences between std::is_integer and std::is_integral?

C++11 provides two type trait template classes: std::is_integer and std::is_integral. However, I cannot tell the differences …

c++ c++11 language-lawyer typetraits