diff options
author | Peng Wu <alexepico@gmail.com> | 2011-08-31 15:27:35 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-08-31 15:27:35 +0800 |
commit | 420ffb6d69189f5e0c4e80e7f829cde61fccab4f (patch) | |
tree | df0eca8e4deed06e2151ecd82557411192e4cf1b /src | |
parent | 7e85b8930fc00c3f66d689654e22930f2e15fc67 (diff) | |
download | libpinyin-420ffb6d69189f5e0c4e80e7f829cde61fccab4f.tar.gz libpinyin-420ffb6d69189f5e0c4e80e7f829cde61fccab4f.tar.xz libpinyin-420ffb6d69189f5e0c4e80e7f829cde61fccab4f.zip |
add swap to stl lite
Diffstat (limited to 'src')
-rw-r--r-- | src/include/stl_lite.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/include/stl_lite.h b/src/include/stl_lite.h index 0612782..e92b656 100644 --- a/src/include/stl_lite.h +++ b/src/include/stl_lite.h @@ -7,6 +7,7 @@ namespace std_lite{ + /** * @brief This does what you think it does. * @param a A thing of arbitrary type. @@ -48,6 +49,24 @@ namespace std_lite{ return __a; } + + /** + * @brief Swaps two values. + * @ingroup mutating_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return Nothing. + */ + template<typename _Tp> + inline void + swap(_Tp& __a, _Tp& __b) + { + _Tp __tmp = __a; + __a = __b; + __b = __tmp; + } + + /** * This is one of the @link s20_3_1_base functor base classes@endlink. */ @@ -60,7 +79,7 @@ namespace std_lite{ typedef _Arg2 second_argument_type; ///< the type of the second argument typedef _Result result_type; ///< type of the return type }; - /** @} */ + /// pair holds two objects of arbitrary type. template<class _T1, class _T2> |