Skip to content

Latest commit

 

History

History
56 lines (53 loc) · 5.02 KB

README.en.md

File metadata and controls

56 lines (53 loc) · 5.02 KB

Cpp-Examples

Code structure

  1. Algorithm
    1. Search——各种查找算法的实现,以及单元测试和基于google benchmark的性能测试;
      1. std_search_examples——Examples of search algorithms in stl;
    2. Sort——Implementation of various sorting algorithms, as well as unit testing and performance testing based on Google benchmark;
      1. std_sort_examples——Examples of sorting algorithms in stl;
  2. BinaryTree——Binary tree related operations, including insertion, removal, search, and printing;
  3. Breakpad——Simple encapsulation of google breakpad;
  4. Exchange Order——Determine the byte order of the system;
  5. Client——A simple Linux select socket client;
  6. CountDownLatch——A simple countdown latch implemented using std::mutex and std::condition_variable (std::latch c++20);
  7. Crashpad——Simple encapsulation of google crashpad;
  8. Curl——Simple use of curl;
  9. TcpClient——Simple tcp client implemented using curl;
  10. HttpClient——Simple http synchronization client implemented using curl;
  11. HttpClientAsync——Simple http asynchronous client implemented using curl;
  12. Design patterns——Some examples of design patterns;
  13. Factory——Factory mode;
  14. MVC——mvc mode;
  15. Observer——Observer mode;
  16. Singleton——Single case mode;
  17. GlobMatch——Simple implementation of glob pattern matching;
  18. Hawthorn——Google glog example;
  19. Icmp——Simple encapsulation of linux icmp protocol;
  20. LinkedList——Related operations of linked lists, including insertion, removal, reversal, and printing;
  21. Memcpy——memcpyfunction implementation;
  22. MonitorDir——windows(ReadDirectoryChangesW),macos(FSEvents) and linux(fanotifyandinotify) Simple example of directory monitoring;
    1. fanotifyused inglobalmode, infanotify_markJoin inFAN_MARK_FILESYSTEM(needCAP_SYS_ADMINability, that is, root permissions) thisflag, all events on the specified file system will be monitored, and then the required events can be filtered according to the specified monitored folder directory. This function is better thaninotifymore powerful;
      1. To obtain the upper-level path where the event file is located, useopen_by_handle_atThis method will appear under ordinary usersOperation not permittedError, also neededCAP_SYS_ADMINAbility, that is, root authority;
      2. It is recommended to run with root privileges. If you must run it under an ordinary user, it is still recommended to useinotifyinstead offanotify, anyway, opening a monitoring file descriptor (fd), it is impossible to achievesubtreemonitor;
  23. MonitorDir_EFSW——A simple example of directory monitoring using efsw;
  24. Mutex——Simple mutex lock and spin lock implemented using std::atomic_flag;
  25. OpenSSL——Some examples of openssl;
    1. aes——AES encryption and decryption examples;
    2. base64——Examples of base64 encoding and decoding;
    3. hash——Example of sha256;
    4. hmac——Example of hmac;
    5. pem——Example of pem format;
    6. rsa——Examples of rsa encryption and decryption;
    7. sm4——Examples of sm4 encryption and decryption;
    8. Kskh09——Example of x509 certificate;
    9. bash——openssl command line example;
  26. SafeCallback——Implementation of life cycle safe callback function, referencemuduo WeakCallback
  27. Server——Some examples of linux server;
    1. server_epoll——epoll example;
    2. server_poll——Poll example;
    3. server_select——Example of select;
  28. Thread——Thread class implemented based on std::thread, including thread pool;
    1. Thread——Thread class;
    2. ThreadPool——Thread pool;