Skip to content

Instantly share code, notes, and snippets.

View minamiyama1994's full-sized avatar

Masakazu Minamiyama minamiyama1994

View GitHub Profile
def to_string(value)
value.to_s
end
#include<typeinfo>
#include"CTE/CTE.hpp"
auto main ( ) -> int
{
auto eval1 = CTE_EVAL ( "1+20*10/(5+5)" ) ;
auto eval2 = CTE_EVAL ( "1+20*10/(5+5)+.5" ) ;
auto eval3 = CTE_EVAL ( u8R"*****("Hello"+" "+"World")*****" ) ;
std::cout << eval1 << std::endl ;
std::cout << typeid ( eval1 ).name ( ) << std::endl ;
std::cout << eval2 << std::endl ;
@minamiyama1994
minamiyama1994 / Helper.hs
Created April 18, 2014 21:41
Yesodのmodelで好きな型をフィールドの型に使えるようにしたい ref: http://qiita.com/minamiyama1994/items/c0c5ca87948601dc0d84
module Helper where
import Database.Persist.TH
import UserModule ( UserDefineType )
derivePersistField "UserDefineType"
import pygame, sys, random
pygame.init()
size = (800,450)
white = (255, 255, 255)
color = (30, 30, 180)
fps = 30
screen = pygame.display.set_mode(size)
pygame.display.set_caption('lifegame')
cellsize = 8
@minamiyama1994
minamiyama1994 / file0.cpp
Created March 19, 2014 01:30
型安全なprintf -- 如何にしてコンパイル時に型エラーを検出するか -- ref: http://qiita.com/minamiyama1994/items/95ef490043c495be8c44
#include"TSP/TSP.hpp"
auto main ( ) -> int
{
TSP_PRINTF ( "%c\n" , 'a' ) ;
TSP_PRINTF ( "%s\n" , "hoge" ) ;
TSP_PRINTF ( "%d\n" , 1 ) ;
TSP_PRINTF ( "%f\n" , 0.1 ) ;
TSP_PRINTF ( "%%\n%c\n%s\n%d\n%f\nHello! TSP!\n" , 'e' , "piyo" , 1 , 0.25 ) ;
// TSP_PRINTF ( "%f\n" , "hoge" ) ; // <- Compile Error
}
@minamiyama1994
minamiyama1994 / file0.cpp
Created February 13, 2014 13:41
templateの概念からTMPの応用まで ref: http://qiita.com/minamiyama1994/items/1b1b72d6c8a0aa61c6f6
void abc(int arg)
case_ < char >::of
<
match < char , long > ,
match < short , int > ,
match < int , short > ,
match < long , char > ,
match < list < pattern < 0 > , double > , list < double , pattern < 0 > > >
>::type // => long

C++勉強会in広島掲示板

参加希望者及び発表希望者及び希望日時等適当に書いて行ってください

@minamiyama1994
minamiyama1994 / gist:6171027
Last active December 20, 2015 17:49
boost::xpressive's bug?
#include"boost/xpresaive/xpresaive.hpp"
namespace bx = boost::xpressive ;
auto main ( ) -> int
{
bx::sregex regex1 = bx::bos >> ( "instance" | + ( bx::range ( 'a' , 'z' ) | bx::range ( 'A' , 'Z' ) ) ) ;
bx::smatch result ;
if ( bx::regex_search ( std::string { "instanceof" } , result , regex1 ) )
{
std::cout << result.str ( ) << std::endl ; // output : "instance"
}