Skip to content

Commit

Permalink
Merge pull request #12 from ydb-platform/Replace-TList-to-std_list
Browse files Browse the repository at this point in the history
Replaced TList with std::list
  • Loading branch information
tkorsi authored Jan 23, 2024
2 parents 23a61e0 + e6a656a commit 49486a8
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ util/all_thread.cpp
util/all_util.cpp
util/charset/all_charset.cpp

cmake-build-debug
2 changes: 1 addition & 1 deletion library/cpp/dbg_output/dumpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct TDumper<TDeque<T, A>>: public TSeqDumper {
};

template <class T, class A>
struct TDumper<TList<T, A>>: public TSeqDumper {
struct TDumper<std::list<T, A>>: public TSeqDumper {
};

//associatives
Expand Down
5 changes: 2 additions & 3 deletions library/cpp/getopt/small/last_getopt_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#include "last_getopt_opts.h"

#include <library/cpp/colorizer/fwd.h>

#include <list>
#include <util/generic/hash_set.h>
#include <util/generic/list.h>

namespace NLastGetopt {
/**
Expand Down Expand Up @@ -53,7 +52,7 @@ namespace NLastGetopt {
typedef THashSet<const TOpt*> TdOptSet;
TdOptSet OptsSeen_; //the set of options that have been met during parsing

TList<const TOpt*> OptsDefault_;
std::list<const TOpt*> OptsDefault_;

private:
void Init(const TOpts* options, int argc, const char* argv[]);
Expand Down
6 changes: 3 additions & 3 deletions library/cpp/monlib/counters/counters.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <list>
#include <util/datetime/base.h>
#include <util/generic/algorithm.h>
#include <util/generic/list.h>
#include <util/generic/map.h>
#include <util/generic/ptr.h>
#include <util/generic/singleton.h>
Expand Down Expand Up @@ -248,7 +248,7 @@ namespace NMonitoring {

private:
TCollection* Groups;
TList<TOldGroup> OldGroups;
std::list<TOldGroup> OldGroups;
TSpinLock AddMutex;

ui64 Timeout;
Expand Down Expand Up @@ -295,7 +295,7 @@ namespace NMonitoring {
Groups->Free();
delete Groups;
Groups = nullptr;
typename TList<TOldGroup>::iterator i;
typename std::list<TOldGroup>::iterator i;
for (i = OldGroups.begin(); i != OldGroups.end(); ++i) {
delete i->Collection;
i->Collection = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion library/cpp/testing/unittest/utmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ class TColoredProcessor: public ITestSuiteProcessor, public NColorizer::TColors
return f();
}

TList<TString> args(1, "--is-forked-internal");
std::list<TString> args(1, "--is-forked-internal");
args.push_back(Sprintf("+%s::%s", suite.data(), name));

// stdin is ignored - unittest should not need them...
Expand Down
14 changes: 0 additions & 14 deletions util/generic/list_ut.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion util/generic/queue_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) {
}

Y_UNIT_TEST(queue1) {
TQueue<int, TList<int>> q;
TQueue<int, std::list<int>> q;

q.push(42);
q.push(101);
Expand Down
1 change: 0 additions & 1 deletion util/generic/ut/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ SRCS(
generic/iterator_range_ut.cpp
generic/iterator_ut.cpp
generic/lazy_value_ut.cpp
generic/list_ut.cpp
generic/map_ut.cpp
generic/mapfindptr_ut.cpp
generic/maybe_ut.cpp
Expand Down
8 changes: 4 additions & 4 deletions util/system/shellcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class TShellCommand::TImpl
: public TAtomicRefCount<TShellCommand::TImpl> {
private:
TString Command;
TList<TString> Arguments;
std::list<TString> Arguments;
TShellCommandOptions Options_;
TString WorkDir;

Expand Down Expand Up @@ -263,7 +263,7 @@ class TShellCommand::TImpl
#endif

public:
inline TImpl(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, const TString& workdir)
inline TImpl(const TStringBuf cmd, const std::list<TString>& args, const TShellCommandOptions& options, const TString& workdir)
: Command(ToString(cmd))
, Arguments(args)
, Options_(options)
Expand Down Expand Up @@ -1087,14 +1087,14 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
TerminateIsRequired(pi);
}

TShellCommand::TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options,
TShellCommand::TShellCommand(const TStringBuf cmd, const std::list<TString>& args, const TShellCommandOptions& options,
const TString& workdir)
: Impl(new TImpl(cmd, args, options, workdir))
{
}

TShellCommand::TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options, const TString& workdir)
: Impl(new TImpl(cmd, TList<TString>(), options, workdir))
: Impl(new TImpl(cmd, std::list<TString>(), options, workdir))
{
}

Expand Down
5 changes: 2 additions & 3 deletions util/system/shellcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <util/generic/noncopyable.h>
#include <util/generic/string.h>
#include <util/generic/list.h>
#include <util/generic/hash.h>
#include <util/generic/strbuf.h>
#include <util/generic/maybe.h>
Expand All @@ -13,7 +12,7 @@
#include "thread.h"
#include "mutex.h"
#include <sys/types.h>

#include <list>
#include <atomic>

class TShellCommandOptions {
Expand Down Expand Up @@ -369,7 +368,7 @@ class TShellCommand: public TNonCopyable {
* @param options execution options
* @todo store entire options structure
*/
TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options = TShellCommandOptions(),
TShellCommand(const TStringBuf cmd, const std::list<TString>& args, const TShellCommandOptions& options = TShellCommandOptions(),
const TString& workdir = TString());
TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options = TShellCommandOptions(), const TString& workdir = TString());
~TShellCommand();
Expand Down
4 changes: 0 additions & 4 deletions util/ysaveload.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,6 @@ template <class T, class A>
class TSerializer<std::vector<T, A>>: public TVectorSerializer<std::vector<T, A>> {
};

template <class T, class A>
class TSerializer<TList<T, A>>: public TVectorSerializer<TList<T, A>> {
};

template <class T, class A>
class TSerializer<std::list<T, A>>: public TVectorSerializer<std::list<T, A>> {
};
Expand Down
3 changes: 1 addition & 2 deletions util/ysaveload_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <util/memory/pool.h>
#include <util/stream/buffer.h>
#include <util/memory/blob.h>
#include <util/generic/list.h>
#include <util/generic/map.h>
#include <util/generic/hash_multi_map.h>
#include <util/generic/deque.h>
Expand Down Expand Up @@ -391,7 +390,7 @@ class TSaveLoadTest: public TTestBase {
void TestList() {
TBufferStream s;

TList<int> list = {0, 1, 10};
std::list<int> list = {0, 1, 10};
Save(&s, list);

list.clear();
Expand Down

0 comments on commit 49486a8

Please sign in to comment.