SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
PStade.OvenとEggを読む。

                  @hotwatermorning



Boost.勉強会 #6 札幌
はじめに。
はじめに。
●
    この発表の主なターゲット
はじめに。
●
    この発表の主なターゲット
●   日常的にBoostを使ってる人or使われている人
はじめに。
●
    この発表の主なターゲット
●   日常的にBoostを使ってる人or使われている人
●   日常的にPStade.Oven, PStade.Eggを使ってい
    る人
はじめに。
●
    この発表の主なターゲット
●   日常的にBoostを使ってる人or使われている人
●   日常的にPStade.Oven, PStade.Eggを使ってい
    る人
●   EggやOvenの実装に興味がある人
PStadeとは?
PStadeとは?
●   Shunsuke Sogame氏によって開発された、
    C++ Template Libraryです。
    ●   Biscuit Parser Library
    ●   Ketchup Message Map Library
    ●   Egg Functional Library
    ●   Oven Range Library
        などが含まれています。
PStadeとは?
●   Shunsuke Sogame氏によって開発された、
    C++ Template Libraryです。
    ●   Biscuit Parser Library
    ●   Ketchup Message Map Library
    ●   Egg Functional Library
    ●   Oven Range Library       ← 今日はこの2つを
                                   取り上げます
        などが含まれています。
PStade.Egg
●   A framework of making function objects.
                         “http://p-stade.sourceforge.net/”
●   Egg is a small header-only framework of
    building functions, and offers higher-order
    functions.
                                            “Introduction”
            “http://p-stade.sourceforge.net/egg/doc/html/”
PStade.Oven
●   A Boost.Range Extension Library
                         “http://p-stade.sourceforge.net/”
●   Oven is an advanced implementation of
    Range Library Proposal
                                            “Introduction”
           “http://p-stade.sourceforge.net/oven/doc/html/”
PStade.Oven
●   そして、PStade.Ovenの実装には、PStade.Egg
    が使われています。
●   なので、Ovenを読もうと思うと、Eggを読む必
    要がある。
●   逆にEggを読めば、Ovenの理解も進みます。
というわけで、今日は
 OvenとEggのソースを
覗いていきたいと思います。
Ovenの使用例
namespace oven = pstade::oven;
std::string const x = "ab123cde5f";
oven::copy(
    x
    |   oven::filtered(isalpha)
    |   oven::transformed(toupper),
    std::ostream_iterator<char>(std::cout) );
//outputs : ABCDEF
Ovenの使用例
                     Range
namespace oven = pstade::oven;
std::string const x = "ab123cde5f";
oven::copy(
    x
    |   oven::filtered(isalpha)
    |   oven::transformed(toupper),
    std::ostream_iterator<char>(std::cout) );
//outputs : ABCDEF
Range
●
    何らかの値の列の範囲を表す物
●   生配列, std::vector, std::list, std::map,
    boost::array, etc, …
●
    コンテナじゃなくても、例えば指定された範囲
    の自然数列を返すcounting rangeなんてものも
    ある。
Ovenの使用例
namespace oven = pstade::oven;
std::string const x = "ab123cde5f";
oven::copy(
                                  Range Adaptor
    x
    |   oven::filtered(isalpha)
    |   oven::transformed(toupper),
    std::ostream_iterator<char>(std::cout) );
//outputs : ABCDEF
Range Adaptor
●   Iterator AdaptorのRange版
●   Rangeを横断しながら、値を変更したりスキッ
    プしたりして、元のRangeから別のRangeを返
    す。
●   遅延評価によって、実際にRangeの値が参照さ
    れるときに、その処理の間に入って働くため、
    ●   元のRangeは変更しない。
    ●   返されるRangeはいちいち元のRangeを全部コピー
        しているわけではない。
    ●   計算量/空間量的にお得。
Range Adaptor
●   Range Adaptorはパイプ演算子でつなげていく
    ことが出来る。
    range_ | adaptor1 | adaptor2 | …
●
    効果が順次適用されていく
Ovenの使用例
namespace oven = pstade::oven;
std::string const x = "ab123cde5f";
oven::copy(
    x
    |   oven::filtered(isalpha)
Range Based Function
    |   oven::transformed(toupper),
    std::ostream_iterator<char>(std::cout) );
