This file contains hidden or 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
// from blog post: http://reedbeta.com/blog/python-like-enumerate-in-cpp17/ | |
#include <tuple> | |
template <typename T, | |
typename TIter = decltype(std::begin(std::declval<T>())), | |
typename = decltype(std::end(std::declval<T>()))> | |
constexpr auto enumerate(T && iterable) | |
{ | |
struct iterator | |
{ |
This file contains hidden or 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 <numeric> | |
#include <optional> | |
#include <vector> | |
#include <functional> | |
#include <boost/container/flat_map.hpp> | |
#include <boost/container/small_vector.hpp> | |
template<typename K, typename T> | |
struct TrieNode |
This file contains hidden or 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 <algorithm> | |
#include <utility> | |
#include <vector> | |
#include <iostream> | |
namespace range{ | |
namespace detail{ | |
using std::begin; | |
using std::end; |
This file contains hidden or 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 <stdexcept> | |
#include <string_view> | |
#include <string> | |
#include <type_traits> | |
#include <utility> | |
// TODO add default implementations for standard types(containers, smart pointers, optional, variant, etc) | |
// TODO introduce dedicated namespace for specialization of own serialize functions | |
//for c++14 use boost::string_ref; |
This file contains hidden or 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 <vector> | |
#include <type_traits> | |
#include <utility> | |
#include <stdexcept> | |
#include <string_view> | |
#include <tuple> | |
namespace Json { | |
template<typename T> | |
struct Reader |
This file contains hidden or 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 <algorithm> | |
#include <cassert> | |
#include <vector> | |
#include <mutex> | |
#include <condition_variable> | |
#include <memory> | |
#include <iostream> | |
template<typename Session, typename Pool> |
This file contains hidden or 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 <mutex> | |
#include <tuple> | |
namespace meta { | |
template<int ... Ints> | |
struct Sequence{}; | |
namespace details { | |
template<int ...Ints> struct SequenceGen; |
This file contains hidden or 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 <tuple> | |
template<int ... Ints> | |
struct sequence{ | |
static constexpr std::size_t size = sizeof ...(Ints); | |
}; | |
template<int ... Ns> struct seq_gen; |
This file contains hidden or 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 <algorithm> | |
template<typename Container, typename Comp, typename F> | |
void group_by (Container& vec, Comp comp, F&& f) { | |
std::sort(std::begin(vec), std::end(vec), comp); | |
auto it = std::begin(vec); | |
auto const end = std::end(vec); | |
while(it != end) { | |
auto last = std::upper_bound(it, end, *it, comp); | |
std::forward<F>(f)(it, last); | |
it = last; |
This file contains hidden or 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 <cstdio> | |
#include <string_view> | |
#include <string> | |
#include <streambuf> | |
#include <string> | |
template<typename Buffer> | |
class back_insert_streambuf final : public std::streambuf | |
{ | |
public: |
NewerOlder