Example 1 — Basic ends_with
Check a .cpp extension.
#include <iostream>
#include <string>
int main() {
std::string file = "main.cpp";
std::cout << std::boolalpha << file.ends_with(".cpp") << '\\n';
return 0;
} How It Works
- The name ends with
.cpp. - ends_with returns true.
- Common filter for source files.

