Skip to content

Commit 6137b48

Browse files
committed
Problem: C++11 partially supported on gcc 4.8
Solution: Use intrinsic instead of std::is_trivially_copyable for gcc versions older than 5.
1 parent 81c2938 commit 6137b48

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Supported platforms
3636
- Additional platforms that are known to work:
3737
- We have no current reports on additional platforms that are known to work yet. Please add your platform here. If CI can be provided for them with a cloud-based CI service working with GitHub, you are invited to add CI, and make it possible to be included in the list above.
3838
- Additional platforms that probably work:
39-
- Any platform supported by libzmq that provides a sufficiently recent gcc (4.8.1 or newer) or clang (3.3 or newer)
39+
- Any platform supported by libzmq that provides a sufficiently recent gcc (4.8.1 or newer) or clang (3.4.1 or newer)
4040
- Visual Studio 2012+ x86/x64
4141

4242
Examples

zmq.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@
122122
#define ZMQ_DELETED_FUNCTION
123123
#endif
124124

125+
#ifdef ZMQ_CPP11
126+
#if defined(__GNUC__) && __GNUC__ < 5
127+
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
128+
#else
129+
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value
130+
#endif
131+
#endif
132+
125133
#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(3, 3, 0)
126134
#define ZMQ_NEW_MONITOR_EVENT_LAYOUT
127135
#endif
@@ -331,7 +339,7 @@ class message_t
331339
template<class Range,
332340
typename = typename std::enable_if<
333341
detail::is_range<Range>::value
334-
&& std::is_trivially_copyable<detail::range_value_t<Range>>::value
342+
&& ZMQ_IS_TRIVIALLY_COPYABLE(detail::range_value_t<Range>)
335343
&& !std::is_same<Range, message_t>::value>::type>
336344
explicit message_t(const Range &rng) :
337345
message_t(detail::ranges::begin(rng), detail::ranges::end(rng))
@@ -948,7 +956,7 @@ template<class T> struct is_pod_like
948956
// trivially copyable OR standard layout.
949957
// Here we decide to be conservative and require both.
950958
static constexpr bool value =
951-
std::is_trivially_copyable<T>::value && std::is_standard_layout<T>::value;
959+
ZMQ_IS_TRIVIALLY_COPYABLE(T) && std::is_standard_layout<T>::value;
952960
};
953961

954962
template<class C> constexpr auto seq_size(const C &c) noexcept -> decltype(c.size())

0 commit comments

Comments
 (0)