From 888dc9a7e868a3884f5cf88234acf4d4f382a3e0 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sat, 23 Nov 2024 15:45:18 -0800 Subject: [PATCH] Clang-tidy and include fix on libime/core --- src/libime/core/datrie.cpp | 3 +++ src/libime/core/datrie.h | 5 ++++ src/libime/core/decoder.cpp | 3 ++- src/libime/core/decoder.h | 9 +++++-- src/libime/core/dictionary.cpp | 9 +++++++ src/libime/core/dictionary.h | 13 +++++---- src/libime/core/historybigram.cpp | 39 ++++++++++++++++++--------- src/libime/core/historybigram.h | 4 +++ src/libime/core/inputbuffer.cpp | 8 +++--- src/libime/core/inputbuffer.h | 8 +++--- src/libime/core/languagemodel.cpp | 26 +++++++++++++++--- src/libime/core/languagemodel.h | 9 ++++--- src/libime/core/lattice.cpp | 7 +++++ src/libime/core/lattice.h | 9 +++++++ src/libime/core/lattice_p.h | 7 +++-- src/libime/core/lrucache.h | 14 +++++----- src/libime/core/naivevector.h | 24 +++++++++-------- src/libime/core/prediction.cpp | 17 +++++++----- src/libime/core/prediction.h | 4 +++ src/libime/core/segmentgraph.cpp | 15 ++++++++--- src/libime/core/segmentgraph.h | 29 ++++++++++++-------- src/libime/core/triedictionary.cpp | 7 +++-- src/libime/core/triedictionary.h | 4 ++- src/libime/core/userlanguagemodel.cpp | 11 +++++++- src/libime/core/userlanguagemodel.h | 5 ++++ src/libime/core/utils.cpp | 1 + src/libime/core/utils.h | 3 +++ src/libime/core/utils_p.h | 1 - src/libime/core/zstdfilter.h | 4 +-- 29 files changed, 212 insertions(+), 86 deletions(-) diff --git a/src/libime/core/datrie.cpp b/src/libime/core/datrie.cpp index c67212f..a91852b 100644 --- a/src/libime/core/datrie.cpp +++ b/src/libime/core/datrie.cpp @@ -20,14 +20,17 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include #include +#include #include #include diff --git a/src/libime/core/datrie.h b/src/libime/core/datrie.h index 5c29205..d47a76e 100644 --- a/src/libime/core/datrie.h +++ b/src/libime/core/datrie.h @@ -12,11 +12,16 @@ #include "libimecore_export.h" +#include #include #include #include +#include #include +#include +#include #include +#include #include namespace libime { diff --git a/src/libime/core/decoder.cpp b/src/libime/core/decoder.cpp index 516828c..ab4ba2a 100644 --- a/src/libime/core/decoder.cpp +++ b/src/libime/core/decoder.cpp @@ -270,7 +270,8 @@ void DecoderPrivate::backwardSearch(const SegmentGraph &graph, Lattice &l, std::priority_queue, std::vector>, NBestNodeLess>>; - PriorityQueueType q, result; + PriorityQueueType q; + PriorityQueueType result; auto *eos = &lattice[nullptr][0]; auto newNBestNode = [](const LatticeNode *node) { diff --git a/src/libime/core/decoder.h b/src/libime/core/decoder.h index 1cfd8f5..1ff32fb 100644 --- a/src/libime/core/decoder.h +++ b/src/libime/core/decoder.h @@ -7,11 +7,16 @@ #define _FCITX_LIBIME_CORE_DECODER_H_ #include "libimecore_export.h" +#include #include #include +#include #include #include +#include #include +#include +#include namespace libime { @@ -55,8 +60,8 @@ class LIBIMECORE_EXPORT Decoder { const State &state, float cost, std::unique_ptr data, bool onlyPath) const; - virtual bool needSort(const SegmentGraph &, - const SegmentGraphNode *) const { + virtual bool needSort(const SegmentGraph & /*graph*/, + const SegmentGraphNode * /*node*/) const { return true; } diff --git a/src/libime/core/dictionary.cpp b/src/libime/core/dictionary.cpp index 3c444c6..c991eaf 100644 --- a/src/libime/core/dictionary.cpp +++ b/src/libime/core/dictionary.cpp @@ -5,3 +5,12 @@ */ #include "dictionary.h" +#include "segmentgraph.h" +#include + +void libime::Dictionary::matchPrefix( + const SegmentGraph &graph, const GraphMatchCallback &callback, + const std::unordered_set &ignore, + void *helper) const { + matchPrefixImpl(graph, callback, ignore, helper); +} diff --git a/src/libime/core/dictionary.h b/src/libime/core/dictionary.h index 76f3d49..a72cffe 100644 --- a/src/libime/core/dictionary.h +++ b/src/libime/core/dictionary.h @@ -10,25 +10,24 @@ #include #include #include -#include +#include +#include namespace libime { class WordNode; // The callback accepts the passed path that matches the word. -typedef std::function)> - GraphMatchCallback; +using GraphMatchCallback = + std::function)>; class LIBIMECORE_EXPORT Dictionary { public: void matchPrefix(const SegmentGraph &graph, const GraphMatchCallback &callback, const std::unordered_set &ignore = {}, - void *helper = nullptr) const { - matchPrefixImpl(graph, callback, ignore, helper); - } + void *helper = nullptr) const; protected: virtual void diff --git a/src/libime/core/historybigram.cpp b/src/libime/core/historybigram.cpp index 97dba26..5e77c36 100644 --- a/src/libime/core/historybigram.cpp +++ b/src/libime/core/historybigram.cpp @@ -6,19 +6,36 @@ #include "historybigram.h" #include "constants.h" #include "datrie.h" +#include "lattice.h" #include "utils.h" #include "zstdfilter.h" +#include +#include #include #include +#include #include #include #include +#include +#include #include +#include +#include +#include #include +#include +#include #include +#include +#include #include #include #include +#include +#include +#include +#include namespace libime { @@ -53,7 +70,7 @@ struct WeightedTrie { void decFreq(std::string_view s, int32_t delta) { auto v = trie_.exactMatchSearch(s.data(), s.size()); - if (trie_.isNoValue(v)) { + if (TrieType::isNoValue(v)) { return; } if (v <= delta) { @@ -68,7 +85,7 @@ struct WeightedTrie { void eraseByKey(std::string_view s) { auto v = trie_.exactMatchSearch(s.data(), s.size()); - if (trie_.isNoValue(v)) { + if (TrieType::isNoValue(v)) { return; } trie_.erase(s); @@ -121,10 +138,7 @@ struct WeightedTrie { } words.emplace(std::move(buf)); - if (maxSize > 0 && words.size() >= maxSize) { - return false; - } - return true; + return maxSize <= 0 || words.size() < maxSize; }); } @@ -168,8 +182,9 @@ class HistoryBigramPool { std::vector lines; while (std::getline(in, buf)) { lines.emplace_back(buf); - if (lines.size() >= maxSize_) + if (lines.size() >= maxSize_) { break; + } } for (auto &line : lines | boost::adaptors::reversed) { std::vector sentence = @@ -348,8 +363,6 @@ class HistoryBigramPool { // And then we define alpha as p = 1 / (1 + alpha). class HistoryBigramPrivate { public: - HistoryBigramPrivate() {} - void populateSentence(std::list> popedSentence) { for (size_t i = 1; !popedSentence.empty() && i < pools_.size(); i++) { std::list> nextSentences; @@ -405,7 +418,7 @@ HistoryBigram::HistoryBigram() d->poolWeight_.reserve(poolSize.size()); for (auto size : poolSize) { d->pools_.emplace_back(size); - float portion = 1.0f; + float portion = 1.0F; if (d->pools_.size() != poolSize.size()) { portion *= 1 - p; } @@ -472,11 +485,11 @@ float HistoryBigram::score(std::string_view prev, std::string_view cur) const { auto bf = d->bigramFreq(prev, cur); auto uf1 = d->unigramFreq(cur); - float bigramWeight = d->useOnlyUnigram_ ? 0.0f : 0.8f; + float bigramWeight = d->useOnlyUnigram_ ? 0.0F : 0.8F; // add 0.5 to avoid div 0 - float pr = 0.0f; + float pr = 0.0F; pr += bigramWeight * float(bf) / float(uf0 + d->poolWeight_[0] / 2); - pr += (1.0f - bigramWeight) * float(uf1) / + pr += (1.0F - bigramWeight) * float(uf1) / float(d->unigramSize() + d->poolWeight_[0] / 2); if (pr >= 1.0) { diff --git a/src/libime/core/historybigram.h b/src/libime/core/historybigram.h index f2abab4..14968df 100644 --- a/src/libime/core/historybigram.h +++ b/src/libime/core/historybigram.h @@ -7,11 +7,15 @@ #define _FCITX_LIBIME_CORE_HISTORYBIGRAM_H_ #include "libimecore_export.h" +#include #include +#include #include #include +#include #include #include +#include #include namespace libime { diff --git a/src/libime/core/inputbuffer.cpp b/src/libime/core/inputbuffer.cpp index 5abb0c9..95c9214 100644 --- a/src/libime/core/inputbuffer.cpp +++ b/src/libime/core/inputbuffer.cpp @@ -4,13 +4,11 @@ * SPDX-License-Identifier: LGPL-2.1-or-later */ #include "inputbuffer.h" +#include #include +#include namespace libime { -std::string_view InputBuffer::at(size_t i) const { - size_t start, end; - std::tie(start, end) = rangeAt(i); - return std::string_view(userInput()).substr(start, end - start); -} +std::string_view InputBuffer::at(size_t i) const { return viewAt(i); } } // namespace libime diff --git a/src/libime/core/inputbuffer.h b/src/libime/core/inputbuffer.h index 57516f3..1bb655b 100644 --- a/src/libime/core/inputbuffer.h +++ b/src/libime/core/inputbuffer.h @@ -7,7 +7,9 @@ #define _FCITX_LIBIME_CORE_INPUTBUFFER_H_ #include "libimecore_export.h" +#include #include +#include #include #include @@ -21,7 +23,7 @@ class LIBIMECORE_EXPORT InputBuffer : public fcitx::InputBuffer { boost::bidirectional_traversal_tag, std::string_view> { public: - iterator() {} + iterator() = default; iterator(const InputBuffer *buffer, size_t idx) : buffer_(buffer), idx_(idx) {} @@ -49,9 +51,9 @@ class LIBIMECORE_EXPORT InputBuffer : public fcitx::InputBuffer { std::string_view operator[](size_t i) const { return at(i); } - iterator begin() { return iterator(this, 0); } + iterator begin() { return {this, 0}; } - iterator end() { return iterator(this, size()); } + iterator end() { return {this, size()}; } }; } // namespace libime diff --git a/src/libime/core/languagemodel.cpp b/src/libime/core/languagemodel.cpp index 71b9a5c..3c443e9 100644 --- a/src/libime/core/languagemodel.cpp +++ b/src/libime/core/languagemodel.cpp @@ -7,12 +7,29 @@ #include "languagemodel.h" #include "config.h" #include "constants.h" +#include "datrie.h" #include "lattice.h" +#include "lm/config.hh" +#include "lm/lm_exception.hh" #include "lm/model.hh" +#include "lm/state.hh" +#include "lm/word_index.hh" +#include "util/string_piece.hh" +#include #include +#include #include +#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include namespace libime { @@ -74,13 +91,14 @@ float LanguageModelBase::singleWordScore(const State &state, float LanguageModelBase::wordsScore( const State &_state, const std::vector &words) const { float s = 0; - State state = _state, outState; + State state = _state; + State outState; std::vector nodes; for (auto word : words) { auto idx = index(word); nodes.emplace_back(word, idx); s += score(state, nodes.back(), outState); - state = std::move(outState); + state = outState; } return s; } @@ -188,10 +206,10 @@ float LanguageModel::score(const State &state, const WordNode &node, return d->unknown_; } return d->model()->Score(lmState(state), node.idx(), lmState(out)) + - (node.idx() == unknown() ? d->unknown_ : 0.0f); + (node.idx() == unknown() ? d->unknown_ : 0.0F); } -bool LanguageModel::isUnknown(WordIndex idx, std::string_view) const { +bool LanguageModel::isUnknown(WordIndex idx, std::string_view /*word*/) const { return idx == unknown(); } diff --git a/src/libime/core/languagemodel.h b/src/libime/core/languagemodel.h index 455fabe..5d801dd 100644 --- a/src/libime/core/languagemodel.h +++ b/src/libime/core/languagemodel.h @@ -7,10 +7,13 @@ #define _FCITX_LIBIME_CORE_LANGUAGEMODEL_H_ #include "libimecore_export.h" +#include +#include #include #include #include #include +#include #include #include @@ -77,10 +80,10 @@ class LIBIMECORE_EXPORT LanguageModel : public LanguageModelBase { WordIndex unknown() const override; const State &beginState() const override; const State &nullState() const override; - WordIndex index(std::string_view view) const override; - float score(const State &state, const WordNode &word, + WordIndex index(std::string_view word) const override; + float score(const State &state, const WordNode &node, State &out) const override; - bool isUnknown(WordIndex idx, std::string_view view) const override; + bool isUnknown(WordIndex idx, std::string_view word) const override; void setUnknownPenalty(float unknown); float unknownPenalty() const; diff --git a/src/libime/core/lattice.cpp b/src/libime/core/lattice.cpp index a8d015e..1463172 100644 --- a/src/libime/core/lattice.cpp +++ b/src/libime/core/lattice.cpp @@ -6,6 +6,13 @@ #include "lattice.h" #include "lattice_p.h" +#include "segmentgraph.h" +#include +#include +#include +#include +#include +#include namespace libime { diff --git a/src/libime/core/lattice.h b/src/libime/core/lattice.h index a2fba04..70165e5 100644 --- a/src/libime/core/lattice.h +++ b/src/libime/core/lattice.h @@ -8,13 +8,22 @@ #include "libimecore_export.h" #include +#include #include +#include +#include +#include #include #include #include #include #include +#include +#include #include +#include +#include +#include namespace libime { diff --git a/src/libime/core/lattice_p.h b/src/libime/core/lattice_p.h index 554331a..72993eb 100644 --- a/src/libime/core/lattice_p.h +++ b/src/libime/core/lattice_p.h @@ -9,14 +9,13 @@ #include #include #include -#include #include +#include namespace libime { -typedef std::unordered_map> - LatticeMap; +using LatticeMap = std::unordered_map>; class LatticePrivate { public: diff --git a/src/libime/core/lrucache.h b/src/libime/core/lrucache.h index d057f77..51f750c 100644 --- a/src/libime/core/lrucache.h +++ b/src/libime/core/lrucache.h @@ -6,8 +6,11 @@ #ifndef _FCITX_LIBIME_CORE_LRU_H_ #define _FCITX_LIBIME_CORE_LRU_H_ +#include #include +#include #include +#include namespace libime { @@ -15,13 +18,13 @@ namespace libime { template > class LRUCache { public: - typedef K key_type; - typedef V value_type; + using key_type = K; + using value_type = V; // we use boost's unordered_map is for the heterogeneous lookup // functionality. - typedef boost::unordered_map< - K, std::pair::iterator>, H> - dict_type; + using dict_type = + boost::unordered_map::iterator>, + H>; LRUCache(size_t sz = 80) : sz_(sz) {} @@ -105,7 +108,6 @@ class LRUCache { return &i->second.first; } -private: dict_type dict_; std::list order_; // Maximum size of the cache. diff --git a/src/libime/core/naivevector.h b/src/libime/core/naivevector.h index 1aca634..998c2e5 100644 --- a/src/libime/core/naivevector.h +++ b/src/libime/core/naivevector.h @@ -7,9 +7,11 @@ #ifndef NAIVEVECTOR_H #define NAIVEVECTOR_H +#include #include #include #include +#include #include #include @@ -23,17 +25,17 @@ struct naivevector { "but well, we only " "care about fundamental type"); - typedef T value_type; - typedef value_type *pointer; - typedef const value_type *const_pointer; - typedef value_type &reference; - typedef const value_type &const_reference; - typedef value_type *iterator; - typedef const value_type *const_iterator; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; + using value_type = T; + using pointer = value_type *; + using const_pointer = const value_type *; + using reference = value_type &; + using const_reference = const value_type &; + using iterator = value_type *; + using const_iterator = const value_type *; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; naivevector() noexcept : m_start(nullptr), m_end(nullptr), m_cap(nullptr) {} diff --git a/src/libime/core/prediction.cpp b/src/libime/core/prediction.cpp index 1b89896..d133ed2 100644 --- a/src/libime/core/prediction.cpp +++ b/src/libime/core/prediction.cpp @@ -8,7 +8,13 @@ #include "datrie.h" #include "historybigram.h" #include "languagemodel.h" +#include +#include +#include +#include +#include #include +#include #include namespace libime { @@ -51,14 +57,15 @@ Prediction::predict(const std::vector &sentence, return {}; } - State state = d->model_->nullState(), outState; + State state = d->model_->nullState(); + State outState; std::vector nodes; nodes.reserve(sentence.size()); for (const auto &word : sentence) { auto idx = d->model_->index(word); nodes.emplace_back(word, idx); d->model_->score(state, nodes.back(), outState); - state = std::move(outState); + state = outState; } return predict(state, sentence, realMaxSize); } @@ -89,10 +96,7 @@ Prediction::predictWithScore(const State &state, trie.suffix(buf, len, pos); words.emplace(std::move(buf)); - if (maxSize > 0 && words.size() >= maxSize) { - return false; - } - return true; + return maxSize <= 0 || words.size() < maxSize; }); } @@ -125,6 +129,7 @@ Prediction::predict(const State &state, auto temps = predictWithScore(state, sentence, realMaxSize); std::vector result; + result.reserve(temps.size()); for (auto &temp : temps) { result.emplace_back(std::move(temp.first)); } diff --git a/src/libime/core/prediction.h b/src/libime/core/prediction.h index 71c80c3..9e90a4a 100644 --- a/src/libime/core/prediction.h +++ b/src/libime/core/prediction.h @@ -7,10 +7,14 @@ #define _FCITX_LIBIME_CORE_PREDICTION_H_ #include "libimecore_export.h" +#include #include #include #include #include +#include +#include +#include namespace libime { diff --git a/src/libime/core/segmentgraph.cpp b/src/libime/core/segmentgraph.cpp index 41cd490..a472627 100644 --- a/src/libime/core/segmentgraph.cpp +++ b/src/libime/core/segmentgraph.cpp @@ -5,9 +5,16 @@ */ #include "segmentgraph.h" -#include "lattice_p.h" #include +#include +#include +#include +#include #include +#include +#include +#include +#include namespace libime { @@ -63,7 +70,8 @@ size_t SegmentGraph::check(const SegmentGraph &graph) const { q.emplace(&start(), &graph.start()); while (!q.empty()) { - const SegmentGraphNode *old, *now; + const SegmentGraphNode *old; + const SegmentGraphNode *now; std::tie(old, now) = q.top(); q.pop(); do { @@ -72,7 +80,8 @@ size_t SegmentGraph::check(const SegmentGraph &graph) const { return old->index(); } - const SegmentGraphNode *nold, *nnow; + const SegmentGraphNode *nold; + const SegmentGraphNode *nnow; for (auto t : boost::combine(old->nexts(), now->nexts())) { nold = &boost::get<0>(t); nnow = &boost::get<1>(t); diff --git a/src/libime/core/segmentgraph.h b/src/libime/core/segmentgraph.h index 23c9a51..13efe00 100644 --- a/src/libime/core/segmentgraph.h +++ b/src/libime/core/segmentgraph.h @@ -7,24 +7,32 @@ #define _FCITX_LIBIME_CORE_SEGMENTGRAPH_H_ #include "libimecore_export.h" +#include #include #include +#include +#include +#include +#include #include +#include #include #include +#include +#include #include #include +#include +#include namespace libime { class SegmentGraphBase; class SegmentGraphNode; -typedef std::function &)> - SegmentGraphDFSCallback; -typedef std::function - SegmentGraphBFSCallback; +using SegmentGraphDFSCallback = + std::function &)>; +using SegmentGraphBFSCallback = + std::function; using SegmentGraphNodeRange = boost::any_range; @@ -106,10 +114,9 @@ class LIBIMECORE_EXPORT SegmentGraphNode : public fcitx::Element { size_t start_; }; -typedef std::vector SegmentGraphPath; -typedef std::function &node)> - DiscardCallback; +using SegmentGraphPath = std::vector; +using DiscardCallback = + std::function &)>; class LIBIMECORE_EXPORT SegmentGraphBase { public: @@ -131,7 +138,7 @@ class LIBIMECORE_EXPORT SegmentGraphBase { size_t size() const { return data().size(); } inline std::string_view segment(size_t start, size_t end) const { - return std::string_view(data().data() + start, end - start); + return {data().data() + start, end - start}; } inline std::string_view segment(const SegmentGraphNode &start, diff --git a/src/libime/core/triedictionary.cpp b/src/libime/core/triedictionary.cpp index d235abf..68bb44c 100644 --- a/src/libime/core/triedictionary.cpp +++ b/src/libime/core/triedictionary.cpp @@ -5,10 +5,13 @@ * */ #include "triedictionary.h" - -#include "libime/core/datrie.h" #include +#include +#include +#include +#include #include +#include namespace libime { diff --git a/src/libime/core/triedictionary.h b/src/libime/core/triedictionary.h index a8f359c..53b6903 100644 --- a/src/libime/core/triedictionary.h +++ b/src/libime/core/triedictionary.h @@ -8,11 +8,13 @@ #define _LIBIME_LIBIME_CORE_TRIEDICTIONARY_H_ #include "libimecore_export.h" +#include #include #include #include #include #include +#include namespace libime { @@ -67,7 +69,7 @@ class LIBIMECORE_EXPORT TrieDictionary : public Dictionary, protected: TrieType *mutableTrie(size_t idx); - void addWord(size_t idx, std::string_view key, float cost = 0.0f); + void addWord(size_t idx, std::string_view key, float cost = 0.0F); bool removeWord(size_t idx, std::string_view key); std::unique_ptr d_ptr; diff --git a/src/libime/core/userlanguagemodel.cpp b/src/libime/core/userlanguagemodel.cpp index c60a18f..8e32017 100644 --- a/src/libime/core/userlanguagemodel.cpp +++ b/src/libime/core/userlanguagemodel.cpp @@ -7,9 +7,18 @@ #include "userlanguagemodel.h" #include "constants.h" #include "historybigram.h" -#include "lm/model.hh" +#include "languagemodel.h" +#include "lm/state.hh" #include "utils_p.h" +#include +#include #include +#include +#include +#include +#include +#include +#include namespace libime { diff --git a/src/libime/core/userlanguagemodel.h b/src/libime/core/userlanguagemodel.h index b9592a7..90a0ce5 100644 --- a/src/libime/core/userlanguagemodel.h +++ b/src/libime/core/userlanguagemodel.h @@ -7,7 +7,12 @@ #define _FCITX_LIBIME_CORE_USERLANGUAGEMODEL_H_ #include "libimecore_export.h" +#include +#include #include +#include +#include +#include namespace libime { diff --git a/src/libime/core/utils.cpp b/src/libime/core/utils.cpp index 30d89ad..996355c 100644 --- a/src/libime/core/utils.cpp +++ b/src/libime/core/utils.cpp @@ -5,6 +5,7 @@ */ #include "utils.h" +#include namespace libime { diff --git a/src/libime/core/utils.h b/src/libime/core/utils.h index e98d160..93760aa 100644 --- a/src/libime/core/utils.h +++ b/src/libime/core/utils.h @@ -10,10 +10,13 @@ #include "libimecore_export.h" #include #include +#include #include #include #include +#include #include +#include #include namespace libime { diff --git a/src/libime/core/utils_p.h b/src/libime/core/utils_p.h index d9ad2d8..cd15bb3 100644 --- a/src/libime/core/utils_p.h +++ b/src/libime/core/utils_p.h @@ -9,7 +9,6 @@ #include #include -#include #include #if defined(__linux__) || defined(__GLIBC__) || defined(__EMSCRIPTEN__) diff --git a/src/libime/core/zstdfilter.h b/src/libime/core/zstdfilter.h index 982c602..31aec44 100644 --- a/src/libime/core/zstdfilter.h +++ b/src/libime/core/zstdfilter.h @@ -25,10 +25,10 @@ namespace libime { -class ZSTDError : public BOOST_IOSTREAMS_FAILURE { +class ZSTDError : public std::ios::failure { public: explicit ZSTDError(size_t error) - : BOOST_IOSTREAMS_FAILURE(ZSTD_getErrorName(error)), error_(error) {} + : std::ios::failure(ZSTD_getErrorName(error)), error_(error) {} size_t error() const { return error_; } static void check(size_t error) {