C++: Improve make_pair in stl.h (using remove_reference).

This commit is contained in:
Geoffrey White 2020-09-30 15:57:28 +01:00
Родитель 7ecd229ce7
Коммит 952cc89c2a
2 изменённых файлов: 40 добавлений и 26 удалений

Просмотреть файл

@ -1981,31 +1981,31 @@
| standalone_iterators.cpp:51:37:51:43 | source1 | standalone_iterators.cpp:53:12:53:18 | source1 | |
| standalone_iterators.cpp:51:37:51:43 | source1 | standalone_iterators.cpp:54:14:54:20 | source1 | |
| standalone_iterators.cpp:53:12:53:18 | ref arg source1 | standalone_iterators.cpp:54:14:54:20 | source1 | |
| stl.h:222:30:222:40 | call to allocator | stl.h:222:21:222:41 | noexcept(...) | TAINT |
| stl.h:222:30:222:40 | call to allocator | stl.h:222:21:222:41 | noexcept(...) | TAINT |
| stl.h:222:30:222:40 | call to allocator | stl.h:222:21:222:41 | noexcept(...) | TAINT |
| stl.h:222:30:222:40 | call to allocator | stl.h:222:21:222:41 | noexcept(...) | TAINT |
| stl.h:222:30:222:40 | call to allocator | stl.h:222:21:222:41 | noexcept(...) | TAINT |
| stl.h:222:53:222:63 | 0 | stl.h:222:46:222:64 | (no string representation) | TAINT |
| stl.h:315:9:315:9 | Unknown literal | stl.h:315:9:315:9 | constructor init of field first | TAINT |
| stl.h:315:9:315:9 | Unknown literal | stl.h:315:9:315:9 | constructor init of field second | TAINT |
| stl.h:315:9:315:9 | constructor init of field first [post-this] | stl.h:315:9:315:9 | constructor init of field second [pre-this] | |
| stl.h:315:9:315:9 | constructor init of field first [pre-this] | stl.h:315:9:315:9 | constructor init of field second [pre-this] | |
| stl.h:315:9:315:9 | this | stl.h:315:9:315:9 | constructor init of field first [pre-this] | |
| stl.h:322:3:322:3 | this | stl.h:322:36:322:43 | constructor init of field first [pre-this] | |
| stl.h:322:3:322:6 | this | stl.h:322:36:322:43 | constructor init of field first [pre-this] | |
| stl.h:322:18:322:18 | x | stl.h:322:42:322:42 | x | |
| stl.h:322:18:322:18 | x | stl.h:322:42:322:42 | x | |
| stl.h:322:31:322:31 | y | stl.h:322:53:322:53 | y | |
| stl.h:322:31:322:31 | y | stl.h:322:53:322:53 | y | |
| stl.h:322:36:322:43 | call to unknown function | stl.h:322:36:322:43 | constructor init of field first | TAINT |
| stl.h:322:36:322:43 | constructor init of field first [post-this] | stl.h:322:46:322:54 | constructor init of field second [pre-this] | |
| stl.h:322:36:322:43 | constructor init of field first [post-this] | stl.h:322:46:322:54 | constructor init of field second [pre-this] | |
| stl.h:322:36:322:43 | constructor init of field first [pre-this] | stl.h:322:46:322:54 | constructor init of field second [pre-this] | |
| stl.h:322:36:322:43 | constructor init of field first [pre-this] | stl.h:322:46:322:54 | constructor init of field second [pre-this] | |
| stl.h:322:42:322:42 | x | stl.h:322:36:322:43 | constructor init of field first | TAINT |
| stl.h:322:46:322:54 | call to unknown function | stl.h:322:46:322:54 | constructor init of field second | TAINT |
| stl.h:322:53:322:53 | y | stl.h:322:46:322:54 | constructor init of field second | TAINT |
| stl.h:235:30:235:40 | call to allocator | stl.h:235:21:235:41 | noexcept(...) | TAINT |
| stl.h:235:30:235:40 | call to allocator | stl.h:235:21:235:41 | noexcept(...) | TAINT |
| stl.h:235:30:235:40 | call to allocator | stl.h:235:21:235:41 | noexcept(...) | TAINT |
| stl.h:235:30:235:40 | call to allocator | stl.h:235:21:235:41 | noexcept(...) | TAINT |
| stl.h:235:30:235:40 | call to allocator | stl.h:235:21:235:41 | noexcept(...) | TAINT |
| stl.h:235:53:235:63 | 0 | stl.h:235:46:235:64 | (no string representation) | TAINT |
| stl.h:328:9:328:9 | Unknown literal | stl.h:328:9:328:9 | constructor init of field first | TAINT |
| stl.h:328:9:328:9 | Unknown literal | stl.h:328:9:328:9 | constructor init of field second | TAINT |
| stl.h:328:9:328:9 | constructor init of field first [post-this] | stl.h:328:9:328:9 | constructor init of field second [pre-this] | |
| stl.h:328:9:328:9 | constructor init of field first [pre-this] | stl.h:328:9:328:9 | constructor init of field second [pre-this] | |
| stl.h:328:9:328:9 | this | stl.h:328:9:328:9 | constructor init of field first [pre-this] | |
| stl.h:335:3:335:3 | this | stl.h:335:36:335:43 | constructor init of field first [pre-this] | |
| stl.h:335:3:335:6 | this | stl.h:335:36:335:43 | constructor init of field first [pre-this] | |
| stl.h:335:18:335:18 | x | stl.h:335:42:335:42 | x | |
| stl.h:335:18:335:18 | x | stl.h:335:42:335:42 | x | |
| stl.h:335:31:335:31 | y | stl.h:335:53:335:53 | y | |
| stl.h:335:31:335:31 | y | stl.h:335:53:335:53 | y | |
| stl.h:335:36:335:43 | call to unknown function | stl.h:335:36:335:43 | constructor init of field first | TAINT |
| stl.h:335:36:335:43 | constructor init of field first [post-this] | stl.h:335:46:335:54 | constructor init of field second [pre-this] | |
| stl.h:335:36:335:43 | constructor init of field first [post-this] | stl.h:335:46:335:54 | constructor init of field second [pre-this] | |
| stl.h:335:36:335:43 | constructor init of field first [pre-this] | stl.h:335:46:335:54 | constructor init of field second [pre-this] | |
| stl.h:335:36:335:43 | constructor init of field first [pre-this] | stl.h:335:46:335:54 | constructor init of field second [pre-this] | |
| stl.h:335:42:335:42 | x | stl.h:335:36:335:43 | constructor init of field first | TAINT |
| stl.h:335:46:335:54 | call to unknown function | stl.h:335:46:335:54 | constructor init of field second | TAINT |
| stl.h:335:53:335:53 | y | stl.h:335:46:335:54 | constructor init of field second | TAINT |
| string.cpp:24:12:24:17 | call to source | string.cpp:28:7:28:7 | a | |
| string.cpp:25:16:25:20 | 123 | string.cpp:25:16:25:21 | call to basic_string | TAINT |
| string.cpp:25:16:25:21 | call to basic_string | string.cpp:29:7:29:7 | b | |

Просмотреть файл

@ -11,6 +11,19 @@ struct remove_const<const T> { typedef T type; };
template<class T>
using remove_const_t = typename remove_const<T>::type;
template<class T>
struct remove_reference { typedef T type; };
template<class T>
struct remove_reference<T &> { typedef T type; };
template<class T>
struct remove_reference<T &&> { typedef T type; };
// `remove_reference_t<T>` removes any `&` from `T`
template<class T>
using remove_reference_t = typename remove_reference<T>::type;
// --- iterator ---
namespace std {
@ -324,7 +337,8 @@ namespace std {
void swap(pair& p) /*noexcept(...)*/;
};
template< class T1, class T2 > std::pair<T1,T2> make_pair(const T1& t, const T2& u );
template<class T1, class T2> constexpr pair<remove_reference_t<T1>, remove_reference_t<T2>> make_pair(T1&& x, T2&& y);
}
// --- map ---