runsisi's

technical notes

scalar type

2019-03-12 runsisi#cpp

scalar

a scalar is a fundamental except it cannot be void, but it can be a pointer type, or an enum type.
And a fundamental has a keyword in the language.
template< class T >
struct is_scalar : std::integral_constant<bool,
                     std::is_arithmetic<T>::value     ||
                     std::is_enum<T>::value           ||
                     std::is_pointer<T>::value        ||
                     std::is_member_pointer<T>::value ||
                     std::is_null_pointer<T>::value> {};

参考资料

Type Classification

http://howardhinnant.github.io/TypeHiearchy.pdf

What is a scalar Object in C++?

https://stackoverflow.com/questions/14821936/what-is-a-scalar-object-in-c

std::is_scalar

https://en.cppreference.com/w/cpp/types/is_scalar

Type

https://en.cppreference.com/w/cpp/language/type

You may use braced initializer lists

https://www.jarchitect.com/QACenter/index.php?qa=77&qa_1=you-may-use-braced-initializer-lists

value initialization

https://en.cppreference.com/w/cpp/language/value_initialization