//outputs : ABCDEF
Range-Based Function
●   STLのアルゴリズム(copy, sort, findなど)はイテ
    レータのbeginとendを引数に取る。
●   これはIterator-Based Functionと呼ばれる。
●
    使い勝手があんまりよくない。バグを埋めこん
    でしまう可能性も高い。
●   Iteratorのbeginとendをまとめたもの(=Range)
    を渡せるようにすればより使いやすい。
Range-Based Function
●
    ここら辺については、
    ●   Exceptional C++
    ●   プログラミングの魔導書vol.1
              ”オーブンレンジクッキング”
    ●
        プログラミングの魔導少女
              “RangeとPStade.Oven”
●
    などなどに情報があります。
というわけで、これから
OvenとEggのソースに
   潜っていきます
Ovenの使用例
namespace oven = pstade::oven;
std::string const x = "ab123cde5f";
oven::copy(
    x
    |   oven::filtered(isalpha)
    |   oven::transformed(toupper),
    std::ostream_iterator<char>(std::cout) );
//outputs : ABCDEF

Weitere ähnliche Inhalte

Was ist angesagt?

Effective Modern C++ 勉強会#3 Item 15
Effective Modern C++ 勉強会#3 Item 15Effective Modern C++ 勉強会#3 Item 15
Effective Modern C++ 勉強会#3 Item 15Mitsuru Kariya
 
mrubyのfiberを試してみた
mrubyのfiberを試してみたmrubyのfiberを試してみた
mrubyのfiberを試してみたKindai University
 
すごい constexpr たのしくレイトレ!
すごい constexpr たのしくレイトレ!すごい constexpr たのしくレイトレ!
すごい constexpr たのしくレイトレ!Genya Murakami
 
Python vs ruby
Python vs rubyPython vs ruby
Python vs rubyosamunmun
 
あなたの知らないnopたち@ラボユース合宿
あなたの知らないnopたち@ラボユース合宿あなたの知らないnopたち@ラボユース合宿
あなたの知らないnopたち@ラボユース合宿MITSUNARI Shigeo
 
シェルで繰り返し処理
シェルで繰り返し処理シェルで繰り返し処理
シェルで繰り返し処理Katsuya Tashiro
 
lispmeetup#63 Common Lispでゼロから作るDeep Learning
lispmeetup#63 Common Lispでゼロから作るDeep Learninglispmeetup#63 Common Lispでゼロから作るDeep Learning
lispmeetup#63 Common Lispでゼロから作るDeep LearningSatoshi imai
 
Mono is Dead
Mono is DeadMono is Dead
Mono is Deadmelpon
 
Python で munin plugin を書いてみる
Python で munin plugin を書いてみるPython で munin plugin を書いてみる
Python で munin plugin を書いてみるftnk
 
Ctb57 with god7
Ctb57 with god7Ctb57 with god7
Ctb57 with god7kingtomo
 
.NET Core 3.0時代のメモリ管理
.NET Core 3.0時代のメモリ管理.NET Core 3.0時代のメモリ管理
.NET Core 3.0時代のメモリ管理KageShiron
 
Landscape of Norikra features
Landscape of Norikra featuresLandscape of Norikra features
Landscape of Norikra featuresSATOSHI TAGOMORI
 
OCaml でデータ分析
OCaml でデータ分析OCaml でデータ分析
OCaml でデータ分析Akinori Abe
 
俺はUniRxで行く
俺はUniRxで行く俺はUniRxで行く
俺はUniRxで行くKakohiroyuki
 

Was ist angesagt? (20)

Effective Modern C++ 勉強会#3 Item 15
Effective Modern C++ 勉強会#3 Item 15Effective Modern C++ 勉強会#3 Item 15
Effective Modern C++ 勉強会#3 Item 15
 
ALPSチュートリアル(6) Matplotlib入門
ALPSチュートリアル(6) Matplotlib入門ALPSチュートリアル(6) Matplotlib入門
ALPSチュートリアル(6) Matplotlib入門
 
Testman
TestmanTestman
Testman
 
mrubyのfiberを試してみた
mrubyのfiberを試してみたmrubyのfiberを試してみた
mrubyのfiberを試してみた
 
すごい constexpr たのしくレイトレ!
すごい constexpr たのしくレイトレ!すごい constexpr たのしくレイトレ!
すごい constexpr たのしくレイトレ!
 
Python vs ruby
Python vs rubyPython vs ruby
Python vs ruby
 
あなたの知らないnopたち@ラボユース合宿
あなたの知らないnopたち@ラボユース合宿あなたの知らないnopたち@ラボユース合宿
あなたの知らないnopたち@ラボユース合宿
 
シェルで繰り返し処理
シェルで繰り返し処理シェルで繰り返し処理
シェルで繰り返し処理
 
lispmeetup#63 Common Lispでゼロから作るDeep Learning
lispmeetup#63 Common Lispでゼロから作るDeep Learninglispmeetup#63 Common Lispでゼロから作るDeep Learning
lispmeetup#63 Common Lispでゼロから作るDeep Learning
 
Mono is Dead
Mono is DeadMono is Dead
Mono is Dead
 
emcjp Item 42
emcjp Item 42emcjp Item 42
emcjp Item 42
 
Effective Java 輪読会 項目69-70
Effective Java 輪読会 項目69-70Effective Java 輪読会 項目69-70
Effective Java 輪読会 項目69-70
 
Python で munin plugin を書いてみる
Python で munin plugin を書いてみるPython で munin plugin を書いてみる
Python で munin plugin を書いてみる
 
Ctb57 with god7
Ctb57 with god7Ctb57 with god7
Ctb57 with god7
 
Subprocess no susume
Subprocess no susumeSubprocess no susume
Subprocess no susume
 
.NET Core 3.0時代のメモリ管理
.NET Core 3.0時代のメモリ管理.NET Core 3.0時代のメモリ管理
.NET Core 3.0時代のメモリ管理
 
Landscape of Norikra features
Landscape of Norikra featuresLandscape of Norikra features
Landscape of Norikra features
 
OCaml でデータ分析
OCaml でデータ分析OCaml でデータ分析
OCaml でデータ分析
 
俺はUniRxで行く
俺はUniRxで行く俺はUniRxで行く
俺はUniRxで行く
 
Ssaw08 0701
Ssaw08 0701Ssaw08 0701
Ssaw08 0701
 

Andere mochten auch

Instrucciones de instalación
Instrucciones de instalaciónInstrucciones de instalación
Instrucciones de instalaciónKriztian Vazks Vg
 
How to Make the Perfect Logo
How to Make the Perfect LogoHow to Make the Perfect Logo
How to Make the Perfect LogoFiverr
 
Digital Signage In Retail Chris Chen
Digital Signage In Retail   Chris ChenDigital Signage In Retail   Chris Chen
Digital Signage In Retail Chris ChenChen Peng
 
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014Rachel Metscher (@rachelmetscher)
 
Social Media Strategies for Entrepreneurs
Social Media Strategies for EntrepreneursSocial Media Strategies for Entrepreneurs
Social Media Strategies for EntrepreneursMarketingatBahrain
 
Social Media Strategies for College Bowl Games
Social Media Strategies for College Bowl GamesSocial Media Strategies for College Bowl Games
Social Media Strategies for College Bowl GamesGame Day Communications
 
Multi-touch Digital Signage
Multi-touch Digital Signage Multi-touch Digital Signage
Multi-touch Digital Signage Vellyslav Petrov
 
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...Elly Deutch Moody
 
Protein synthesis flip_book
Protein synthesis flip_bookProtein synthesis flip_book
Protein synthesis flip_bookpunxsyscience
 
Cloudaustin rundeck-docker
Cloudaustin rundeck-dockerCloudaustin rundeck-docker
Cloudaustin rundeck-dockerimrichar
 
Social Media Presentation Workshop for Professional Writers
Social Media Presentation Workshop for Professional WritersSocial Media Presentation Workshop for Professional Writers
Social Media Presentation Workshop for Professional WritersBARBARA ROZGONYI
 
Protein.synthesis.flipbook
Protein.synthesis.flipbookProtein.synthesis.flipbook
Protein.synthesis.flipbookpunxsyscience
 
Like a Virgin: The Ultimate User Experience
Like a Virgin: The Ultimate User ExperienceLike a Virgin: The Ultimate User Experience
Like a Virgin: The Ultimate User ExperienceTania Kasongo
 
Mau huong dan su dung thiet bi
Mau huong dan su dung thiet biMau huong dan su dung thiet bi
Mau huong dan su dung thiet biNhanOOtsctr
 
Ch09 (3) emerging markets
Ch09 (3) emerging marketsCh09 (3) emerging markets
Ch09 (3) emerging marketsSamira Khan
 
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)Geovanny García Filián
 
Kelsey: Digital Out of Home
Kelsey: Digital Out of HomeKelsey: Digital Out of Home
Kelsey: Digital Out of HomeBen Allen
 

Andere mochten auch (20)

Instrucciones de instalación
Instrucciones de instalaciónInstrucciones de instalación
Instrucciones de instalación
 
How to Make the Perfect Logo
How to Make the Perfect LogoHow to Make the Perfect Logo
How to Make the Perfect Logo
 
Digital Signage In Retail Chris Chen
Digital Signage In Retail   Chris ChenDigital Signage In Retail   Chris Chen
Digital Signage In Retail Chris Chen
 
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014
Social Media Strategy on a Budget: GSMI Social Media Strategies Summit 2014
 
Social Media Strategies for Entrepreneurs
Social Media Strategies for EntrepreneursSocial Media Strategies for Entrepreneurs
Social Media Strategies for Entrepreneurs
 
Social Media Strategies for College Bowl Games
Social Media Strategies for College Bowl GamesSocial Media Strategies for College Bowl Games
Social Media Strategies for College Bowl Games
 
Multi-touch Digital Signage
Multi-touch Digital Signage Multi-touch Digital Signage
Multi-touch Digital Signage
 
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...
Social Media Strategies Summit: How to Implement a Social Media Marketing Pla...
 
Protein synthesis flip_book
Protein synthesis flip_bookProtein synthesis flip_book
Protein synthesis flip_book
 
Cloudaustin rundeck-docker
Cloudaustin rundeck-dockerCloudaustin rundeck-docker
Cloudaustin rundeck-docker
 
Social Media Presentation Workshop for Professional Writers
Social Media Presentation Workshop for Professional WritersSocial Media Presentation Workshop for Professional Writers
Social Media Presentation Workshop for Professional Writers
 
Protein.synthesis.flipbook
Protein.synthesis.flipbookProtein.synthesis.flipbook
Protein.synthesis.flipbook
 
Doodle1
Doodle1Doodle1
Doodle1
 
Futbol sala
Futbol salaFutbol sala
Futbol sala
 
Aerva DOOH Brochure
Aerva DOOH BrochureAerva DOOH Brochure
Aerva DOOH Brochure
 
Like a Virgin: The Ultimate User Experience
Like a Virgin: The Ultimate User ExperienceLike a Virgin: The Ultimate User Experience
Like a Virgin: The Ultimate User Experience
 
Mau huong dan su dung thiet bi
Mau huong dan su dung thiet biMau huong dan su dung thiet bi
Mau huong dan su dung thiet bi
 
Ch09 (3) emerging markets
Ch09 (3) emerging marketsCh09 (3) emerging markets
Ch09 (3) emerging markets
 
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)
Modulo1 Búsqueda y Gestión de la Información en la Web (2.ª edición)
 
Kelsey: Digital Out of Home
Kelsey: Digital Out of HomeKelsey: Digital Out of Home
Kelsey: Digital Out of Home
 

Ähnlich wie Read egg oven

GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法博文 斉藤
 
中3女子が狂える本当に気持ちのいい constexpr
中3女子が狂える本当に気持ちのいい constexpr中3女子が狂える本当に気持ちのいい constexpr
中3女子が狂える本当に気持ちのいい constexprGenya Murakami
 
Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Ransui Iso
 
Replace Output Iterator and Extend Range JP
Replace Output Iterator and Extend Range JPReplace Output Iterator and Extend Range JP
Replace Output Iterator and Extend Range JPAkira Takahashi
 
Enumはデキる子 ~ case .Success(let value): ~
 Enumはデキる子 ~ case .Success(let value): ~ Enumはデキる子 ~ case .Success(let value): ~
