1.3. How to use this book?

Sharpen the knife before cutting the wood!

—Lun Yu

1.3.1. Build The Source Code

The source code of this book can be downloaded at SEIN Github Repo.

To run the code, you need to install google test. In Ubuntu, just run:

sudo apt install libgtest-dev

Then, please use git to clone the repo, and run this:

sudo cp ./source/ch1-intro/sein.hpp /usr/local/include/

Both CMake and Bazel build are supported.

1.3.1.1. Build With CMake

mkdir build
cd build
cmake ..
make -j `nproc`

1.3.1.2. Build With Bazel

1.3.2. Debug The Source Code

To debug the source code line by line, I recommend using CLion. CLion can automatically detect the test cases so that you can start to debug right away by clicking a button in the GUI.

../_images/clion.png

Figure 1.3.1 Debug with CLion

1.3.3. How this book is structured?

1.3.3.1. Algorithm

1.3.4. How do I wrote this book?

Chapter page template:

Chapter Title
**********************

.. toctree::
   :maxdepth: 2

   section_1
   section_2
   questions

Questions page template:

Questions
=========================================

Question Title
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: none

    Question contents ...

----

Solution

.. only:: html

    - http://www.wu-99.com

Test code template:

#include <gtest/gtest.h>
#include <sein.hpp>

namespace ns_abc{
    //...
}
using namespace ns_abc;
TEST(_abc, a) {
    EXPECT_TRUE(1);
}

Take Section 3.8 as an example.