小编Jin*_* Ma的帖子

Why do these two code snippets have the same effect?

template <typename T1, typename T2>
auto max (T1 a, T2 b) -> decltype(b<a?a:b);
Run Code Online (Sandbox Code Playgroud)
template <typename T1, typename T2>
auto max (T1 a, T2 b) -> decltype(true?a:b);
Run Code Online (Sandbox Code Playgroud)

I do not understand why these two code snippets can have the same effect. Plz give me some hint and a underlying explanation.

Cheers.

c++ decltype ternary c++17

8
推荐指数
2
解决办法
193
查看次数

AVL在AVL树中代表什么?

AVL树与自平衡二叉搜索树相同.AVL代表什么?这与发明人的名字有关吗?

avl-tree binary-search-tree data-structures

5
推荐指数
1
解决办法
2802
查看次数