Commit 40df9484 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Support C++11 in folly/IPAddress.h w.r.t. aligned_union

Summary: [Folly] Support C++11 in `folly/IPAddress.h` w.r.t. `aligned_union` by avoiding `aligned_union_t`, which is C++14.

Reviewed By: spalamarchuk, mengz0

Differential Revision: D14278604

fbshipit-source-id: 474ac0aa0110f4939d1042d334b69feb6b2644cb
parent a99a9d37
......@@ -20,8 +20,10 @@
#include <iosfwd>
#include <memory>
#include <string>
#include <type_traits>
#include <utility> // std::pair
#include <folly/ConstexprMath.h>
#include <folly/IPAddressException.h>
#include <folly/IPAddressV4.h>
#include <folly/IPAddressV6.h>
......@@ -442,7 +444,10 @@ class IPAddress {
[[noreturn]] void asV6Throw() const;
typedef union IPAddressV46 {
std::aligned_union_t<0, IPAddressV4, IPAddressV6> storage;
std::aligned_storage<
constexpr_max(sizeof(IPAddressV4), sizeof(IPAddressV6)),
constexpr_max(alignof(IPAddressV4), alignof(IPAddressV6))>::type
storage;
IPAddressV4 ipV4Addr;
IPAddressV6 ipV6Addr;
// default constructor
......
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