Commit 102e3526 authored by Boxiang Sun's avatar Boxiang Sun

Use is_trivially_copy_constructible instead has_trivial_copy_constructor

When update to gcc 5.4, it complain there has no
has_trivial_copy_constructor, please see here: http://www.chpc-tech.com/EN/NewDevelopments/2015/15.04.23.gcc5.1.html
So use standard c++ 11 type traits.
parent b4701534
......@@ -323,7 +323,13 @@ private:
public:
template <typename Functor> SmallFunction(Functor&& f) noexcept {
static_assert(std::has_trivial_copy_constructor<typename std::remove_reference<Functor>::type>::value,
// workaround missing "is_trivially_copy_constructible" in g++ < 5.0
#if __GNUG__ && __GNUC__ < 5
#define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) std::has_trivial_copy_constructor<T>::value
#else
#define IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) std::is_trivially_copy_constructible<T>::value
#endif
static_assert(IS_TRIVIALLY_COPY_CONSTRUCTIBLE(typename std::remove_reference<Functor>::type),
"SmallFunction currently only works with simple types");
static_assert(std::is_trivially_destructible<typename std::remove_reference<Functor>::type>::value,
"SmallFunction currently only works with simple types");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment