-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[proxy](7/n) proxy array and algorithm headers
- Loading branch information
1 parent
ee52677
commit 9aa79fa
Showing
16 changed files
with
220 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
|
||
#include "snmalloc/ds_core/defines.h" | ||
|
||
#ifndef SNMALLOC_USE_SELF_VENDORED_STL | ||
# define SNMALLOC_USE_SELF_VENDORED_STL 0 | ||
#endif | ||
|
||
#if SNMALLOC_USE_SELF_VENDORED_STL | ||
# include "snmalloc/proxy/utility.h" | ||
# if !defined(__GNUC__) && !defined(__clang__) | ||
# error "cannot use vendored STL without GNU/Clang extensions" | ||
# endif | ||
|
||
namespace snmalloc | ||
{ | ||
namespace proxy | ||
{ | ||
template<typename T> | ||
constexpr SNMALLOC_FAST_PATH const T& max(const T& a, const T& b) | ||
{ | ||
return a < b ? b : a; | ||
} | ||
|
||
template<typename T> | ||
constexpr SNMALLOC_FAST_PATH const T& min(const T& a, const T& b) | ||
{ | ||
return a < b ? a : b; | ||
} | ||
|
||
template<typename A, typename B = A> | ||
constexpr SNMALLOC_FAST_PATH A exchange(A& obj, B&& new_value) | ||
{ | ||
A old_value = move(obj); | ||
obj = forward<B>(new_value); | ||
return old_value; | ||
} | ||
|
||
} // namespace proxy | ||
} // namespace snmalloc | ||
#else | ||
# include <algorithm> | ||
|
||
namespace snmalloc | ||
{ | ||
namespace proxy | ||
{ | ||
using std::exchange; | ||
using std::max; | ||
using std::min; | ||
} // namespace proxy | ||
} // namespace snmalloc | ||
#endif |
Oops, something went wrong.