Skip to content

Instantly share code, notes, and snippets.


Manu Sánchez Manu343726

View GitHub Profile
Manu343726 / enum++.hpp
Last active Oct 31, 2017
C++11 introspectable "enums"
View enum++.hpp
#ifndef ENUMPP_HPP
#define ENUMPP_HPP
#include <initializer_list>
#include <utility>
#include <array>
#include <ostream>
template<typename T, std::size_t TotalValues>
struct Enum;

A readonly string class

The objective of this exercise is to learn the basics of RAII, the most important pilar of C++. To do so, you must implement an inmutable string class, which works as follows:

  • The class belongs to the first module of the project, containers.
  • Can be initialized from a C null terminated string (const char*).
  • Manages its own copy in memory of the string given to the constructor.
  • The underlying string storage is correctly handled (Released when it needs to, copied when it needs to, etc).
  • The class has no mutable operations, so the underlying storage is modified only in initialization/copy/move/destruction operations.
Manu343726 / cppp17_deduction_guides_meta.cpp
Last active Jan 18, 2017
Using C++17 template deduction guides as metafunctions. See
View cppp17_deduction_guides_meta.cpp
#include <iostream>
#include <string>
#include <vector>
// Basic vocabulary first:
// A function
template<typename Result>
struct Function
Manu343726 / CMakeLists.txt
Created Oct 26, 2016
Configure protobuf with cmake
View CMakeLists.txt
cmake_minimum_required(VERSION 3.4)
option(MY_PROJECT_SHARED_LIBS "Build proto modules as shared libraries" OFF)
message(STATUS "Google Protocol Buffers version: ${MY_PROJECT_PROTOBUF_VERSION}")
Manu343726 / backward-cpp-valgrind-output.txt
Created Sep 9, 2016
Valgrind showing backward-cpp memory leaks when running siplasplas tests
View backward-cpp-valgrind-output.txt
==7554== HEAP SUMMARY:
==7554== in use at exit: 87,808 bytes in 60 blocks
==7554== total heap usage: 9,511 allocs, 9,451 frees, 1,600,428 bytes allocated
==7554== 768 bytes in 3 blocks are definitely lost in loss record 1 of 4
==7554== at 0x4C2AB80: malloc (in /usr/lib/valgrind/
==7554== by 0x4C2CF1F: realloc (in /usr/lib/valgrind/
==7554== by 0x5A3B5B3: ??? (in /usr/lib/x86_64-linux-gnu/
Manu343726 / siplasplas-reflection.log.txt
Created May 22, 2016
Standardese assertion at cpp_namespace.cpp:52 failed
View siplasplas-reflection.log.txt
[ 83%] Built target standardese-external-project
[100%] Running Standardese on siplasplas-reflection headers...
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/include/siplasplas/reflection/dynamic/entity.hpp"...
[warning] Unknown cursor kind 'UnexposedDecl'
[warning] Unknown cursor kind 'UnexposedDecl'
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/include/siplasplas/reflection/dynamic/runtime.hpp"...
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/include/siplasplas/reflection/dynamic/detail/runtime_forward.hpp"...
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/include/siplasplas/reflection/dynamic/object.hpp"...
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/include/siplasplas/reflection/dynamic/api.hpp"...
[info] Generating documentation for "/home/manu343726/Documentos/siplasplas/in
Manu343726 / standardese.log.txt
Created May 21, 2016
Standardese output on siplasplas allocator sources
View standardese.log.txt
/usr/bin/cmake -H/home/manu343726/Documentos/siplasplas -B/home/manu343726/Documentos/siplasplas/build --check-build-system CMakeFiles/Makefile.cmake 0
CMake Warning (dev) at 3rdParty/cmake/boost/blocks/boost/install/install.cmake:12 (set):
Cannot set "SCOPE": current scope has no parent.
Call Stack (most recent call first):
3rdParty/cmake/boost.cmake:13 (include)
cmake/deftargets.cmake:4 (include)
CMakeLists.txt:14 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
View gol.cpp
#include <vector>
#include <utility>
#include <algorithm>
void update(std::vector<bool>& map, std::size_t rows, std::size_t columns, bool(*rules)(std::size_t, bool))
auto at = [](std::size_t row, std::size_t column)
return row * columns + column;
Manu343726 / gist:ca0ceb224ea789415387
Created Sep 19, 2015
Running ARM docker image with QEMU on x86_64 Arch Linux host
View gist:ca0ceb224ea789415387
# Install quemu, docker, etc
yaourt -S qemu qemu-user-static binfmt-support
# The quemu-user-static AUR package is outdated and broken. The .deb package they pull is no longer in the ubuntu repository.
# Edit the PKGBUILD and use qemu-user-static_2.4+dfsg-3_amd64.deb (With SHA1 sum "84d83a16c60c82b6c579f2f750b04a3ac26c249b")
# Enable ARM emulation
update-binfmts --enable qemu-arm
Manu343726 / vs_source_groups.cmake
Last active Sep 18, 2015
CMake script to generate Visual Studio source groups with the same structure as the project folder hierarchy
View vs_source_groups.cmake
file(GLOB headers