Commit 43d56a22 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot 3

Retire BOOST_STATIC_ASSERT in favor of static_assert

Summary:
Retire `BOOST_STATIC_ASSERT` in favor of `static_assert`.

`static_assert` is part of C++ now, so we don't need workarounds like `BOOST_STATIC_ASSERT` anymore.

Partially automated:

    hg grep -lw BOOST_STATIC_ASSERT | xargs perl -pi -e 's~\bBOOST_STATIC_ASSERT\(([^;]*)\);~static_assert(\1, "");~g'
    hg grep -lw 'boost/static_assert.hpp' | xargs perl -pi -e 's,^#include <boost/static_assert\.hpp>\n,,gm'

Caught most instances. Formatting and remaining instances addressed manually.

Reviewed By: meyering

Differential Revision: D3215944

fb-gh-sync-id: f4552d5d9bfc416ce283923abe880437a4d0cba5
fbshipit-source-id: f4552d5d9bfc416ce283923abe880437a4d0cba5
parent 57e517a5
......@@ -23,7 +23,6 @@
#include <folly/Hash.h>
#include <boost/functional/hash.hpp>
#include <boost/static_assert.hpp>
#include <string.h>
#include <stdio.h>
#include <errno.h>
......
......@@ -202,7 +202,7 @@ after `Widget`'s definition and write this:
}
If you don't do this, `fbvector<Widget>` will fail to compile
with a `BOOST_STATIC_ASSERT`.
with a `static_assert`.
#### Additional Constraints
......@@ -215,9 +215,11 @@ already present in the C++ standard (well, currently in Boost).
To summarize, in order to work with `fbvector`, a type `Widget`
must pass:
BOOST_STATIC_ASSERT(
static_assert(
IsRelocatable<Widget>::value &&
(boost::has_trivial_assign<T>::value || boost::has_nothrow_constructor<T>::value));
(boost::has_trivial_assign<T>::value ||
boost::has_nothrow_constructor<T>::value),
"");
These traits go hand in hand; for example, it would be very
difficult to design a class that satisfies one branch of the
......
......@@ -127,9 +127,7 @@ explicitly, `fbvector<MySimpleType>` or `fbvector<MyParameterizedType>`
will fail to compile due to assertion below:
```Cpp
BOOST_STATIC_ASSERT(
IsRelocatable<My*Type>::value
);
static_assert(IsRelocatable<My*Type>::value, "");
```
FOLLY_ASSUME_FBVECTOR_COMPATIBLE*(type) macros can be used to state that type
......
......@@ -23,7 +23,6 @@
#include <folly/ThreadName.h>
#include <folly/io/async/NotificationQueue.h>
#include <boost/static_assert.hpp>
#include <condition_variable>
#include <fcntl.h>
#include <mutex>
......
......@@ -17,7 +17,6 @@
#pragma once
#include <string>
#include <boost/static_assert.hpp>
#include <folly/stats/Histogram.h>
#include <folly/stats/MultiLevelTimeSeries.h>
......@@ -53,7 +52,7 @@ template <class T, class TT=std::chrono::seconds,
class TimeseriesHistogram {
private:
// NOTE: T must be equivalent to _signed_ numeric type for our math.
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_signed);
static_assert(std::numeric_limits<T>::is_signed, "");
public:
// values to be inserted into container
......
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