This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be vimproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" " alternatively, pass a path where Vundle should install plugins | |
" "call vundle#begin('~/some/path/here') | |
" | |
" " let Vundle manage Vundle, required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <list> | |
#include <iostream> | |
#include <algorithm> | |
#if defined(__cpp_concepts) && __cpp_concepts >= 201500 | |
template<typename T> | |
concept bool HasMemberNamedTestConcept = requires(T t) { | |
t.test; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
int a; | |
int b; | |
void swap1(void) | |
{ | |
int t = a; | |
a = b; | |
b = t; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: generic | |
cache: | |
apt: true | |
matrix: | |
include: | |
- os: linux | |
env: COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 | |
addons: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <class Tag, typename Tag::type Value> | |
struct PrivateRobber { | |
friend typename Tag::type get(Tag) { | |
return Value; | |
} | |
}; | |
class Item { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class Container> | |
void doWork(Container& container) | |
{ | |
Container::iterator it; | |
Container::iterator * it_ptr; | |
} | |
struct Person | |
{ | |
static int iterator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct first { | |
char first_char; | |
int an_int; | |
char second_char; | |
}; | |
struct second { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Shuffle an <seealso cref="Array"/> of type <typeparamref name="T"/> | |
/// then return it for chaining. | |
/// </summary> | |
/// <typeparam name="T">Type of element in array.</typeparam> | |
/// <param name="array">The array which need to shuffle. This array will be modified.</param> | |
/// <returns>The modified array. It's the same reference with the input array.</returns> | |
public T[] Shuffle<T>(T[] array) | |
{ | |
Random rnd = new Random(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TypeExtensions | |
{ | |
/// <summary> | |
/// Determine whether a type is simple (String, Decimal, DateTime, etc) | |
/// or complex (i.e. custom class with public properties and methods). | |
/// </summary> | |
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/> | |
public static bool IsSimpleType( | |
this Type type) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template <class T> | |
int get_age(T obj) { | |
return obj.age; | |
} | |
class Person { | |
public: |
NewerOlder