C++有哪些练手项目呢?

本人985大三非科班,自学c++想找练手项目自己练练,希望大家给点建议!多谢!

阅读 7.7k
2 个回答

C++ 是一门拥有众多特性的语言,根据你想学习的特性,有不同的迷你项目可以练手:

  • RAII and move semantics - implement unique_ptr

  • Operator overloading - implement complex

  • Raw arrays and pointers - implement vector

  • Memory management and introdue to atomics - implement shared_ptr and weak_ptr

  • Unions and pointers and c-style strings - implement string with small string optimization

  • Bit operations - implement bitset

  • Memory allocation strategies - implement allocator

  • Template metaprogramming - implement tuple

  • Algorithms - implement sort

  • Multithreading, concurrency, locks, condition variables - implement future and async

  • Exceptions - discuss the various exception safety guarantees and how to fulfill them when implementing the above features.

  • Cache friendly structures - use/measure std::map and std::unordered_map. Implement map as a sorted array. Implement unordered_map using various hashing strategies - measure performance and discuss tradeoffs.

而综合性的项目,则需要根据你的兴趣或需求进行选择了。

参考:Reddit

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题