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
#include <folly/Hash.h>
#include <boost/functional/hash.hpp>
-#include <boost/static_assert.hpp>
#include <string.h>
#include <stdio.h>
#include <errno.h>
}
If you don't do this, `fbvector<Widget>` will fail to compile
-with a `BOOST_STATIC_ASSERT`.
+with a `static_assert`.
#### Additional Constraints
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
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
#include <folly/ThreadName.h>
#include <folly/io/async/NotificationQueue.h>
-#include <boost/static_assert.hpp>
#include <condition_variable>
#include <fcntl.h>
#include <mutex>
#pragma once
#include <string>
-#include <boost/static_assert.hpp>
#include <folly/stats/Histogram.h>
#include <folly/stats/MultiLevelTimeSeries.h>
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