blob: c147ba504141c957b23a505bbca6c31fc0ea9abb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#include "shared_range.h"
#include "new.h"
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
TSharedRangeHolderPtr TSharedRangeHolder::Clone(const TSharedRangeHolderCloneOptions& /*options*/)
{
return this;
}
////////////////////////////////////////////////////////////////////////////////
TSharedRangeHolderPtr MakeCompositeSharedRangeHolder(std::vector<TSharedRangeHolderPtr> holders)
{
struct THolder
: public TSharedRangeHolder
{
std::vector<TSharedRangeHolderPtr> Holders;
TSharedRangeHolderPtr Clone(const TSharedRangeHolderCloneOptions& options) override
{
auto newHolder = New<THolder>();
newHolder->Holders.reserve(Holders.size());
for (const auto& holder : Holders) {
if (!holder) {
continue;
}
if (auto cloned = holder->Clone(options)) {
newHolder->Holders.push_back(cloned);
}
}
return newHolder;
}
};
auto holder = New<THolder>();
holder->Holders = std::move(holders);
return holder;
}
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|