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 <functional> | |
#include <iostream> | |
#include <tuple> | |
class Manipulator { | |
public: | |
using FuncType = std::function<void(std::ostream&)>; | |
Manipulator(const FuncType& f) : f_(f) {} | |
void exec(std::ostream& os) const { f_(os); } | |
private: |
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 <functional> | |
#include <iostream> | |
class Manipulator { | |
public: | |
using FuncType = std::function<void(std::ostream&)>; | |
Manipulator(const FuncType& f) : f_(f) {} | |
void exec(std::ostream& os) const { f_(os); } | |
private: | |
FuncType f_; |
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
[user] | |
name = | |
email = | |
[core] | |
editor = emacs -nw --color=auto | |
pager = lv -c | |
excludesfile = ~/.gitignore-global | |
[color] | |
ui = auto | |
[fetch] |
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
;; load-path追加。 | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/") | |
;; C-hをバックスペースにする。 | |
(global-set-key (kbd "C-h") 'backward-delete-char-untabify) | |
;; C-tの挙動をC-b C-tの感じにする。 | |
(defun my-transpose-chars() | |
(interactive) | |
(forward-char -1) |
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 <iterator> | |
#include <tuple> | |
template <typename> | |
class IntegerRange; | |
namespace iota { | |
template <typename INT> | |
class IntegerIterator : public std::iterator<std::input_iterator_tag, INT> { | |
template <typename> friend class IntegerRange; |
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 <array> | |
#include <iostream> | |
#include <type_traits> | |
#define ENABLER(cond) \ | |
typename std::enable_if<(cond), std::nullptr_t>::type = nullptr | |
template <typename T, T... N> | |
struct IntegerSequence; |
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 <type_traits> | |
// Usage: template <enabler_type<condition> = nullptr> | |
template <bool B> | |
using enabler_type = typename std::enable_if<B, std::nullptr_t>::type; |
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 <tuple> | |
#include <type_traits> | |
#include "integer_sequence.hpp" | |
template <typename T> | |
using resultof = typename std::result_of<T>::type; | |
template <typename F, typename... Args, size_t... I> | |
auto apply_(F&& f, std::tuple<Args...>&& args, IntegerSeq<I...>) | |
-> resultof<F(Args...)> { |
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
// template <class T, T... Ints> class integer_sequence; // in <utility> since C++14 | |
template <size_t... N> | |
struct IntegerSeq { | |
using type = IntegerSeq; | |
static constexpr size_t size() { return sizeof...(N); } | |
}; | |
template <typename S, typename T> | |
struct ConcatSeq_; |
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 <memory> | |
#include <type_traits> | |
template <class T, class... Args> | |
typename std::enable_if<std::is_constructible<T, Args...>::value, | |
std::unique_ptr<T> >::type | |
make_unique(Args&&... args) { | |
return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | |
} | |
template <class T, class... Args> |