問題タブ [erase-remove-idiom]
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++ - 最初と最後の文字を削除 C++
std::string から最初と最後の文字を削除する方法、私はすでに次のコードを実行しています。
ただし、このコードは最後の文字のみを削除します
最初の文字も削除するには?
c++ - Remove range of elements from QHash
I use QHash as a container and I have a task to remove all items that satisfy the predicate. At first I thought to use the Erase-remove idiom it turned out that QHash has no option to delete the range, but only a function to delete a single element through the iterator.
std::unordered_map (which is conceptually close to the Qt's QHash) has the function of removing the range.
This implies a question: why QHash does not have a similar function and how to the best way remove items from the QHash satisfying the predicate?
java - メソッドを使用して重複を削除する
重複を削除してビルドしますが、次のヘッダーを使用して整数の配列リストから重複要素を削除する方法を使用する方法を考えています:
リストに 10 個の整数を入力するようにユーザーに促し、正確に 1 つのスペースで区切られた個別の整数を表示するテスト プログラムを作成します。
これは私のコードです。メソッドとテストの使用方法を変更してください。
c++ - 関数の消去削除イディオムの使用
積み重なった人々。
私のプログラムにオブザーバー(esque?)パターンを実装しようとしています。イベントが発生した場合に呼び出される関数を格納するコンポーネントがあります。私の問題は、必要に応じてコンテナから関数を消去する方法がわからないことです。参照によって関数を保存しようとしましたが、その方法がわかりません(または可能かどうか)。
c++ - A vector holds class objects, The class object contains 3 strings per object. How do i find the specific string, then delete the entire element?
I have a class that contains 3 elements for example {first_name, Last_name, Phone}
I have a vector that holds this set of information. In what manner could I go about looking for a single element of the set, for example find(last_name), and delete all elements that contain that specific last name?
I've tried many examples and have searched far and wide throughout the world wide google. Please help. Attached is bits of code:
Now that's just same basic code for the set up. Here's a couple of things i've tried. But the more I look at what the code says, the more it seems as if it's not allowing for a string argument... but then i don't know how to give a class arguement with respect to a specific string... well I don't know what i'm doing wrong. I have a feeling I could do this with pointers, but the whole pointer thing isn't clicking yet. But heres some things i've tried.
When I compile the project the header file stl_algo.h opens and points to line 1133. Any Help would be much appreciated!! thank you!
c++ - erase-remove-idiom の便利なヘルパーが標準で提供されていないのはなぜですか?
STL のコレクションからアイテムを削除するには、イディオムになっている非常に頻繁に使用される手法が必要です:消去-削除-イディオム
このイディオムの最も一般的な使用法の 1 つは、あるタイプのアイテムT
をvector<T>
これは明らかに非常に冗長であり、DRY の原則に違反しています。問題のベクトルは 4 回必要です。
私の質問は、なぜ標準が便利なヘルパーを提供しないのですか?
何かのようなもの
また
これは明らかに次のように拡張できます。
等...