utility


1. Array Manipulation with std::iota

int arr[5];
iota(arr, arr + 5, 1); // Initialize array to [1, 2, 3, 4, 5]

2. Find Minimum and Maximum Elements with std::min and std::max

int a = 10, b = 20, c = 30;
int min_val = min({a, b, c}); // min_val = 10
int max_val = max({a, b, c}); // max_val = 30

3. Swap Values with std::swap

int a = 10, b = 20;
swap(a, b); // a = 20, b = 10

4. Check if Two Values Are Equal with std::equal_to

int a = 10, b = 10;
bool are_equal = std::equal_to<int>()(a, b); // are_equal = true

5. Count Occurrences in a Container with std::count

vector<int> v = {1, 2, 3, 4, 1};
int num_of_ones = count(v.begin(), v.end(), 1); // num_of_ones = 2

6. Reverse a Container with std::reverse

vector<int> v = {1, 2, 3, 4, 5};
reverse(v.begin(), v.end()); // v = {5, 4, 3, 2, 1}

7. Copy Elements from One Container to Another with std::copy

8. Search for an Element in a Container with std::find

9. Insert an Element into a Sorted Container with std::insert

10. Create a Vector with a Range of Values with std::iota

11. Sort a Container with std::sort

12. Randomize a Container with std::shuffle

13. Create a Temporary Copy with std::make_unique

14. Check if a Container Is Empty with std::empty

15. Clear a Container with std::clear

16. Remove an Element from a Container with std::erase

17. Transform a Container with std::transform

18. Reduce a Container with std::accumulate

19. Partition a Container with std::partition

20. Convert to Uppercase with std::toupper

21. Convert to Lowercase with std::tolower

22. Trim Whitespace with std::trim

23. Split a String with std::split

24. Join Container Elements into a String with std::join

25. Check if a File Exists with std::filesystem::exists

26. Create a Directory with std::filesystem::create_directory

27. Delete a File with std::filesystem::remove

28. List Directory Contents with std::filesystem::directory_iterator

29. Get Current Working Directory with std::filesystem::current_path

30. Parse a Command Line with Boost::ProgramOptions

31. Create a HTTP Server with Boost::Beast

32. Parse JSON with RapidJSON

33. Create a WebSocket Server with websocketpp

34. Send an Email with SmtpClient

35. Generate a Random Number with std::random_device

36. Create a Stopwatch with std::chrono

37. Log Messages with spdlog

38. Create a Dependency Graph with Boost::Graph

39. Create a Regular Expression with Boost::Regex

40. Perform a CPU-Intensive Task with std::thread and std::atomic

41. Create a Non-Blocking Socket with Boost::ASIO

42. Create a Binary Tree with Boost::Tree

43. Perform Image Processing with OpenCV

44. Create a Data Structure with Boost::MultiIndex

45. Generate a UUID with Boost::UUID

46. Compress Data with zlib

47. Check if a URL is Valid with Boost::URL

48. Create a Random Forest with scikit-learn

49. Perform a Natural Language Processing Task with spaCy

50. Create a REST API with Flask