Skip to content

Instantly share code, notes, and snippets.

#include <cassert>
#include <iostream>
#include <functional>
#include <memory>
#include <type_traits>
#include <typeinfo>
#include <typeindex>
#include <utility>
#include <unordered_map>
@Jiwan
Jiwan / main.cpp
Created October 29, 2015 12:09
C++98 SFINAE usage for serialization
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
@Jiwan
Jiwan / main.cpp
Created October 31, 2015 19:27
C++ 14 example SFINAE!
#include <boost/hana.hpp>
#include <iostream>
#include <type_traits>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
@Jiwan
Jiwan / repository_shared_ptr.cpp
Last active December 13, 2020 15:11
C++11 example for my post - An introduction to C++'s variadic templates: a thread-safe multi-type map - using shared_ptr
#include <iostream>
#include <string>
struct DefaultSlotKey;
template <class Type, class Key = DefaultSlotKey>
class Slot
{
public:
std::shared_ptr<Type> doGet() const
@Jiwan
Jiwan / main.cpp
Created October 30, 2015 16:13
C++11 example 1
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
@Jiwan
Jiwan / main.cpp
Created February 4, 2016 22:05
Final C++14 example for my post - An introduction to C++'s variadic templates: a thread-safe multi-type map
#include <iostream>
#include <memory>
#include <string>
#include "repository.hpp"
// Incomplete types used as compile-time keys.
struct Key1;
struct Key2;
@Jiwan
Jiwan / main.cpp
Last active November 3, 2018 05:49
C++11 example 2 SFINAE
#include <iostream>
struct A {};
std::string to_string(const A&)
{
return "I am a A!";
}
// Type B with a serialize method.
import argparse
import datetime
import unicodecsv as csv
import meetup.api
import os.path
columns = ['name', 'real_name', 'kingster', 'id', 'rsvp', 'rsvp_date', 'joined_group_date', 'title', 'host', 'url', 'new_entry']
if __name__ == "__main__":
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
@Jiwan
Jiwan / update-clang.sh
Last active March 16, 2017 15:15
Update clang script
#!/usr/bin/env bash
if [ -d "llvm" ]; then
pushd .
cd llvm/
svn cleanup
svn update
popd
else
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm