diff options
| author | Eugene Kosov <claprix@yandex.ru> | 2021-03-22 22:12:50 +0300 |
|---|---|---|
| committer | Eugene Kosov <claprix@yandex.ru> | 2021-03-24 11:23:12 +0300 |
| commit | 8094640809804f74f9d51c9c50a368ecad4f7cb1 (patch) | |
| tree | 393c348a07310174598bfb6b0811367e2579d4aa /sql/string_view.cc | |
| parent | cb545f11169d2425316d96feafc78ac841950e43 (diff) | |
| download | mariadb-git-bb-10.6-MDEV-20453.tar.gz | |
MDEV-20453 add class similar to std::string_view (non owning string reference)bb-10.6-MDEV-20453
Also use string_view in some places.
Diffstat (limited to 'sql/string_view.cc')
| -rw-r--r-- | sql/string_view.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sql/string_view.cc b/sql/string_view.cc new file mode 100644 index 00000000000..6b3b101c131 --- /dev/null +++ b/sql/string_view.cc @@ -0,0 +1,25 @@ +/***************************************************************************** +Copyright (c) 2021 MariaDB Corporation. +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA +*****************************************************************************/ + +#include "string_view.h" + +#include <ostream> + +std::basic_ostream<char> &operator<<(std::basic_ostream<char> &os, + string_view v) +{ + // TODO standard requires a much more complicated code here. + auto size= static_cast<std::streamsize>(v.size()); + os.write(v.data(), size); + return os; +} |
