3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 06:14:14 +01:00

add c14 less, greater

This commit is contained in:
Olivier Parcollet 2014-03-16 00:10:18 +01:00
parent 5805c7c3aa
commit 377a0026ad

View File

@ -39,12 +39,24 @@ namespace std {
// use simply std::c14::plus<>() ... // use simply std::c14::plus<>() ...
template<typename T = void> struct plus: std::plus<T>{}; template<typename T = void> struct plus: std::plus<T>{};
template<> struct plus<void> { template<> struct plus<void> {
template<typename T, typename U> template<typename T, typename U>
auto operator()( T&& t, U&& u) const DECL_AND_RETURN(std::forward<T>(t) + std::forward<U>(u)); auto operator()( T&& t, U&& u) const DECL_AND_RETURN(std::forward<T>(t) + std::forward<U>(u));
}; };
// use simply std::c14::plus<>() ...
template<typename T = void> struct greater: std::greater<T>{};
template<> struct greater<void> {
template<typename T, typename U>
auto operator()( T&& t, U&& u) const DECL_AND_RETURN(std::forward<T>(t) > std::forward<U>(u));
};
template<typename T = void> struct less: std::less<T>{};
template<> struct less<void> {
template<typename T, typename U>
auto operator()( T&& t, U&& u) const DECL_AND_RETURN(std::forward<T>(t) < std::forward<U>(u));
};
template<typename T, typename... Args> template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } std::unique_ptr<T> make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); }