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 <type_traits> | |
#include <iostream> | |
using namespace std; | |
template <typename Iterator> | |
using value_type = typename Iterator::value_type; | |
template <typename Iterator, typename Data> | |
auto copy_or_move(Iterator begin, Iterator end, Data& new_memory) |
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<typename T> | |
class auto_recover_t | |
{ | |
T& _ref; | |
T _value; | |
public: |
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 <type_traits> | |
#include <utility> | |
template<typename T> | |
struct wrong | |
{ | |
static constexpr auto value = false; | |
}; | |
struct not_integral |
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
#!/usr/bin/env python | |
import sys | |
import re | |
def convert(name): | |
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) | |
s2 = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).upper() | |
return re.sub('[./_]+', '_', s2) |
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
// This algorithm to determine if the parameter pack arguments are unique looks linear. | |
// It turns out to be quadratic anyway (something inside the compiler, I guess) | |
#include <utility> | |
template<typename T> | |
struct empty{}; | |
template<typename... Ts> | |
struct unique; |
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 <type_traits> | |
namespace sqlpp | |
{ | |
namespace detail | |
{ | |
// A template that always returns false | |
// To be used with static assert, for instance, to ensure it | |
// fires only when the template is instantiated. | |
template<typename T> |