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
| # zplug | |
| source ~/.zplug/init.zsh | |
| zplug 'zplug/zplug', hook-build:'zplug --self-manage' | |
| # theme | |
| zplug "bhilburn/powerlevel9k", use:powerlevel9k.zsh-theme | |
| # syntax highlighting (https://github.com/zsh-users/zsh-syntax-highlighting) | |
| zplug "zsh-users/zsh-syntax-highlighting" | |
| # history関係 | |
| zplug "zsh-users/zsh-history-substring-search" | |
| # タイプ補完 |
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
| fn main() { | |
| let mut scores = vec![1, 2, 3]; // --+ 'scope | |
| let score = &scores[0]; // | | |
| // ^~~~~~~~~~~~~~~~~~~~~ 'lifetime // | | |
| println!("{}", score); // | | |
| scores.push(4); // | | |
| } // <-----------------------------------+ |
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 <tuple> | |
| using namespace std; | |
| int | |
| main(){ | |
| vector< pair< std::string, int, int > > vec; | |
| // 超ダサいし、読みにくいし、パフォーマンスも悪そうなコード | |
| vec.push_back( make_tuple( "hoge", 1, 0 ) ); | |
| // コンストラクタに直接初期化子を完全転送して要素を構築 |
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> | |
| int main() { | |
| [](auto f){ | |
| return [=](auto x) { | |
| return [=](auto ...y) { | |
| return f(x(x), y...); | |
| }; | |
| }([=](auto x) { | |
| return [=](auto ...y) { |
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<typename F> | |
| class FixPoint | |
| { | |
| public: | |
| explicit constexpr FixPoint(F&& f) noexcept | |
| : m_f(std::forward<F>(f)) | |
| {} | |
| template<typename... Args> | |
| constexpr decltype(auto) |
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<typename F> | |
| class FixPoint : F | |
| { | |
| public: | |
| explicit constexpr FixPoint(F&& f) noexcept | |
| : F(std::forward<F>(f)) | |
| {} | |
| template<typename... Args> | |
| constexpr decltype(auto) |
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
| export TERM="xterm-256color" | |
| source ~/.zplug/init.zsh | |
| zplug "zsh-users/zsh-syntax-highlighting", defer:2 | |
| # Load theme file | |
| zplug bhilburn/powerlevel9k, use:powerlevel9k.zsh-theme | |
| # Install plugins if there are plugins that have not been installed | |
| if ! zplug check --verbose; then |
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 "shared_range.hpp" | |
| int main() | |
| { | |
| using cranberries::shared_util::shared_range; | |
| auto ln = []{ std::cout << std::endl; }; | |
| std::shared_ptr<int[]> p1 { new int[10]{1,2,3,4,5,6,7,8,9,10} }; | |
| // [0, 5) |
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 F> | |
| struct Fixed { | |
| F f; | |
| template <class... Args> | |
| decltype(auto) operator()(Args&&... args) const { | |
| return f(std::ref(*this), std::forward<Args>(args)...); | |
| } | |
| }; | |
| template < class F > |