aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/holder.h
diff options
context:
space:
mode:
authorAlexander Fokin <apfokin@gmail.com>2022-02-10 16:45:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:38 +0300
commit863a59a65247c24db7cb06789bc5cf79d04da32f (patch)
tree139dc000c8cd4a40f5659e421b7c75135d080307 /util/stream/holder.h
parentf64e95a9eb9ab03240599eb9581c5a9102426a96 (diff)
downloadydb-863a59a65247c24db7cb06789bc5cf79d04da32f.tar.gz
Restoring authorship annotation for Alexander Fokin <apfokin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/stream/holder.h')
-rw-r--r--util/stream/holder.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/util/stream/holder.h b/util/stream/holder.h
index c60a4e510c..edd4e98ea6 100644
--- a/util/stream/holder.h
+++ b/util/stream/holder.h
@@ -1,44 +1,44 @@
#pragma once
#include <util/generic/ptr.h>
-
+
#include <utility>
-#include <type_traits>
+#include <type_traits>
class IInputStream;
class IOutputStream;
-namespace NPrivate {
+namespace NPrivate {
template <class Stream, bool isInput = std::is_base_of<IInputStream, Stream>::value>
struct TStreamBase {
using TType = IInputStream;
};
-
+
template <class Stream>
struct TStreamBase<Stream, false> {
using TType = IOutputStream;
};
-
+
}
-
-/**
- * An ownership-gaining wrapper for proxy streams.
- *
- * Example usage:
- * \code
- * TCountingInput* input = new THoldingStream<TCountingInput>(new TStringInput(s));
- * \encode
- *
- * In this example, resulting counting input also owns a string input that it
- * was constructed on top of.
- */
-template <class Base, class StreamBase = typename ::NPrivate::TStreamBase<Base>::TType>
+
+/**
+ * An ownership-gaining wrapper for proxy streams.
+ *
+ * Example usage:
+ * \code
+ * TCountingInput* input = new THoldingStream<TCountingInput>(new TStringInput(s));
+ * \encode
+ *
+ * In this example, resulting counting input also owns a string input that it
+ * was constructed on top of.
+ */
+template <class Base, class StreamBase = typename ::NPrivate::TStreamBase<Base>::TType>
class THoldingStream: private THolder<StreamBase>, public Base {
public:
- template <class... Args>
+ template <class... Args>
inline THoldingStream(THolder<StreamBase> stream, Args&&... args)
: THolder<StreamBase>(std::move(stream))
- , Base(this->Get(), std::forward<Args>(args)...)
+ , Base(this->Get(), std::forward<Args>(args)...)
{
}
};