問題タブ [string-view]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - std::basic_string_view が const ポインターのみをサポートするのはなぜですか?
cppreference.comの説明によると:
クラス テンプレートは、シーケンスの最初の要素がゼロの位置にあるようなオブジェクト
basic_string_view
の一定の連続したシーケンスを参照できるオブジェクトを記述します。char
ただし、そのクラス テンプレートを const 以外のchar
ポインターで使用すると便利な場合があります。たとえば、標準アルゴリズムを使用して null で終わるバイト文字列に書き込む場合などです。たとえば、std::editable_string_view
を所有する仮説をイメージするとchar*
、次のように書くことができます。
std::basic_string_view
const ポインターのみをサポートする理由はありますか?
c++ - std::string_view へのファイル
ファイルを std::string_view に直接ロードすることは可能ですか?
直接 = stringstream からプロキシ std::string を作成せずに。
それは私のコードの多くをより速くするでしょう。