-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*============================================================================= | ||
Copyright (c) 2015 Paul Fultz II | ||
decay.h | ||
Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
==============================================================================*/ | ||
|
||
#ifndef FIT_GUARD_DECAY_H | ||
#define FIT_GUARD_DECAY_H | ||
|
||
/// decay | ||
/// ===== | ||
/// | ||
/// Description | ||
/// ----------- | ||
/// | ||
/// The `decay` function is a unary function object that returns whats given to it after decaying its type. | ||
/// | ||
/// Synopsis | ||
/// -------- | ||
/// | ||
/// struct | ||
/// { | ||
/// template<class T> | ||
/// constexpr typename decay<T>::type operator()(T&& x) const | ||
/// { | ||
/// return fit::forward<T>(x); | ||
/// } | ||
/// } decay; | ||
/// | ||
|
||
#include <fit/detail/unwrap.h> | ||
#include <fit/detail/static_const_var.h> | ||
#include <fit/detail/forward.h> | ||
|
||
namespace fit { namespace detail { | ||
|
||
struct decay_f | ||
{ | ||
template<class T> | ||
constexpr typename unwrap_reference<typename std::decay<T>::type>::type | ||
operator()(T&& x) const | ||
{ | ||
return fit::forward<T>(x); | ||
} | ||
}; | ||
|
||
} | ||
|
||
FIT_DECLARE_STATIC_VAR(decay, detail::decay_f); | ||
|
||
} | ||
|
||
#endif |
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