1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix make_tuple result-type

This commit is contained in:
bolero-MURAKAMI 2013-04-12 19:17:16 +09:00
parent a5b7eda260
commit 0437b24f12
2 changed files with 18 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#define SPROUT_FUNCTIONAL_REF_HPP #define SPROUT_FUNCTIONAL_REF_HPP
#include <type_traits> #include <type_traits>
#include <functional>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/type_traits/has_xxx.hpp> #include <sprout/type_traits/has_xxx.hpp>
@ -232,6 +233,11 @@ namespace sprout {
typedef T type; typedef T type;
}; };
template<typename T> template<typename T>
struct unwrap_reference<std::reference_wrapper<T> > {
public:
typedef T type;
};
template<typename T>
struct unwrap_reference<T const> struct unwrap_reference<T const>
: public sprout::unwrap_reference<T> : public sprout::unwrap_reference<T>
{}; {};
@ -258,6 +264,11 @@ namespace sprout {
typedef T& type; typedef T& type;
}; };
template<typename T> template<typename T>
struct strip_reference<std::reference_wrapper<T> > {
public:
typedef T& type;
};
template<typename T>
struct strip_reference<T const> struct strip_reference<T const>
: public sprout::strip_reference<T> : public sprout::strip_reference<T>
{}; {};
@ -292,6 +303,11 @@ namespace sprout {
get_pointer(sprout::reference_wrapper<T> const& r) { get_pointer(sprout::reference_wrapper<T> const& r) {
return r.get_pointer(); return r.get_pointer();
} }
template<typename T>
inline SPROUT_CONSTEXPR T*
get_pointer(std::reference_wrapper<T> const& r) {
return &r.get();
}
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_REF_HPP #endif // #ifndef SPROUT_FUNCTIONAL_REF_HPP

View file

@ -5,6 +5,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/metafunction.hpp> #include <sprout/index_tuple/metafunction.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/functional/ref.hpp>
#include <sprout/tuple/tuple/tuple.hpp> #include <sprout/tuple/tuple/tuple.hpp>
#include <sprout/tuple/tuple/get.hpp> #include <sprout/tuple/tuple/get.hpp>
#include <sprout/tuple/indexes.hpp> #include <sprout/tuple/indexes.hpp>
@ -15,7 +16,7 @@ namespace sprout {
// make_tuple // make_tuple
// //
template<typename... Types> template<typename... Types>
inline SPROUT_CONSTEXPR sprout::tuples::tuple<typename std::decay<Types>::type...> inline SPROUT_CONSTEXPR sprout::tuples::tuple<typename sprout::strip_reference<typename std::decay<Types>::type>::type...>
make_tuple(Types&&... args) { make_tuple(Types&&... args) {
return sprout::tuples::tuple<typename std::decay<Types>::type...>(sprout::forward<Types>(args)...); return sprout::tuples::tuple<typename std::decay<Types>::type...>(sprout::forward<Types>(args)...);
} }