📄 mstl_algorithm_base.hpp
字号:
/*
The young Library
Copyright (c) 2005 by 杨桓
Permission to use, copy, modify, distribute and sell this software for any
purpose is hereby granted without fee, provided that the above copyright
notice appear in all copies and that both that copyright notice and this
permission notice appear in supporting documentation.
The author make no representations about the suitability of this software
for any purpose. It is provided "as is" without express or implied warranty.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*/
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#ifndef __MACRO_CPLUSPLUS_MINI_STL_ALGORITHM_BASE_HEADER_FILE__
#define __MACRO_CPLUSPLUS_MINI_STL_ALGORITHM_BASE_HEADER_FILE__
//-----------------------------------------------------------------------------
#include "../mstl_define.hpp"
//-----------------------------------------------------------------------------
__MACRO_CPLUSPLUS_MINI_STL_BEGIN_NAMESPACE__
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
template< typename T >
inline const T& min( const T& lhs, const T& rhs )
{
return ( lhs < rhs ? lhs : rhs );
}
template< typename T, typename StrictWeakOrdering >
inline const T& min( const T& lhs, const T& rhs, StrictWeakOrdering comp )
{
return ( comp(lhs, rhs) ? lhs : rhs );
}
//-----------------------------------------------------------------------------
template< typename T >
inline const T& max( const T& lhs, const T& rhs )
{
return ( rhs < lhs ? lhs : rhs );
}
template< typename T, typename StrictWeakOrdering >
inline const T& max( const T& lhs, const T& rhs, StrictWeakOrdering comp )
{
return ( comp(rhs, lhs) ? lhs : rhs );
}
//-----------------------------------------------------------------------------
template< typename T >
inline void swap( T& lhs, T& rhs )
{
data_swap( lhs, rhs );
}
template< typename T >
inline void data_swap( T& lhs, T& rhs )
{
T temp = lhs;
lhs = rhs;
rhs = temp;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
__MACRO_CPLUSPLUS_MINI_STL_END_NAMESPACE__
#endif
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -