Commit fe92e62e authored by Dmytro Stechenko's avatar Dmytro Stechenko Committed by Facebook GitHub Bot

Make Badge constructors noexcept

Summary:
Make `folly::badge` and `folly::any_badge` noexcept constructible.
Cannot make constructors explicitly defaulted due to classes becoming aggregate types.
Aggregate type construction takes precedence over value constructors so we can construct them anywhere:
```
class A{
    A() = default;
};

int main() {
    A a = {};
}
```
Cannot mark them `explicit` either, since we prefer to have conversions auto-magical where possible.

Reviewed By: yfeldblum

Differential Revision: D31983342

fbshipit-source-id: ddeffc30e6332882a490afea5bf023522f96c18e
parent 8318a862
......@@ -51,7 +51,7 @@ namespace folly {
template <typename Holder>
class badge {
friend Holder;
badge() {}
badge() noexcept {}
};
/**
......@@ -77,7 +77,7 @@ class any_badge {
template <
typename Holder,
std::enable_if_t<folly::IsOneOf<Holder, Holders...>::value, int> = 0>
/* implicit */ any_badge(badge<Holder>) {}
/* implicit */ any_badge(badge<Holder>) noexcept {}
};
} // namespace folly
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