Enumはデキる子 ~ case .Success(let value): ~Takaaki Tanaka
 
Constexpr 中3女子テクニック
Constexpr 中3女子テクニックConstexpr 中3女子テクニック
Constexpr 中3女子テクニックGenya Murakami
 
猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoder猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoderSho Tatsuno
 
Write good parser in perl
Write good parser in perlWrite good parser in perl
Write good parser in perlJiro Nishiguchi
 
ちゃんとWeb会議スライド『Coffee script』
ちゃんとWeb会議スライド『Coffee script』ちゃんとWeb会議スライド『Coffee script』
ちゃんとWeb会議スライド『Coffee script』H2O Space. Co., Ltd.
 
JavaScriptクイックスタート
JavaScriptクイックスタートJavaScriptクイックスタート
JavaScriptクイックスタートShumpei Shiraishi
 
Kink: invokedynamic on a prototype-based language
Kink: invokedynamic on a prototype-based languageKink: invokedynamic on a prototype-based language
Kink: invokedynamic on a prototype-based languageTaku Miyakawa
 
JDK 10 へようこそ
JDK 10 へようこそJDK 10 へようこそ
JDK 10 へようこそDavid Buck
 
ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3Masahiro Wakame
 
Swift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftSwift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftTomohiro Kumagai
 
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜How wonderful to be (statically) typed 〜型が付くってスバラシイ〜
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜Hiromi Ishii
 

Ähnlich wie Read egg oven (20)

GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法GNU awk (gawk) を用いた Apache ログ解析方法
GNU awk (gawk) を用いた Apache ログ解析方法
 
中3女子が狂える本当に気持ちのいい constexpr
中3女子が狂える本当に気持ちのいい constexpr中3女子が狂える本当に気持ちのいい constexpr
中3女子が狂える本当に気持ちのいい constexpr
 
Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6Lisp Tutorial for Pythonista Day 6
Lisp Tutorial for Pythonista Day 6
 
Replace Output Iterator and Extend Range JP
Replace Output Iterator and Extend Range JPReplace Output Iterator and Extend Range JP
Replace Output Iterator and Extend Range JP
 
Introduction to Spock
Introduction to SpockIntroduction to Spock
Introduction to Spock
 
Enumはデキる子 ~ case .Success(let value): ~
 Enumはデキる子 ~ case .Success(let value): ~ Enumはデキる子 ~ case .Success(let value): ~
Enumはデキる子 ~ case .Success(let value): ~
 
MoteMote Compiler Plugin
MoteMote Compiler PluginMoteMote Compiler Plugin
MoteMote Compiler Plugin
 
Constexpr 中3女子テクニック
Constexpr 中3女子テクニックConstexpr 中3女子テクニック
Constexpr 中3女子テクニック
 
猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoder猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoder
 
Write good parser in perl
Write good parser in perlWrite good parser in perl
Write good parser in perl
 
ちゃんとWeb会議スライド『Coffee script』
ちゃんとWeb会議スライド『Coffee script』ちゃんとWeb会議スライド『Coffee script』
ちゃんとWeb会議スライド『Coffee script』
 
JavaScriptクイックスタート
JavaScriptクイックスタートJavaScriptクイックスタート
JavaScriptクイックスタート
 
Phantom Type in Scala
Phantom Type in ScalaPhantom Type in Scala
Phantom Type in Scala
 
Kink: invokedynamic on a prototype-based language
Kink: invokedynamic on a prototype-based languageKink: invokedynamic on a prototype-based language
Kink: invokedynamic on a prototype-based language
 
Swiftおさらい
SwiftおさらいSwiftおさらい
Swiftおさらい
 
ALPSチュートリアル(1) ALPSの概要
ALPSチュートリアル(1) ALPSの概要ALPSチュートリアル(1) ALPSの概要
ALPSチュートリアル(1) ALPSの概要
 
JDK 10 へようこそ
JDK 10 へようこそJDK 10 へようこそ
JDK 10 へようこそ
 
ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3
 
