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> | |
#include <algorithm> | |
namespace has_own_find_impl__ { | |
struct two__ { char c__[2]; }; | |
template <class T> static two__ test__(...); | |
template <class T> static char test__(decltype(std::declval<T>().find(std::declval<typename T::key_type>()))* = 0); |
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> | |
#include <type_traits> | |
#include <utility> | |
namespace { | |
struct Func | |
{ | |
Func() = default; |
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
// Developing of the topic, see previous gists: | |
// 1. https://gist.github.com/oliora/b8207b4a74a6bb868ef4 | |
// 2. https://gist.github.com/pudov/0b1572989c418684c381 | |
#include <type_traits> | |
#include <utility> | |
#include <vector> | |
#include <set> | |
// Let's use std::void_t. Unfortunately it's introduced in C++17 but you can easily add it by yourself |
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
// Simple ORM = SORM | |
namespace sorm { | |
namespace details { | |
template<size_t N, class Statement, class P> | |
inline void bind_params(Statement& stmt, const P& p) | |
{ | |
bind_param(stmt, N, p); | |
} | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<!--See more at http://superuser.com/a/1064474/581948--> | |
<key>Label</key> | |
<string>NAME.sshfs</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/sshfs</string> |
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
// Test of performance bug with some std::map and std::unordered_map implementations | |
// see http://www.forwardscattering.org/post/37 for details. | |
// | |
// Written by Andrey Upadyshev https://github.com/oliora/ based on article's test code | |
#include <unordered_map> | |
#include <map> | |
#include <iostream> | |
#include <iomanip> | |
#include <chrono> | |
#include <type_traits> |
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 <chrono> | |
#include <type_traits> | |
// Floating seconds duration | |
using fseconds = std::chrono::duration<double>; | |
class PerfTimer | |
{ | |
public: | |
using clock = std::conditional< |
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
// A compilation of the following posts: | |
// http://stackoverflow.com/questions/18648069/g-doesnt-compile-constexpr-function-with-assert-in-it | |
// http://ericniebler.com/2014/09/27/assert-and-constexpr-in-cxx11/ | |
#include <cassert> | |
#include <utility> | |
template<class Assert> | |
inline void constexpr_assert_failed(Assert&& a) noexcept { std::forward<Assert>(a)(); } | |
// When evaluated at compile time emits a compilation error if condition is not true. |
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
///////////////////////////////////////////// | |
// parser.h | |
#include <memory> | |
template<class T> | |
struct delegating_delete { | |
inline void operator() (T *p) const noexcept { do_delete(p); } | |
}; | |
namespace parser { |
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> | |
struct Bar {}; | |
// Note about `is_convertible<T&&, Foo>`. `T&&` is essential there! | |
struct Foo | |
{ | |
template<class T, class = typename std::enable_if<!std::is_convertible<T&&, Foo>::value>::type> | |
Foo(T&& t) {} |