YSTest: iterator_trait.hpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

iterator_trait.hpp
浏览该文件的文档.
1 /*
2 © 2014-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YB_INC_ystdex_iterator_trait_hpp_
29 #define YB_INC_ystdex_iterator_trait_hpp_ 1
30
31 #include "type_traits.hpp" // for std::pair, std::declval, enable_if_t,
32 // are_same;
33 #include <iterator> // for std::iterator_traits;
34
35 namespace ystdex
36 {
37
43 template<class _type, typename... _tIter>
44 struct have_same_iterator_category : are_same<_type,
45 typename std::iterator_traits<_tIter>::iterator_category...>
46 {};
47
54 template<typename _tParam, typename _type = void, typename = yimpl(std::pair<
55 indirect_t<_tParam&>, decltype(++std::declval<_tParam&>())>)>
56 using enable_for_iterator_t = enable_if_t<
57 is_same<decltype(++std::declval<_tParam&>()), _tParam&>::value, _type>;
58
59 } // namespace ystdex;
60
61 #endif
62
ystdex::enable_for_iterator_t
enable_if_t< is_same< decltype(++std::declval< _tParam & >()), _tParam & >::value, _type > enable_for_iterator_t
选择迭代器类型的特定重载避免和其它类型冲突。
Definition: iterator_trait.hpp:57
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: type_traits.hpp:350
ystdex::indirect_t
decltype(*std::declval< _type >()) indirect_t
Definition: type_traits.hpp:978
yimpl
#define yimpl(...)
实现标签。
Definition: ydef.h:256
ystdex
特性测试宏。
Definition: ydef.h:796
ystdex::have_same_iterator_category
判断若干个迭代器是否指定的类别。
Definition: iterator_trait.hpp:44
type_traits.hpp
ISO C++ 类型特征扩展。
ystdex::are_same
判断第一个参数和之后的参数指定的类型相同。
Definition: type_traits.hpp:934