Swift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswiftSwift 2.0 で変わったところ「後編」 #cswift
Swift 2.0 で変わったところ「後編」 #cswift
 
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜How wonderful to be (statically) typed 〜型が付くってスバラシイ〜
How wonderful to be (statically) typed 〜型が付くってスバラシイ〜
 

Mehr von Kohsuke Yuasa

オーディオ用レベルメータを作ってみよう
オーディオ用レベルメータを作ってみようオーディオ用レベルメータを作ってみよう
オーディオ用レベルメータを作ってみようKohsuke Yuasa
 
Juceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションJuceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションKohsuke Yuasa
 
C++ マルチスレッドプログラミング
C++ マルチスレッドプログラミングC++ マルチスレッドプログラミング
C++ マルチスレッドプログラミングKohsuke Yuasa
 
イマドキC++erのモテカワリソース管理術
イマドキC++erのモテカワリソース管理術イマドキC++erのモテカワリソース管理術
イマドキC++erのモテカワリソース管理術Kohsuke Yuasa
 
最近のC++ @ Sapporo.cpp #5
最近のC++ @ Sapporo.cpp #5最近のC++ @ Sapporo.cpp #5
最近のC++ @ Sapporo.cpp #5Kohsuke Yuasa
 
規格書で読むC++11のスレッド
規格書で読むC++11のスレッド規格書で読むC++11のスレッド
規格書で読むC++11のスレッドKohsuke Yuasa
 
C++ ポインタ ブートキャンプ
C++ ポインタ ブートキャンプC++ ポインタ ブートキャンプ
C++ ポインタ ブートキャンプKohsuke Yuasa
 
Introduction to boost test
Introduction to boost testIntroduction to boost test
Introduction to boost testKohsuke Yuasa
 
Sapporocpp#2 exception-primer
Sapporocpp#2 exception-primerSapporocpp#2 exception-primer
Sapporocpp#2 exception-primerKohsuke Yuasa
 

Mehr von Kohsuke Yuasa (11)

オーディオ用レベルメータを作ってみよう
オーディオ用レベルメータを作ってみようオーディオ用レベルメータを作ってみよう
オーディオ用レベルメータを作ってみよう
 
Juceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーションJuceで作るオーディオアプリケーション
Juceで作るオーディオアプリケーション
 
C++ マルチスレッドプログラミング
C++ マルチスレッドプログラミングC++ マルチスレッドプログラミング
C++ マルチスレッドプログラミング
 
イマドキC++erのモテカワリソース管理術
イマドキC++erのモテカワリソース管理術イマドキC++erのモテカワリソース管理術
イマドキC++erのモテカワリソース管理術
 
最近のC++ @ Sapporo.cpp #5
最近のC++ @ Sapporo.cpp #5最近のC++ @ Sapporo.cpp #5
最近のC++ @ Sapporo.cpp #5
 
規格書で読むC++11のスレッド
規格書で読むC++11のスレッド規格書で読むC++11のスレッド
規格書で読むC++11のスレッド
 
C++ ポインタ ブートキャンプ
C++ ポインタ ブートキャンプC++ ポインタ ブートキャンプ
C++ ポインタ ブートキャンプ
 
Introduction to boost test
Introduction to boost testIntroduction to boost test
Introduction to boost test
 
C++ template-primer
C++ template-primerC++ template-primer
C++ template-primer
 
Study3 boost
Study3 boostStudy3 boost
Study3 boost
 
Sapporocpp#2 exception-primer
Sapporocpp#2 exception-primerSapporocpp#2 exception-primer
Sapporocpp#2 exception-primer
 

