Skip to main content Skills Marketplace Découvrez et explorez les compétences IA créées par la communauté.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Copier le promptAfficher les détails du prompt Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-cpp --skill stlLa commande reste sur une seule ligne. Faites défiler horizontalement pour la vérifier avant de la copier.
Vous préférez une copie locale ? Téléchargez les fichiers actuellement disponibles dans SkillsMP.
Télécharger Zip Téléchargement... Plus depuis ce dépôt Production-grade skill for C++ build infrastructure. Covers CMake, Make, Ninja, package managers (Conan, vcpkg), cross-platform builds, and CI/CD integration.
Production-grade skill for C++ concurrency and parallel programming. Covers threads, synchronization primitives, atomics, async programming, parallel algorithms, and lock-free data structures.
Production-grade skill for safe and efficient C++ memory management. Covers RAII, smart pointers, custom allocators, memory pools, and leak detection techniques.
Métiers associés SOC
Basé sur la classification professionnelle SOC
Explorateur de fichiers
4 fichiers name stl version 3.0.0 description Production-grade skill for the C++ Standard Template Library. Covers containers, algorithms, iterators, and utilities for efficient data manipulation.
sasmp_version 1.3.0 skill_version 3.0.0 bonded_agent 03-stl-master bond_type PRIMARY_BOND category learning parameters {"topic":{"type":"string","required":true,"enum":["containers","algorithms","iterators","utilities","ranges"]},"container_type":{"type":"string","required":false,"enum":["vector","map","set","list","deque","unordered_map"]}} error_handling {"retry_logic":{"max_attempts":3,"backoff":"exponential","initial_delay_ms":500,"jitter":true},"fallback":{"on_wrong_container":"suggest_better_alternative","on_iterator_invalidation":"explain_safe_pattern"}}
STL Skill
Production-Grade Learning Skill | Standard Template Library
Master C++ containers, algorithms, and iterators for efficient programming.
Container Selection Guide
Decision Flowchart
Need to store data?
│
├── Need key-value pairs?
│ ├── Need ordering? → std::map
│ └── Need fast lookup? → std::unordered_map
│
├── Need unique elements only?
│ ├── Need ordering? → std::set
│ └── Need fast lookup? → std::unordered_set
│
└── Need sequence?
├── Need random access?
│ ├── Size changes often? → std::vector (default)
│ └── Fixed size? → std::array
├── Need fast insert at both ends? → std::deque
└── Need fast insert in middle? → std::list
Complexity Reference
Container Access Search Insert Delete vectorO(1) O(n) O(n)* O(n) dequeO(1) O(n) O(1)** O(1)** listO(n) O(n) O(1) O(1) set/map- O(log n) O(log n) O(log n) unordered_*- O(1)* O(1)* O(1)*
*amortized **at ends
Containers
std::vector (Default Choice)
#include <vector>
std::vector<int > v;
std::vector<int > v1 = {1 , 2 , 3 , 4 , 5 };
std::vector<int > v2 (10 , 0 ) ;
std::vector< > ;
v. ( );
v. ( );
v. ();
v. (v. (), );
v. (v. () + );
v. ( );
v. ();
int
v3
(v1. begin(), v1. end())
push_back
6
emplace_back
7
pop_back
insert
begin
0
erase
begin
2
reserve
100
shrink_to_fit
std::map / std::unordered_map #include <map>
#include <unordered_map>
std::map<std::string, int > scores;
scores["Alice" ] = 95 ;
scores["Bob" ] = 87 ;
std::unordered_map<std::string, int > cache;
cache["key1" ] = 100 ;
if (auto it = scores.find ("Alice" ); it != scores.end ()) {
std::cout << it->second << "\n" ;
}
for (const auto & [name, score] : scores) {
std::cout << name << ": " << score << "\n" ;
}
scores.insert_or_assign ("Charlie" , 90 );
scores.try_emplace ("Dave" , 85 );
Algorithms
Non-Modifying #include <algorithm>
#include <numeric>
std::vector<int > v = {1 , 2 , 3 , 4 , 5 };
auto it = std::find (v.begin (), v.end (), 3 );
auto it2 = std::find_if (v.begin (), v.end (), [](int n) { return n > 3 ; });
size_t count = std::count_if (v.begin (), v.end (), [](int n) { return n % 2 == 0 ; });
bool allPos = std::all_of (v.begin (), v.end (), [](int n) { return n > 0 ; });
bool anyNeg = std::any_of (v.begin (), v.end (), [](int n) { return n < 0 ; });
int sum = std::accumulate (v.begin (), v.end (), 0 );
int product = std::accumulate (v.begin (), v.end (), 1 , std::multiplies<>());
Modifying
std::transform (v.begin (), v.end (), v.begin (), [](int n) { return n * 2 ; });
std::sort (v.begin (), v.end ());
std::sort (v.begin (), v.end (), std::greater<>());
std::stable_sort (v.begin (), v.end ());
v.erase (std::remove_if (v.begin (), v.end (), [](int n) { return n < 0 ; }), v.end ());
std::erase_if (v, [](int n) { return n < 0 ; });
v.erase (std::unique (v.begin (), v.end ()), v.end ());
Binary Search (Sorted Containers) std::vector<int > sorted = {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 };
bool found = std::binary_search (sorted.begin (), sorted.end (), 5 );
auto lower = std::lower_bound (sorted.begin (), sorted.end (), 5 );
auto upper = std::upper_bound (sorted.begin (), sorted.end (), 5 );
auto range = std::equal_range (sorted.begin (), sorted.end (), 5 );
C++20 Ranges #include <ranges>
namespace rv = std::views;
std::vector<int > data = {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 };
auto result = data
| rv::filter ([](int n) { return n % 2 == 0 ; })
| rv::transform ([](int n) { return n * n; })
| rv::take (3 );
std::vector<int > squares (result.begin(), result.end()) ;
std::ranges::sort (data);
auto it = std::ranges::find (data, 5 );
Troubleshooting
Iterator Invalidation Container Invalidates on vectorInsert/erase (except at end) dequeInsert/erase (except at ends) listNever (except erased element) map/setNever (except erased element)
Safe Patterns
for (auto it = v.begin (); it != v.end (); ++it) {
if (*it < 0 ) v.erase (it);
}
for (auto it = v.begin (); it != v.end (); ) {
if (*it < 0 ) {
it = v.erase (it);
} else {
++it;
}
}
std::erase_if (v, [](int n) { return n < 0 ; });
Unit Test Template #include <gtest/gtest.h>
TEST (STLTest, VectorOperations) {
std::vector<int > v = {1 , 2 , 3 };
v.push_back (4 );
EXPECT_EQ (v.size (), 4 );
EXPECT_EQ (v.back (), 4 );
v.pop_back ();
EXPECT_EQ (v.size (), 3 );
}
TEST (STLTest, MapOperations) {
std::map<std::string, int > m;
m["a" ] = 1 ;
m["b" ] = 2 ;
EXPECT_EQ (m["a" ], 1 );
EXPECT_TRUE (m.contains ("b" ));
}
TEST (STLTest, Algorithms) {
std::vector<int > v = {3 , 1 , 4 , 1 , 5 , 9 };
std::sort (v.begin (), v.end ());
EXPECT_TRUE (std::is_sorted (v.begin (), v.end ()));
auto it = std::find (v.begin (), v.end (), 5 );
EXPECT_NE (it, v.end ());
}
C++ Plugin v3.0.0 - Production-Grade Learning Skill