Tenth step for Learning C++ Programming

Slides:



Advertisements
Similar presentations
Chapter 6 Queues and Deques.
Advertisements

SEG4110 – Advanced Software Design and Reengineering TOPIC J C++ Standard Template Library.
Brown Bag #2 Advanced C++. Topics  Templates  Standard Template Library (STL)  Pointers and Smart Pointers  Exceptions  Lambda Expressions  Tips.
Object Oriented Programming Lect. Dr. Daniel POP Universitatea de Vest din Timişoara Facultatea de Matematică şi Informatică.
. STL: C++ Standard Library (continued). STL Iterators u Iterators are allow to traverse sequences u Methods  operator*  operator->  operator++, and.
Exam Review 2 Chapter 5 – 9 CSC212 RS March 31, 2011, CS Dept, CCNY.
Quick Overview of STL STL = Standard Template Library Main concept : Container, Iterator Application : Linked list, Stack etc.
Object Oriented Data Structures
DATA STRUCTURES ACM EXECUTIVE BODY 2k11.  A series of elements of same type  Placed in contiguous memory locations  Can be individually referenced.
Data Structures Using C++ 2E
Containers Overview and Class Vector
C++ How to Program, 8/e © by Pearson Education, Inc. All Rights Reserved.
C++ STL CSCI 3110.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 18 Stacks and Queues.
Standard Template Library The Standard Template Library was recently added to standard C++. –The STL contains generic template classes. –The STL permits.
Introduction to the Standard Template Library (STL) A container class holds a number of similar objects. Examples: –Vector –List –Stack –Queue –Set –Map.
Lecture 7 : Intro. to STL (Standard Template Library)
Computer Science and Software Engineering University of Wisconsin - Platteville 11.Standard Template Library Yan Shi CS/SE 2630 Lecture Notes.
C++ Review STL CONTAINERS.
Exam Review 2 Chapter 5 – 9 CSC212 FG CS Dept, CCNY.
CSCI 383 Object-Oriented Programming & Design Lecture 25 Martin van Bommel.
Chapter 17 – Templates. Function Templates u Express general form for a function u Example: template for adding two numbers Lesson 17.1 template Type.
CSCI-383 Object-Oriented Programming & Design Lecture 30.
Copyright © Curt Hill STL Priority Queue A Heap-Like Adaptor Class.
1 The Standard Template Library The STL is a collection of Container classes These are class templates for containers. A container is an object that stores.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 18: Stacks and Queues.
Data Abstraction & Problem Solving with C++
18 Chapter Stacks and Queues
Chapter 18: Stacks and Queues.
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Regarding homework 9 Many low grades
C++ Programming Standard Template Library Homework 5,6,7.
C++ Templates.
Introduction to Custom Templates
Standard Template Library (STL)
Basic Data Structures.
ENERGY 211 / CME 211 Lecture 12 October 17, 2008.
STL Common tools for C++.
STACKS AND QUEUES UNIT 2 DS THROUGH C++.
ENERGY 211 / CME 211 Lecture 19 November 3, 2008.
Prof. Michael Neary Lecture 7: The STL Prof. Michael Neary
structures and their relationships." - Linus Torvalds
MIS Professor Sandvig MIS 324 Professor Sandvig
Basic Data Structures.
Abstract Data Types (ADTs)
Chapter 5 – 9 CSC212 AB April 03, CS Dept, CCNY
Chapter 5 – 9 CSC212 KL Nov 8, CS Dept, CCNY
Abstract Data Types Iterators Vector ADT Sections 3.1, 3.2, 3.3, 3.4
Chapter 19: Stacks and Queues.
structures and their relationships." - Linus Torvalds
Stacks, Queues, and Deques
Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors
Chapter 5 – 9 CSC212 RS April 08, CS Dept, CCNY
Templates. Templates Example: Swap Template Mechanism.
Introduction to Programming
Queues A first-in, first-out or FIFO data structure.
Containers and the Standard Template Library (STL)
MIS Professor Sandvig MIS 324 Professor Sandvig
Lecture 8 : Intro. to STL (Standard Template Library)
STL and Example.
Standard Template Library
Eleventh step for Learning C++ Programming
Queues cont. Chapter 8 © 2011 Pearson Addison-Wesley. All rights reserved.
Standard Template Library
CS 240 – Advanced Programming Concepts
Chapter 3 Lists, Stacks, and Queues
structures and their relationships." - Linus Torvalds
Abstract Data Types (ADTs)
Standard Template Library
Presentation transcript:

Tenth step for Learning C++ Programming Template Templates Specialization Type Inference Standard Template Library List Deque Iterator Map

Both forms are identical Template Declaration General form of Template declaration: template <class identifier> class_definition; or template <typename identifier> class_definition; Both forms are identical In the class definition identifier is some form of placeholder that can be used at positions, where we expect some type specification 11/2014

[ practice 1 Templates Specialization ]

[ explain 1 Templates Specialization ]

[ practice 2 Type Inference ]

[ explain 2 Type Inference ]

[ practice 3 Template, Auto & Decltype ]

[ explain 3 Template, Auto & Decltype ]

Sequence Container Overview Library Name Description Example <vector> A dynamic array STL-vector.cpp <list> randomly changing sequence of items STL-list.cpp <stack> A sequence of items with pop and push at one end only (LIFO) - <queue> A Sequence of items with pop and push at opposite ends (FIFO) <deque> Double Ended Queue with pop and push at both ends STL-deque.cpp

[ practice 4 Standard Template Library, List ]

[ explain 4 Standard Template Library, List ]

[ practice 5 Standard Template Library, Deque ]

[ explain 5 Standard Template Library, Deque ]

[ practice 6 Standard Template Library, Iterator ]

[ explain 6 Standard Template Library, Iterator ]

Associative Container Overview Library Name Description Example <set> An unordered collection of items - <map> An collection of pairs of items indexed by the first one STL-map.cpp <bitset> A subset of a fixed and small set of items (The class provides something like an array of bits / optimizing for space allocation )

[ practice 7 Standard Template Library, Map ]

[ explain 7 Standard Template Library, Map ]