C C T B H P N

Lecture #4 - Value Types

Creating user-defined value types

Web Resources:

CppCon - 2014, Going Native 2013
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
Excellent C++ Q&A, Excellent reference - CppReference.com, CPlusPlus.com, C++ TechLinks

Content:

This lecture discusses the notion of a Value Type, sometimes also referred to as an Abstract Data Type (ADT). We demonstrate how to use the C++ language to implement value types.
  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. The book C++ Primer Plus, by Stephen Prata, is now in the Sci-Tech library, on reserve, for your use. You will find this text very readable, with tons of small code fragments that show you how to do almost any basic operation you may need to do. You can not take this book home, but may use it in the library for several hours.
  3. Help Session this Friday:

    1st group at 9:00 am in CST 4-201, 2nd group at 10:30am
  4. Project #1

    Project #1 statement
    Note:
    you are required to demonstrate explicitly and conclusively that you meet all the requirements your code implements.
    Dissecting the Project #1 statement - What is hard? What is easy? Suggestions. Project code - Goals, Tasks, Structure, design trade-offs, C++ specific details. Recommended strategy:
    Define packages for at least the following:
    • Executive - manages demonstration of your work on Project #1
    • Converter
    • Display
    You will probably want to add packages for helper code from Project1HelpS2019, e.g.:
    • DirectoryExplorer
    • Process (to help show you meet requirements)
    Resources for Project #1:
  5. Class Relationships Class Relationships, Class and Object Diagram
  6. Value Types
    Value Types Presentation, pptx
    What does it take to make objects of your class behave like built in types? STR class
    This is a good example of a Value Type. It is presented as a nice example. You should prefer the std::string class for all your development work. C++ Operators pptx vector3D
    An example of an Value Type that is rich in operators. Shows the accepted style for building ADT classes with mathematical operations.
  7. Excellent C++ Q&A, Excellent reference - CppReference.com
    If you are only going to go to a couple of places to find information to supplement class texts and notes, then go here!
  8. first look at STL notes
    The Standard Template Library (STL) provides a set of useful containers, iterators, and algorithms. You can use the containers without knowing too much about how templates work. We will get to that soon. basic STL code demos
    Shows how easy it is to use vectors, lists, sets, and maps.
  9. Equivalent Syntaxes
    Shows how to call constructors in a variety of contexts.
  10. object layout
    Fundamental information about how objects work.
  11. Software Design
  12. These are the most important items from today's lecture:

    Value Types Presentation, pptx
    What does it take to make objects of your class behave like built in types? STR class
    This is a good example of a Value Type. It is presented to show how to build one. You should prefer the std::string class for all your development work.
CST strip