Skip to content

Instantly share code, notes, and snippets.

@pjc0247
Last active August 8, 2016 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjc0247/9da4914379e44d1f8f50a21739c8bad3 to your computer and use it in GitHub Desktop.
Save pjc0247/9da4914379e44d1f8f50a21739c8bad3 to your computer and use it in GitHub Desktop.

to.cpp

__C++__에 타입 간 형변환 기능을 제공합니다.

STL Container
기본 컨테이너에 to_string 기능이 제공됩니다. (vector, map, initializer_list, string, list ...)

std::vector<int> v({1,2,3,4});

// [1, 2, 3, 4]
to::_string(v);

lemon

C++에 async/await 기능을 사용할 수 있도록 해줍니다.

generator

coroutine<int> test(){
  return coroutine<int>::create([](){
    yield(1);
    yield(2);
    yield(3);
  });
}

for(int v : test())
  std::cout<< v;

await

await delay(1ms /* c++11 UDL */);

auto html = await download_html("SOME_URL");

STORM

Mysql ORM

select

auto result = ORM::from("user")
  ->where("id", "foo")
  ->select("level")
  ->find_one();
  
std::cout<< result["level"];

insert

auto new_user =
  ORM::from("user")->create();

new_user->set("id", "pjc");
new_user->set("nick", "heyy");

(*new_user)["another"] = "method";

new_user->save();

transaction

ORM::begin();
  // .....
ORM::commit();

if( ORM::try_begin() ){
    // .....
  ORM::rollback();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment