Skip to content

Commit cc71350

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Fix deprecated behaviour in cachelib/common/PercentileStats.cpp
Summary: Future C++ standards and compiler upgrades will eliminate deprecated behaviour. `-Wdeprecated` identifies this behaviour and has found some in this code! Some examples. **Dynamic exceptions** ``` error: dynamic exception specifications are deprecated [-Werror,-Wdeprecated-dynamic-exception-spec] ``` `throw(...)` has been deprecated since C++11 and removed in C++17. In most cases we can just use `noexcept` in the rest, we can remove this. **Implicit copy constructors** ``` error: definition of implicit copy constructor for 'XXX' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated-copy-with-dtor] ``` If you define a destructor, you need to explicitly define a copy constructor. **Out-ofline constexpr static** ``` error: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated] ``` This can be simplified: ``` class MyClass { static constexpr my_const = 3; }; static constexpr MyClass::my_const; // <- No longer needed! ``` Reviewed By: meyering Differential Revision: D54158205 fbshipit-source-id: c6909e9542bdd36a096768013e791b4763975b6e
1 parent 826d589 commit cc71350

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cachelib/common/PercentileStats.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
namespace facebook {
2020
namespace cachelib {
2121
namespace util {
22-
const std::array<double, 14> PercentileStats::kQuantiles{
22+
constexpr std::array<double, 14> PercentileStats::kQuantiles{
2323
0, 0.05, 0.1, 0.25, 0.5, 0.75, 0.9,
2424
0.95, 0.99, 0.999, 0.9999, 0.99999, 0.999999, 1.0};
25-
constexpr int PercentileStats::kDefaultWindowSize;
2625

2726
PercentileStats::Estimates PercentileStats::estimate() {
2827
estimator_.flush();

0 commit comments

Comments
 (0)