Lecture #23 - Standard Template Library (STL) - Details

Web Resources:

CppReference.com, CPlusPlus.com, C++ TechLinks
Going Native 2013 - many experts
Herb Sutter's Blog, Herb Sutter on C++11, Herb Sutter keynote - Going Native 2012
Scott Meyer's Blog, S.M. on thread suspension, S.M.: C++11 Sampler
Stroustrup's Home Page, Code Project, Boost Library

Content:

This lecture introduces the Standard Template Library (STL).
  1. Syllabus
    Describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  2. MTMU Help Sessions:

    • Friday, 4/28 at 10:30am in CST 4-201 (Project #4 help from 9:00am to 10:30am)
    • Friday, 5/5 at 9:00am in CST 4-201
  3. Projects:

    Project #4, Project4HelpS17
    Remote Code Publisher

    Project4HelpS17
    C++\CLI WPF client that sends and gets messages using native C++ mock channel.
    C# WPF client with C++\CLI shim that sends and gets messages using native C++ mock channel.
    Also included are several diagrams that illustrate design ideas for Project #4 and some sample Socket code.

    Communication Channel, vsdx
    Diagrams for Peer-To-Peer communication, Client and Server communication processing, and Message structure

    Mock Channel Demo, vsdx
    Diagram illustrating native C++ to C++\CLI interoperation for the Project #4 GUI via a mock demo.

    Note:
    Project #4 is due Tuesday, May 02. We will charge 1 point per day for Wednesday and Thursday. After Thursday midnight the late fee increases to 5 points per day. Also, after midnight Thursday, we will not count bonus points. This is necessary since we have a very short time to complete grading projects and submit course grades.
  4. Finishing STL Discussion

    STL Structure

    Lots of example code

    Removing Items from Containers

    STL Details

    STL Odds and Ends Presentation

    Calls to the operator() in Predicate Functors should not change the Functor's state .
    This is described in detail in the second required class text, "The C++ Standard Library", Second Edition, Josuttis,
    section 10.1.4, pages 483-486.

    Algorithms Demo

    std::shared_ptr<T>, std::unique_ptr<T>
    shared ownership and single owner pointers.

    XmlDocument uses std::shared_ptr<AbstractXmlElement>
  5. Unit and Regression Testing

    FileSystem Unit Testing
    This demo illustrates the use of a light-weight test harness to support unit test and maintenance.
  6. Design Principles:

  7. C++11 - new features

    Herb Sutter's excellent and brief overview from his Blog

    C++11 additions

    C++11 concurrency
    Threads, locks, condition variables, async, futures, promises, packaged_tasks, and atomics

    C++11 BlockingQueue
    Uses condition variable and mutex to build a queue that blocks deQers when empty.

    Str strings
    Demonstrates move constructor and move assignment.

    Component Reference Counting
    Demonstrates variadic templates and functions.

    Symbol Table
    Illustrates how using aliases are a great design tool. Also demonstrates range-based for loops.

    Chrono Timer
    Uses Chrono library to build a high resolution timer precise to about 100 nanoseconds.

    Callable Objects
    Demonstrates lambdas and compares them to function pointers and functors.

    Singleton
    Uses atomic.

    Uniform Initialization
    Illustrates use of uniform initialization for user defined types and STL containers.

  8. DLL Demo

  9. Other topics in the queue:
  10. Thinking about Software Design:

    Software Design
    Broad survey of ideas with examples
    Design Presentation
    Summarizes design issues for modules and classes.
    Design Guidelines
    Design rules and idioms that transcend Object Oriented Design.

    Design Summary

CST strip