From 0d29552c20dce71ca14739d6d966ba41e4a49367 Mon Sep 17 00:00:00 2001
From: Bensong Liu <bensl@microsoft.com>
Date: Tue, 13 Apr 2021 16:37:19 +0800
Subject: [PATCH] add scan<json> like function

---
 stdio.hpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/stdio.hpp b/stdio.hpp
index 6cca73b..cdc028a 100644
--- a/stdio.hpp
+++ b/stdio.hpp
@@ -67,6 +67,12 @@ namespace rlib {
     template <typename... Args>
     size_t printfln(std::ostream &os, const std::string &fmt, Args... args);
 
+    template <typename TargetType = std::string>
+    inline TargetType scan(std::istream &is = std::cin) {
+        TargetType target;
+        is >> target;
+        return target;
+    }
     inline rlib::string scanln(std::istream &is = std::cin, char delimiter = '\n') noexcept {
         std::string line;
         std::getline(is, line, delimiter);
-- 
GitLab