mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 18:14:36 +03:00
Simplify Type Traits example (#35)
The `std::is_<type>::value` already returns a `bool`, so comparing it to `1` is unnecessary.
This commit is contained in:
committed by
Anthony Calandra
parent
21c9492403
commit
79c439134f
6
CPP11.md
6
CPP11.md
@@ -604,9 +604,9 @@ std::to_string(123); // == "123"
|
||||
### Type traits
|
||||
Type traits defines a compile-time template-based interface to query or modify the properties of types.
|
||||
```c++
|
||||
static_assert(std::is_integral<int>::value == 1);
|
||||
static_assert(std::is_same<int, int>::value == 1);
|
||||
static_assert(std::is_same<std::conditional<true, int, double>::type, int>::value == 1);
|
||||
static_assert(std::is_integral<int>::value);
|
||||
static_assert(std::is_same<int, int>::value);
|
||||
static_assert(std::is_same<std::conditional<true, int, double>::type, int>::value);
|
||||
```
|
||||
|
||||
### Smart pointers
|
||||
|
||||
Reference in New Issue
Block a user