Read egg oven

  • 1. PStade.OvenとEggを読む。 @hotwatermorning Boost.勉強会 #6 札幌
  • 3. はじめに。 ● この発表の主なターゲット
  • 4. はじめに。 ● この発表の主なターゲット ● 日常的にBoostを使ってる人or使われている人
  • 5. はじめに。 ● この発表の主なターゲット ● 日常的にBoostを使ってる人or使われている人 ● 日常的にPStade.Oven, PStade.Eggを使ってい る人
  • 6. はじめに。 ● この発表の主なターゲット ● 日常的にBoostを使ってる人or使われている人 ● 日常的にPStade.Oven, PStade.Eggを使ってい る人 ● EggやOvenの実装に興味がある人
  • 8. PStadeとは? ● Shunsuke Sogame氏によって開発された、 C++ Template Libraryです。 ● Biscuit Parser Library ● Ketchup Message Map Library ● Egg Functional Library ● Oven Range Library などが含まれています。
  • 9. PStadeとは? ● Shunsuke Sogame氏によって開発された、 C++ Template Libraryです。 ● Biscuit Parser Library ● Ketchup Message Map Library ● Egg Functional Library ● Oven Range Library ← 今日はこの2つを 取り上げます などが含まれています。
  • 10. PStade.Egg ● A framework of making function objects. “http://p-stade.sourceforge.net/” ● Egg is a small header-only framework of building functions, and offers higher-order functions. “Introduction” “http://p-stade.sourceforge.net/egg/doc/html/”
  • 11. PStade.Oven ● A Boost.Range Extension Library “http://p-stade.sourceforge.net/” ● Oven is an advanced implementation of Range Library Proposal “Introduction” “http://p-stade.sourceforge.net/oven/doc/html/”
  • 12. PStade.Oven ● そして、PStade.Ovenの実装には、PStade.Egg が使われています。 ● なので、Ovenを読もうと思うと、Eggを読む必 要がある。 ● 逆にEggを読めば、Ovenの理解も進みます。
  • 14. Ovenの使用例 namespace oven = pstade::oven; std::string const x = "ab123cde5f"; oven::copy( x | oven::filtered(isalpha) | oven::transformed(toupper), std::ostream_iterator<char>(std::cout) ); //outputs : ABCDEF
  • 15. Ovenの使用例 Range namespace oven = pstade::oven; std::string const x = "ab123cde5f"; oven::copy( x | oven::filtered(isalpha) | oven::transformed(toupper), std::ostream_iterator<char>(std::cout) ); //outputs : ABCDEF
  • 16. Range ● 何らかの値の列の範囲を表す物 ● 生配列, std::vector, std::list, std::map, boost::array, etc, … ● コンテナじゃなくても、例えば指定された範囲 の自然数列を返すcounting rangeなんてものも ある。
  • 17. Ovenの使用例 namespace oven = pstade::oven; std::string const x = "ab123cde5f"; oven::copy( Range Adaptor x | oven::filtered(isalpha) | oven::transformed(toupper), std::ostream_iterator<char>(std::cout) ); //outputs : ABCDEF
  • 18. Range Adaptor ● Iterator AdaptorのRange版 ● Rangeを横断しながら、値を変更したりスキッ プしたりして、元のRangeから別のRangeを返 す。 ● 遅延評価によって、実際にRangeの値が参照さ れるときに、その処理の間に入って働くため、 ● 元のRangeは変更しない。 ● 返されるRangeはいちいち元のRangeを全部コピー しているわけではない。 ● 計算量/空間量的にお得。
  • 19. Range Adaptor ● Range Adaptorはパイプ演算子でつなげていく ことが出来る。 range_ | adaptor1 | adaptor2 | … ● 効果が順次適用されていく
  • 20. Ovenの使用例 namespace oven = pstade::oven; std::string const x = "ab123cde5f"; oven::copy( x | oven::filtered(isalpha) Range Based Function | oven::transformed(toupper), std::ostream_iterator<char>(std::cout) ); //outputs : ABCDEF
  • 21. Range-Based Function ● STLのアルゴリズム(copy, sort, findなど)はイテ レータのbeginとendを引数に取る。 ● これはIterator-Based Functionと呼ばれる。 ● 使い勝手があんまりよくない。バグを埋めこん でしまう可能性も高い。 ● Iteratorのbeginとendをまとめたもの(=Range) を渡せるようにすればより使いやすい。
  • 22. Range-Based Function ● ここら辺については、 ● Exceptional C++ ● プログラミングの魔導書vol.1 ”オーブンレンジクッキング” ● プログラミングの魔導少女 “RangeとPStade.Oven” ● などなどに情報があります。
  • 24. Ovenの使用例 namespace oven = pstade::oven; std::string const x = "ab123cde5f"; oven::copy( x | oven::filtered(isalpha) | oven::transformed(toupper), std::ostream_iterator<char>(std::cout) ); //outputs : ABCDEF