Basic C++ Idioms / Techniques

前端 未结 6 1409
闹比i
闹比i 2021-02-02 01:21

Note: marked as community wiki.

In recent days, I\'ve realized how little I know about C++.

Besides:

  • using the STL
  • implementing RAII
6条回答
  •  轮回少年
    2021-02-02 01:50

    The way I used to improve my c++ is reading the source code of leveldb. Because leveldb is a product level code. So you can learn the cpp idiom and design pattern from a real product. Let me show you some example

    Leveldb use the Pimpl idiom, almost in all of it's head file, such table.h table_build.h write_batch.h. You can learn from the code directly

    Leveldb use many OO design pattern, such as build pattern, the table have the table_build class to build the table, the block have the block_build class to build the block

    Leveldb also use the Iterator pattern, the iterator make us use leveldb more convenient.

    So I think leveldb contain many idiom or design pattern that c++ engineer should know.

提交回复
热议问题