From 4413723d359117d4e6287d7ba94ee9b4102fa149 Mon Sep 17 00:00:00 2001 From: izetag <izetag@yandex-team.ru> Date: Thu, 10 Feb 2022 16:49:23 +0300 Subject: Restoring authorship annotation for <izetag@yandex-team.ru>. Commit 2 of 2. --- library/cpp/yson/node/node.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'library/cpp/yson/node/node.h') diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 1ba5bb0913..5f90f95df0 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -128,9 +128,9 @@ public: // Returns true if TNode is neither Null, nor Undefined bool HasValue() const; - template<typename T> - bool IsOfType() const noexcept; - + template<typename T> + bool IsOfType() const noexcept; + // Int64, Uint64, Double, or Bool bool IsArithmetic() const; @@ -161,7 +161,7 @@ public: // integer types cast // makes overflow checks - template<typename T> + template<typename T> T IntCast() const; // integers <-> double <-> string @@ -170,11 +170,11 @@ public: T ConvertTo() const; template<typename T> - T& As(); - - template<typename T> - const T& As() const; - + T& As(); + + template<typename T> + const T& As() const; + static TNode CreateList(); static TNode CreateList(TListType list); static TNode CreateMap(); @@ -294,7 +294,7 @@ inline bool TNode::IsArithmetic() const { return IsInt64() || IsUint64() || IsDouble() || IsBool(); } -template<typename T> +template<typename T> inline T TNode::IntCast() const { if constexpr (std::is_integral<T>::value) { try { @@ -494,20 +494,20 @@ inline T& TNode::ChildAs(size_t index) { } template<typename T> -inline bool TNode::IsOfType() const noexcept { +inline bool TNode::IsOfType() const noexcept { return std::holds_alternative<T>(Value_); -} - -template<typename T> -inline T& TNode::As() { +} + +template<typename T> +inline T& TNode::As() { return std::get<T>(Value_); -} - -template<typename T> -inline const T& TNode::As() const { +} + +template<typename T> +inline const T& TNode::As() const { return std::get<T>(Value_); -} - +} + //////////////////////////////////////////////////////////////////////////////// namespace NNodeCmp { -- cgit v1.2.3