Skip to content

Instantly share code, notes, and snippets.

View juleswh's full-sized avatar

Jules Wdht juleswh

  • Les Octets Libres
  • France
View GitHub Profile
@juleswh
juleswh / main.cpp
Last active September 23, 2019 14:18
If you need to clone objects that don't have a proper clone method.
#include <iostream>
#include <assert.h>
#include "try_clone.hpp"
struct Base { virtual const char* f() =0;};
struct A :virtual public Base {
const char* f(){return id();}
float _a=1.11;
static const char* id(){return "A";}
@juleswh
juleswh / README.md
Last active July 9, 2019 13:28
QtCreator cpp class wizard with headers complying with llvm style

Instead of the default (and pretty bugprone) qtcreator header guard CLASS_H, this defines a safer one in the form NAMESPACE_NESTED_NAMESPACES_CLASS_H. It is more likelly to comply with [llvm-header-guard][1] check of clang-tidy, if your namespaces matches your folder architecture.

Copy the three files (file.cpp file.h wizard.json) in your local qtcreator template folder:

$HOME/.config/QtProject/qtcreator/templates/wizards/classes/cpp/ on Linux and macOS or %APPDATA%\QtProject\qtcreator\templates\wizards\classes\cpp\ on Windows.

You may need to restart qtcreator for this to be considered.

Keybase proof

I hereby claim:

  • I am juleswh on github.
  • I am julwald (https://keybase.io/julwald) on keybase.
  • I have a public key whose fingerprint is 2AB1 5F16 5F3F 59F4 DFDD 4CB8 DD5F E28D B8D4 2FB1

To claim this, I am signing this object: