diff options
| author | sankear <[email protected]> | 2022-02-10 16:50:10 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:10 +0300 | 
| commit | 7377d7b033ffbef85e9bb0bf35091a8e79ed422c (patch) | |
| tree | fca7665beced1b829e5ab628094d3721a66c1001 /library/cpp | |
| parent | f054f783b50cf93fa12c0cc6375769c21f3fd27e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
4 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/containers/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper.h index 2f282b5a9e1..670561b0af7 100644 --- a/library/cpp/containers/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper.h @@ -22,16 +22,16 @@ private:          template <class UT>          bool Insert(UT&& value) noexcept { -            if (Y_UNLIKELY(0 == HalfMaxSize)) { +            if (Y_UNLIKELY(0 == HalfMaxSize)) {                   return false;              } -            if (Internal.size() < HalfMaxSize) { +            if (Internal.size() < HalfMaxSize) {                   if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {                      MinElementIndex = Internal.size(); -                    Internal.push_back(std::forward<UT>(value)); -                    return true; -                } +                    Internal.push_back(std::forward<UT>(value));  +                    return true;  +                }               } else if (!Comparer(value, Internal[MinElementIndex])) {                  return false;              } @@ -69,11 +69,11 @@ private:          }          void Partition() { -            if (Y_UNLIKELY(HalfMaxSize == 0)) { -                return; -            } -            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) { -                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer); +            if (Y_UNLIKELY(HalfMaxSize == 0)) {  +                return;  +            }  +            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {  +                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);                   Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());                  //we should update MinElementIndex cause we just altered Internal @@ -96,7 +96,7 @@ private:          void SetMaxSize(size_t newHalfMaxSize) {              HalfMaxSize = newHalfMaxSize; -            Reserve(); +            Reserve();               Partition();          } @@ -142,14 +142,14 @@ private:      bool Finalized;  public: -    TTopKeeper() -        : MaxSize(0) -        , Comparer() -        , Internal(0, Comparer) -        , Finalized(false) -    { -    } - +    TTopKeeper()  +        : MaxSize(0)  +        , Comparer()  +        , Internal(0, Comparer)  +        , Finalized(false)  +    {  +    }  +       TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())          : MaxSize(maxSize)          , Comparer(comp) diff --git a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h index 2f282b5a9e1..670561b0af7 100644 --- a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h @@ -22,16 +22,16 @@ private:          template <class UT>          bool Insert(UT&& value) noexcept { -            if (Y_UNLIKELY(0 == HalfMaxSize)) { +            if (Y_UNLIKELY(0 == HalfMaxSize)) {                   return false;              } -            if (Internal.size() < HalfMaxSize) { +            if (Internal.size() < HalfMaxSize) {                   if (Internal.empty() || Comparer(Internal[MinElementIndex], value)) {                      MinElementIndex = Internal.size(); -                    Internal.push_back(std::forward<UT>(value)); -                    return true; -                } +                    Internal.push_back(std::forward<UT>(value));  +                    return true;  +                }               } else if (!Comparer(value, Internal[MinElementIndex])) {                  return false;              } @@ -69,11 +69,11 @@ private:          }          void Partition() { -            if (Y_UNLIKELY(HalfMaxSize == 0)) { -                return; -            } -            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) { -                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer); +            if (Y_UNLIKELY(HalfMaxSize == 0)) {  +                return;  +            }  +            if (Y_LIKELY(Internal.size() >= HalfMaxSize)) {  +                NthElement(Internal.begin(), Internal.begin() + HalfMaxSize - 1, Internal.end(), Comparer);                   Internal.erase(Internal.begin() + HalfMaxSize, Internal.end());                  //we should update MinElementIndex cause we just altered Internal @@ -96,7 +96,7 @@ private:          void SetMaxSize(size_t newHalfMaxSize) {              HalfMaxSize = newHalfMaxSize; -            Reserve(); +            Reserve();               Partition();          } @@ -142,14 +142,14 @@ private:      bool Finalized;  public: -    TTopKeeper() -        : MaxSize(0) -        , Comparer() -        , Internal(0, Comparer) -        , Finalized(false) -    { -    } - +    TTopKeeper()  +        : MaxSize(0)  +        , Comparer()  +        , Internal(0, Comparer)  +        , Finalized(false)  +    {  +    }  +       TTopKeeper(size_t maxSize, const TComparator& comp = TComparator())          : MaxSize(maxSize)          , Comparer(comp) diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp index b0e4511299b..7da3992e5ba 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.cpp +++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp @@ -14,7 +14,7 @@ TMappedFile::TMappedFile(TFileMap* map, const char* dbgName) {      Map_->Map(0, static_cast<size_t>(len));  } -TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) +TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* dbgName)       : Map_(nullptr)  {      init(file, om, dbgName); @@ -28,13 +28,13 @@ void TMappedFile::precharge(size_t off, size_t size) const {  }  void TMappedFile::init(const TString& name) { -    THolder<TFileMap> map(new TFileMap(name)); +    THolder<TFileMap> map(new TFileMap(name));       TMappedFile newFile(map.Get(), name.data());      Y_UNUSED(map.Release()); -    newFile.swap(*this); -    newFile.term(); -} - +    newFile.swap(*this);  +    newFile.term();  +}  +   void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode om) {      THolder<TFileMap> map(new TFileMap(name, length, om));      TMappedFile newFile(map.Get(), name.data()); @@ -43,7 +43,7 @@ void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode o      newFile.term();  } -void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) { +void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* dbgName) {       THolder<TFileMap> map(new TFileMap(file, om));      TMappedFile newFile(map.Get(), dbgName);      Y_UNUSED(map.Release()); diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h index 45859ed65a0..ec59737a174 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.h +++ b/library/cpp/deprecated/mapped_file/mapped_file.h @@ -32,10 +32,10 @@ public:      explicit TMappedFile(const TString& name) {          Map_ = nullptr; -        init(name, TFileMap::oRdOnly); +        init(name, TFileMap::oRdOnly);       } -    TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); +    TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown");       void init(const TString& name); @@ -43,8 +43,8 @@ public:      void init(const TString& name, size_t length, TFileMap::EOpenMode om); -    void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); - +    void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown");  +       void flush();      void term() {  | 
