See also CodingStyle/C++.

STL

Wrap an existing C-style pointer to an array with std::vector: http://stackoverflow.com/a/15203325/14878; modifies std::vector internals to work.

C++11

Move semantics/perfect forwarding

Smart pointers

Data structures

B-tree-based maps & sets

Parsing

JSON

C++ and Python

Helpers

Interesting libraries

Other stuff

Videos

Curiously recurring C++ bugs at Facebook

Curiously recurring C++ bugs at Facebook

Patterns and Techniques Used in the Houdini 3D Graphics Application (Mark Elendt)

CppCon 2018: Mark Elendt “Patterns and Techniques Used in the Houdini 3D Graphics Application”

Language servers

clangd

Source code for clangd's main file. See what options are supported, renamed, etc.

ccls

ccls is a language server for C/C++. The instructions below can also be used for compiling cquery.

For Ubuntu 18.10, first install dependency packages (adjust clang package versions if needed):

sudo apt install -y clang libclang-dev libncurses-dev libtinfo5 llvm-dev zlib1g-dev

Download clang from [[https://releases.llvm.org|releases.llvm.org]:

wget --continue https://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz
# Extract into clang-llvm
mkdir clang-llvm
tar xvf clang*tar.xz -C clang-llvm --strip-components=1

And configure with:

export CFLAGS=-O3 -march=native
export CXXFLAGS=$CFLAGS
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PWD/clang-llvm/

To build using the LLVM native on Ubuntu, use:

export CFLAGS=-O3 -march=native
export CXXFLAGS=$CFLAGS
cmake -H. -Bbuild-native \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_PREFIX_PATH=/usr/lib/llvm-7 \
    -DLLVM_INCLUDE_DIR=/usr/lib/llvm-7/include \
    -DLLVM_BUILD_INCLUDE_DIR=/usr/include/llvm-7/ \
    -DLLVM_ENABLE_RTTI=on

Build with either:

make -C build -j$(nproc)
cmake --build Release --parallel $(nproc)

adjust as appropriate for the version of LLVM you are using.

If you're using the downloaded version of LLVM, you need to distribute that tarball with your ccls binary, and configure it's location as it's "resource directory".

To run ccls independent of a language server-capable IDE:

ccls --index=$(pwd) -v=2 --init='{"cacheDirectory":"/home/samatj/splcore.main/Python3/.vscode/ccls","clang":{"resourceDir":"/home/samatj/Downloads/clang-resource-dir.tar/","extraArgs":["--gcc-toolchain=/usr"]}}' --log-file=ccls.log

SamatsWiki: ProgrammingLanguages/C++ (last edited 2022-03-17 01:17:02 by SamatJain)