Changeset 5abc7fd in mainline
- Timestamp:
- 2018-07-05T21:41:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6d4e0d9
- Parents:
- 5fb070d
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-10-13 18:37:15)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/utility.hpp
r5fb070d r5abc7fd 61 61 } 62 62 63 // TODO: swap 64 // TODO: exchange 63 /** 64 * 20.2.2, swap: 65 */ 66 67 template<class T> 68 void swap(T& x, T& y) 69 noexcept(is_nothrow_move_constructible<T>::value && 70 is_nothrow_move_assignable<T>::value) 71 { 72 T tmp{std::move(x)}; 73 x = std::move(y); 74 y = std::move(tmp); 75 } 76 77 template<class T, size_t N> 78 void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b))) 79 { 80 // TODO: Use swap_ranges(a, a + N, b); when implemented. 81 } 82 83 /** 84 * 20.2.3, exchange: 85 */ 86 87 template<class T, class U = T> 88 T exchange(T& obj, U&& new_val) 89 { 90 T old_val = std::move(obj); 91 obj = std::forward<U>(new_val); 92 93 return old_val; 94 } 65 95 66 96 /**
Note:
See TracChangeset
for help on using the changeset viewer.