Skip to content

Instantly share code, notes, and snippets.

View loliGothicK's full-sized avatar
:octocat:
may the --force be with you!

Mitama loliGothicK

:octocat:
may the --force be with you!
View GitHub Profile
FROM ubuntu
RUN set -x && \
apt-get update && \
apt-get install -y make cmake gcc g++ python libtool zlib1g zlib1g-dev subversion && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
cd / && \
mkdir llvm && \
cd /llvm && \
# 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"
# タイプ補完
fn main() {
let mut scores = vec![1, 2, 3]; // --+ 'scope
let score = &scores[0]; // |
// ^~~~~~~~~~~~~~~~~~~~~ 'lifetime // |
println!("{}", score); // |
scores.push(4); // |
} // <-----------------------------------+
#include <vector>
#include <tuple>
using namespace std;
int
main(){
vector< pair< std::string, int, int > > vec;
// 超ダサいし、読みにくいし、パフォーマンスも悪そうなコード
vec.push_back( make_tuple( "hoge", 1, 0 ) );
// コンストラクタに直接初期化子を完全転送して要素を構築
#include <iostream>
int main() {
[](auto f){
return [=](auto x) {
return [=](auto ...y) {
return f(x(x), y...);
};
}([=](auto x) {
return [=](auto ...y) {
template<typename F>
class FixPoint
{
public:
explicit constexpr FixPoint(F&& f) noexcept
: m_f(std::forward<F>(f))
{}
template<typename... Args>
constexpr decltype(auto)
template<typename F>
class FixPoint : F
{
public:
explicit constexpr FixPoint(F&& f) noexcept
: F(std::forward<F>(f))
{}
template<typename... Args>
constexpr decltype(auto)
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
@loliGothicK
loliGothicK / main.cpp
Last active May 24, 2018 20:52
shared_ptr<T[]>, shared_ptr<T[N]>のレンジ
#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)
#include <memory>
int main() {
// bounded array
std::shared_ptr<int[5]> ptr1 { new int[5]{} };
// un-bounded array
std::shared_ptr<int[]> ptr2 { new int[5]{} };
}