c++kjlkljlkkl

Embed Size (px)

Citation preview

  • 7/23/2019 c++kjlkljlkkl

    1/13

    Click toMaster

    style06 | The C++ Standard Library, orSTL

    Kate Gregory | Gregory Consulting

    James Mcellis | Senior !ngineer, "isual C++

  • 7/23/2019 c++kjlkljlkkl

    2/13

    #hat are tem$lates%

    std&&'ector

    (se)ul )unctions, iterators

    Lambdas

    Learn once, use any*here

    Module 'er'ie*

  • 7/23/2019 c++kjlkljlkkl

    3/13

    Lesson & Tem$lates

    Work across types without giving up type sa

    Saves repetitive coding

    Work with fundamental types and user den

    All modern C++ developers usetemplates

    Not all write templates

    template

    T Add(T t1, T t2) { return t1 + t2; }

  • 7/23/2019 c++kjlkljlkkl

    4/13

    -!MTem$lates

  • 7/23/2019 c++kjlkljlkkl

    5/13

    Lesson .& std&&'ector

    A collection (container) of elements all of th

    type esi!es itself when you add more

    Works with ranged"for loop and a variety of and operators

  • 7/23/2019 c++kjlkljlkkl

    6/13

    -!Mstd&&'ector

  • 7/23/2019 c++kjlkljlkkl

    7/13

    Lesson /& (se)ul )unctions

    #eader les like $numeric% and $algorithm

    provide functions every&ody needs Saves writing your own loops to traverse a c

    Work with any container that supports itera

    An iterator is not a pointer' &ut it acts like on &egin() and end()

  • 7/23/2019 c++kjlkljlkkl

    8/13

    -!MSTL )unctions and iterators

  • 7/23/2019 c++kjlkljlkkl

    9/13

    Lesson & Lambdas

    ut code into a varia&le or pass it to a funct

    erfect for use with stdnd*if' stdcount*if

  • 7/23/2019 c++kjlkljlkkl

    10/13

    -!MLambdas

  • 7/23/2019 c++kjlkljlkkl

    11/13

    Lesson 1& Learn nce, (se 2ny*h

    he functions you,ve -ust learned work with

    container here is no need to learn di.erent names' p

    order or synta/ for di.erent kinds of collecti

    0on,t try to learn the whole S1 2 look thingwhen you need them

  • 7/23/2019 c++kjlkljlkkl

    12/13

    -!MLearn once, use any*here

  • 7/23/2019 c++kjlkljlkkl

    13/13

    3.0/ Microso)t Cor$oration4 2ll rights reser'ed4 Microso)t, #indo*s, 5ce, 2ure, System Center, -ynamics and other $roduct names atrademar7s and8or trademar7s in the (4S4 and8or other countries4 The in)ormation herein is )or in)ormational $ur$oses only and re$resent

    Microso)t Cor$oration as o) the date o) this $resentation4 9ecause Microso)t must res$ond to changing mar7et conditions, it should not becommitment on the $art o) Microso)t, and Microso)t cannot guarantee the accuracy o) any in)ormation $ro'ided a)ter the date o) this $resM2K!S #2;;2T:!S, !=>;!SS, :M>L:!- ; ST2T(T;?, 2S T T@! :;!S!T2T:4