Skip to content

Commit

Permalink
add short hand rule for ::value
Browse files Browse the repository at this point in the history
add rule how to shorten `::value` access to traits
  • Loading branch information
psychocoderHPC committed Dec 16, 2016
1 parent fe9c27e commit 49c5e02
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion codingGuideLines/cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,19 @@ namespace traits
```


## 20. Short Access to `::type` in C++11
## 20. Short Access to Member type/value in C++11
- add suffix `_t` to the trait name for short access to `::type` ( [same as remove_pointer_t in C++14](http://en.cppreference.com/w/cpp/types/remove_pointer) )
```C++
template<
typename T_Type
>
using GetValueType_t = typename traits::GetValueType< T_Type >::type;
```
- add suffix `_v` to the trait name for short access to `::value` ( [same as std::rank_v](http://en.cppreference.com/w/cpp/types/rank) )
```C++
template<
typename T_Type
>
using IsValid_v = traits::IsValid< T_Type >::value;
```

0 comments on commit 49c5e02

Please sign in to comment.