The document discusses the history and development of C++ from its origins in 1979 to the present day C++11 standard. It covers key milestones like standardization in 1998 and 2003 and the addition of features from TR1 and Boost. The C++11 standard focused on improving performance, usability, safety and learnability while maintaining backwards compatibility. New features included move semantics to optimize copying, constant expressions, and standard library enhancements.
COMP08003 - Business Computer Networks - Overview of ModuleTom Caira
This document provides an overview of the Business Computer Networks module. The aims are to provide awareness of networking technology, terminology, and the benefits of networks for businesses. Learning outcomes include illustrating networking concepts and understanding networks' value. The module covers topics like network design, media, architectures, and security. Assessments include an exam and coursework assignment. Students are encouraged to study independently to fully understand the topics.
This document provides an introduction to programming fundamentals in Java. It begins by outlining the objectives of learning to identify basic Java program parts, differentiate data types and variables, and develop a simple Java program. It then analyzes a sample "Hello World" Java program line-by-line to illustrate program structure. The document continues by explaining Java coding guidelines, comments, statements, blocks, identifiers, keywords, literals, primitive data types, and how to declare and initialize variables in a sample program. The overall summary is that this document serves as an introductory guide to basic Java programming concepts.
Assembler is a kind of system software that translate mnemonic codes written in assembly language (which is, in turn, a low-level language) into its equivalent object code (which is, in turn, need to change into executable code by loader and linker)
The document outlines the structure of a C program, including documentation and header file sections, global variable declarations, the main function, user-defined functions, and comment lines. It notes that C programs typically include header files with file extensions of .h, global variables defined outside functions that can be accessed throughout the program, and that program execution starts and ends in the main function.
This presentation discusses control words for programming the ports of an 8255A integrated circuit. There are two types of control words: mode control words and bit set/reset control words. Mode control words are used to tell the device what mode the ports should operate in, such as setting port B as a mode 1 input and port A as a mode 0 output. An example is provided of constructing a mode control word with the binary value 8E hexadecimal to initialize an 8255A chip with specific port configurations. The IN and OUT instructions are also summarized for reading from and writing to ports in either fixed or variable port formats.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
Compiler Construction | Lecture 1 | What is a compiler?Eelco Visser
This document provides an overview of the CS4200 Compiler Construction course at TU Delft. It discusses the organization of the course into two parts: CS4200-A which covers compiler concepts and techniques through lectures, papers, and homework assignments; and CS4200-B which involves building a compiler for a subset of Java as a semester-long project. Key topics covered include the components of a compiler like parsing, type checking, optimization, and code generation; intermediate representations; and different types of compilers.
COMP08003 - Business Computer Networks - Overview of ModuleTom Caira
This document provides an overview of the Business Computer Networks module. The aims are to provide awareness of networking technology, terminology, and the benefits of networks for businesses. Learning outcomes include illustrating networking concepts and understanding networks' value. The module covers topics like network design, media, architectures, and security. Assessments include an exam and coursework assignment. Students are encouraged to study independently to fully understand the topics.
This document provides an introduction to programming fundamentals in Java. It begins by outlining the objectives of learning to identify basic Java program parts, differentiate data types and variables, and develop a simple Java program. It then analyzes a sample "Hello World" Java program line-by-line to illustrate program structure. The document continues by explaining Java coding guidelines, comments, statements, blocks, identifiers, keywords, literals, primitive data types, and how to declare and initialize variables in a sample program. The overall summary is that this document serves as an introductory guide to basic Java programming concepts.
Assembler is a kind of system software that translate mnemonic codes written in assembly language (which is, in turn, a low-level language) into its equivalent object code (which is, in turn, need to change into executable code by loader and linker)
The document outlines the structure of a C program, including documentation and header file sections, global variable declarations, the main function, user-defined functions, and comment lines. It notes that C programs typically include header files with file extensions of .h, global variables defined outside functions that can be accessed throughout the program, and that program execution starts and ends in the main function.
This presentation discusses control words for programming the ports of an 8255A integrated circuit. There are two types of control words: mode control words and bit set/reset control words. Mode control words are used to tell the device what mode the ports should operate in, such as setting port B as a mode 1 input and port A as a mode 0 output. An example is provided of constructing a mode control word with the binary value 8E hexadecimal to initialize an 8255A chip with specific port configurations. The IN and OUT instructions are also summarized for reading from and writing to ports in either fixed or variable port formats.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
Compiler Construction | Lecture 1 | What is a compiler?Eelco Visser
This document provides an overview of the CS4200 Compiler Construction course at TU Delft. It discusses the organization of the course into two parts: CS4200-A which covers compiler concepts and techniques through lectures, papers, and homework assignments; and CS4200-B which involves building a compiler for a subset of Java as a semester-long project. Key topics covered include the components of a compiler like parsing, type checking, optimization, and code generation; intermediate representations; and different types of compilers.
How to become a Chartered Structural Engineer (CEng MIStructE)? Nabil Shouki Otrie
The document discusses the process for becoming a Chartered Structural Engineer (CEng MIStructE) in the UK. It involves obtaining a professional qualification as a Chartered Engineer (CEng) and becoming a Chartered Member of the Institution of Structural Engineers (IStructE). The process includes completing academic requirements, gaining work experience through initial professional development meeting 13 core objectives, and passing the IStructE professional review which includes an interview and exam. The core objectives cover personal, engineering, and management/commercial competencies required at various minimum standards.
This document provides an introduction and overview of the Java programming language. It discusses that Java was developed by Sun Microsystems in the 1990s as a general-purpose, object-oriented language designed for easy web and internet applications. The key principles of object-oriented programming like encapsulation, inheritance, and polymorphism are explained. Characteristics of Java like being simple, secure, portable, and having good performance are highlighted. A brief history of Java's development is also presented.
Chapter1 c programming data types, variables and constantsvinay arora
The document discusses key concepts in C programming including:
- C is a general-purpose, procedural, portable programming language developed by Dennis Ritchie.
- Data types in C include integer, floating point, character, and string literals. Variables and constants can be declared with different data types.
- Variables store values that can change during program execution while constants store fixed values. Variables have both l-values and r-values but constants only have r-values.
- Comments, preprocessor directives, functions, and standard input/output are basic elements of a C program structure.
The document introduces flowcharting and flowchart symbols. It defines a flowchart as a graphical representation of a process or program showing the steps as boxes of different shapes linked with arrows. The basic symbols are terminals (rounded rectangles for start/end), input/output operations (parallelograms), and processes (rectangles). An example flowchart calculates an employee's pay. There are four common structures: sequence, decision, repetition, and case. Connectors are used to split long flowcharts across pages.
Lecture 2 C++ | Variable Scope, Operators in c++Himanshu Kaushik
The document discusses variable scope and operators in C++. It explains that variables can have local, global, or formal parameter scope depending on where they are declared. Local variables are only accessible within the block they are declared in, while global variables can be accessed anywhere. It then provides examples of various arithmetic, relational, logical, and bitwise operators in C++ and shows how to use assignment operators.
This document contains a C programming assignment submitted by Vijayananda D Mohire for their Post Graduate Diploma in Information Technology. The assignment contains 11 questions on basic C programming concepts like data types, variables, functions, structures, file handling etc. For each question, the code for the algorithm/program is provided as the answer. The questions cover topics like checking odd/even numbers, calculating sum of numbers, interest calculation, number divisibility, swapping values, month to word conversion using switch case, structure to store employee data, reading and writing to files.
Comparison of results from Sap2000, Etabs, & Abaqus.Pramod Rai
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
The document contains code snippets and flowcharts for C programming problems including calculating the area of a triangle, finding the average of three numbers, checking if a number is less than 10, converting Celsius to Fahrenheit, solving a quadratic equation, checking if a year is a leap year, swapping values of two variables, adding and multiplying matrices, adding numbers, finding the largest of three numbers using arrays, printing numbers using do-while and while loops, finding the largest and smallest of three numbers, adding two numbers with call by value, evaluating factorial without and with recursion.
This document discusses control structures in Swift, including branching/selection statements like if, else if, switch statements; looping/iteration statements like for-in, while, repeat-while loops; and jumping statements like break, continue. It provides examples of how to use each statement type and explains their syntax and usage. Key control structures covered are if/else, switch, for-in, while and repeat-while loops, and the break, continue, and fallthrough statements.
This powerpoint contains lessons about on how to read multimeter, on how to compute wire resistivity and also formula for computing current,volt and resistance
The document discusses C++ as a programming language. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language. Many major software and applications are written in C++, including Google Chrome, Mozilla Firefox, MySQL, Autodesk Maya 3D software, and parts of Apple's OS X and Microsoft Windows operating systems. The document also provides quotes from programmers about C++, both positive and negative. It notes that C++ is one of the most popular and widely used programming languages due to its use in systems software, applications, device drivers, embedded software, servers, clients, and games.
This slide notes are more than 10 years old of my teacher Mr Karim Zebari. He uses a brilliant simple language to explain programming principles step by step.
Complete C++ programming Language CourseVivek chan
This document provides an overview of topics covered in a C++ programming course, including:
- Introduction to C++ language fundamentals like data types, variables, operators, control structures, functions, and classes
- Memory concepts, arithmetic, decision making, and algorithms
- Structured and object-oriented programming principles
- The basics of the C++ environment like compilers, linkers, and input/output streams
- Common library functions and concepts like headers, prototypes, and enumerations
The document serves as an introductory reference for anyone learning C++ or wanting to understand the basic building blocks of the language.
C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low-level memory manipulation.
It is designed with a bias toward system programming (e.g., for use in embedded systems or operating system kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also been found useful in many other contexts, including desktop applications, servers (e.g. e-commerce, web search or SQL servers), performance-critical applications (e.g. telephone switches or space probes), and entertainment software. C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft and Intel.
This document provides an introduction and overview for a course on programming in C++. It discusses the goals of the course, which are to teach programming principles and the C++ language. Students will learn essential concepts like variables, data types, functions, and arrays. They will write increasingly complex programs and develop good programming style. The course will be assessed through quizzes, exams, and class projects. Topics to be covered include variables, input/output, control flow, arrays, pointers, strings, and file I/O. Good programming practices like readability, simplicity, and avoiding reinventing solutions are emphasized.
This document provides an introduction to C++ for Java developers. It discusses the C++ standard and standard library, which includes containers, strings, input/output streams, and other functionality. It also covers installing compilers like GCC, compiling and running simple C++ programs, code style, using Makefiles, and includes examples of basic C++ syntax like output, input, datatypes, and strings.
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
ANSI ISO C Professional Programmer S HandbookNicole Heredia
This chapter introduces the ANSI/ISO C++ Professional Programmer's Handbook. It discusses:
1. The origins of C++, which began in the late 1970s as an extension of C to support object-oriented programming.
2. The establishment of the ANSI committee in 1989 to standardize C++. This involved adopting an existing reference as a baseline and allowing the language to mature through feedback from users.
3. An overview of the book's contents, including discussions of language features like templates and exceptions, object-oriented design, and compatibility with C. The target audience is experienced C++ programmers.
The Standard Template Library (STL) was created by Alexander Stepanov in 1979 as the first library of generic algorithms and data structures for C++. It uses templates to provide compile-time polymorphism and efficiency. In 1998, the C++ standards committee published C++98, which included the STL. The STL achieves abstraction without loss of efficiency through its use of templates and by following the Von Neumann model of computation. It includes containers, algorithms, and I/O stream libraries.
The document discusses the evolution of several programming languages from 1960 to present. It describes the origins and developers of languages like ALGOL (1960), BCPL (1967), B (1970), C (1972), C++ (1979), Java (1995), and Python (1991). Each new language built upon features of prior languages and was influenced by the needs of the time. The document also provides brief overviews of the advantages and disadvantages of several languages like C, C++, Java, and Python.
This document provides an overview of graphics programming in C++ using the G3D library. It discusses that C++ is widely used for computer graphics and combines low-level and high-level features. It also introduces the G3D library, which is an open source cross-platform library for 3D graphics that handles much of the complex infrastructure. The document then provides tips for programmers with Java experience on some key differences between C++ and Java and aspects of C++ they should be aware of for graphics programming.
The document discusses principles of writing good C++ code. It begins by criticizing existing code examples as "ghastly style" that are difficult to understand and maintain. It advocates for a type-rich interface style with compact data structures and well-structured algorithms. The document also emphasizes writing code with modularity, effective resource management, and thread safety by default. The presentation provides examples demonstrating these principles using C++11 features like auto, type aliases, and literals.
How to become a Chartered Structural Engineer (CEng MIStructE)? Nabil Shouki Otrie
The document discusses the process for becoming a Chartered Structural Engineer (CEng MIStructE) in the UK. It involves obtaining a professional qualification as a Chartered Engineer (CEng) and becoming a Chartered Member of the Institution of Structural Engineers (IStructE). The process includes completing academic requirements, gaining work experience through initial professional development meeting 13 core objectives, and passing the IStructE professional review which includes an interview and exam. The core objectives cover personal, engineering, and management/commercial competencies required at various minimum standards.
This document provides an introduction and overview of the Java programming language. It discusses that Java was developed by Sun Microsystems in the 1990s as a general-purpose, object-oriented language designed for easy web and internet applications. The key principles of object-oriented programming like encapsulation, inheritance, and polymorphism are explained. Characteristics of Java like being simple, secure, portable, and having good performance are highlighted. A brief history of Java's development is also presented.
Chapter1 c programming data types, variables and constantsvinay arora
The document discusses key concepts in C programming including:
- C is a general-purpose, procedural, portable programming language developed by Dennis Ritchie.
- Data types in C include integer, floating point, character, and string literals. Variables and constants can be declared with different data types.
- Variables store values that can change during program execution while constants store fixed values. Variables have both l-values and r-values but constants only have r-values.
- Comments, preprocessor directives, functions, and standard input/output are basic elements of a C program structure.
The document introduces flowcharting and flowchart symbols. It defines a flowchart as a graphical representation of a process or program showing the steps as boxes of different shapes linked with arrows. The basic symbols are terminals (rounded rectangles for start/end), input/output operations (parallelograms), and processes (rectangles). An example flowchart calculates an employee's pay. There are four common structures: sequence, decision, repetition, and case. Connectors are used to split long flowcharts across pages.
Lecture 2 C++ | Variable Scope, Operators in c++Himanshu Kaushik
The document discusses variable scope and operators in C++. It explains that variables can have local, global, or formal parameter scope depending on where they are declared. Local variables are only accessible within the block they are declared in, while global variables can be accessed anywhere. It then provides examples of various arithmetic, relational, logical, and bitwise operators in C++ and shows how to use assignment operators.
This document contains a C programming assignment submitted by Vijayananda D Mohire for their Post Graduate Diploma in Information Technology. The assignment contains 11 questions on basic C programming concepts like data types, variables, functions, structures, file handling etc. For each question, the code for the algorithm/program is provided as the answer. The questions cover topics like checking odd/even numbers, calculating sum of numbers, interest calculation, number divisibility, swapping values, month to word conversion using switch case, structure to store employee data, reading and writing to files.
Comparison of results from Sap2000, Etabs, & Abaqus.Pramod Rai
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive functioning. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
The document contains code snippets and flowcharts for C programming problems including calculating the area of a triangle, finding the average of three numbers, checking if a number is less than 10, converting Celsius to Fahrenheit, solving a quadratic equation, checking if a year is a leap year, swapping values of two variables, adding and multiplying matrices, adding numbers, finding the largest of three numbers using arrays, printing numbers using do-while and while loops, finding the largest and smallest of three numbers, adding two numbers with call by value, evaluating factorial without and with recursion.
This document discusses control structures in Swift, including branching/selection statements like if, else if, switch statements; looping/iteration statements like for-in, while, repeat-while loops; and jumping statements like break, continue. It provides examples of how to use each statement type and explains their syntax and usage. Key control structures covered are if/else, switch, for-in, while and repeat-while loops, and the break, continue, and fallthrough statements.
This powerpoint contains lessons about on how to read multimeter, on how to compute wire resistivity and also formula for computing current,volt and resistance
The document discusses C++ as a programming language. It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language. Many major software and applications are written in C++, including Google Chrome, Mozilla Firefox, MySQL, Autodesk Maya 3D software, and parts of Apple's OS X and Microsoft Windows operating systems. The document also provides quotes from programmers about C++, both positive and negative. It notes that C++ is one of the most popular and widely used programming languages due to its use in systems software, applications, device drivers, embedded software, servers, clients, and games.
This slide notes are more than 10 years old of my teacher Mr Karim Zebari. He uses a brilliant simple language to explain programming principles step by step.
Complete C++ programming Language CourseVivek chan
This document provides an overview of topics covered in a C++ programming course, including:
- Introduction to C++ language fundamentals like data types, variables, operators, control structures, functions, and classes
- Memory concepts, arithmetic, decision making, and algorithms
- Structured and object-oriented programming principles
- The basics of the C++ environment like compilers, linkers, and input/output streams
- Common library functions and concepts like headers, prototypes, and enumerations
The document serves as an introductory reference for anyone learning C++ or wanting to understand the basic building blocks of the language.
C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low-level memory manipulation.
It is designed with a bias toward system programming (e.g., for use in embedded systems or operating system kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also been found useful in many other contexts, including desktop applications, servers (e.g. e-commerce, web search or SQL servers), performance-critical applications (e.g. telephone switches or space probes), and entertainment software. C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft and Intel.
This document provides an introduction and overview for a course on programming in C++. It discusses the goals of the course, which are to teach programming principles and the C++ language. Students will learn essential concepts like variables, data types, functions, and arrays. They will write increasingly complex programs and develop good programming style. The course will be assessed through quizzes, exams, and class projects. Topics to be covered include variables, input/output, control flow, arrays, pointers, strings, and file I/O. Good programming practices like readability, simplicity, and avoiding reinventing solutions are emphasized.
This document provides an introduction to C++ for Java developers. It discusses the C++ standard and standard library, which includes containers, strings, input/output streams, and other functionality. It also covers installing compilers like GCC, compiling and running simple C++ programs, code style, using Makefiles, and includes examples of basic C++ syntax like output, input, datatypes, and strings.
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
ANSI ISO C Professional Programmer S HandbookNicole Heredia
This chapter introduces the ANSI/ISO C++ Professional Programmer's Handbook. It discusses:
1. The origins of C++, which began in the late 1970s as an extension of C to support object-oriented programming.
2. The establishment of the ANSI committee in 1989 to standardize C++. This involved adopting an existing reference as a baseline and allowing the language to mature through feedback from users.
3. An overview of the book's contents, including discussions of language features like templates and exceptions, object-oriented design, and compatibility with C. The target audience is experienced C++ programmers.
The Standard Template Library (STL) was created by Alexander Stepanov in 1979 as the first library of generic algorithms and data structures for C++. It uses templates to provide compile-time polymorphism and efficiency. In 1998, the C++ standards committee published C++98, which included the STL. The STL achieves abstraction without loss of efficiency through its use of templates and by following the Von Neumann model of computation. It includes containers, algorithms, and I/O stream libraries.
The document discusses the evolution of several programming languages from 1960 to present. It describes the origins and developers of languages like ALGOL (1960), BCPL (1967), B (1970), C (1972), C++ (1979), Java (1995), and Python (1991). Each new language built upon features of prior languages and was influenced by the needs of the time. The document also provides brief overviews of the advantages and disadvantages of several languages like C, C++, Java, and Python.
This document provides an overview of graphics programming in C++ using the G3D library. It discusses that C++ is widely used for computer graphics and combines low-level and high-level features. It also introduces the G3D library, which is an open source cross-platform library for 3D graphics that handles much of the complex infrastructure. The document then provides tips for programmers with Java experience on some key differences between C++ and Java and aspects of C++ they should be aware of for graphics programming.
The document discusses principles of writing good C++ code. It begins by criticizing existing code examples as "ghastly style" that are difficult to understand and maintain. It advocates for a type-rich interface style with compact data structures and well-structured algorithms. The document also emphasizes writing code with modularity, effective resource management, and thread safety by default. The presentation provides examples demonstrating these principles using C++11 features like auto, type aliases, and literals.
This is a talk I gave to my Research Group about C++11/C++14.
Since many of our students know little about C++, I decided to refresh their knowledge of C++ and to teach them about the C++11 modern features.
This document provides an overview and introduction to programming graphics in C++ using the G3D library for a course at Williams College. It discusses key differences between C++ and Java, how to compile and debug C++ programs, C++ concepts like inheritance, and how G3D handles memory management to avoid manually allocating and freeing memory. The document is intended as a starting guide for programmers familiar with Java but new to C++ and 3D graphics.
This document provides an overview of SFrame, a scalable dataframe for machine learning developed by Dato. SFrame was created to handle large datasets and enable fast machine learning. It uses a columnar storage format and lazy evaluation to optimize performance. SFrame can handle datasets with billions of rows and columns efficiently using its out-of-core design. It also includes an SGraph extension to handle graph analytics on very large graphs with billions of edges. A variety of machine learning algorithms are built on SFrame to leverage its scalability.
Flink Forward Berlin 2017: Andreas Kunft - Efficiently executing R Dataframes...Flink Forward
This document discusses providing an R dataframe abstraction for efficient distributed computation on Apache Flink. The goals are to provide a natural API for R and achieve performance comparable to Flink's native dataflow. The approach represents R dataframes as Flink data sets and compiles R functions into the native execution plan where possible. For user-defined R functions, they are evaluated within worker tasks using a just-in-time compiler. This allows executing R code within the same Java virtual machine as Flink for good performance, even on a single node. Results show it can achieve native Flink performance even for functions containing R code.
Ryan Curtin, Principal Research Scientist, Symantec at MLconf ATL 2016MLconf
mlpack: Or, How I Learned To Stop Worrying and Love C++: mlpack is a cutting-edge C++ machine learning library containing fast implementations of both standard machine learning algorithms and recently-published algorithms. In this talk, I will introduce mlpack, its design philosophy, and discuss how C++ is helpful for making implementations fast, as well as the pros and cons of C++ as a language choice. I will briefly review the capabilities of mlpack, then focus on mlpack’s flexibility by demonstrating the k-means clustering code (and maybe some other algorithms too, like nearest neighbor search), and how it might be used in a production environment. The project website can be found at http://www.mlpack.org/.
The document summarizes the history of the C++ programming language. It describes how C++ was created in 1979 by Bjarne Stroustrup as an enhancement to the C language by adding object-oriented programming features like classes, inheritance, and polymorphism. Key events included the first commercial C++ release in 1985, standardization efforts in 1998 and later updates, and the addition of new features over time that expanded the language's capabilities. C++ has evolved into a widely used general-purpose programming language.
Python has grown in popularity among employers and developers in recent years. It is now the fourth most popular language according to employer needs and ranks fourth in developer activity. Python was created by Guido van Rossum and emphasizes readability through its relatively complete style guidelines and "Pythonic" idioms. It is designed to have one obvious way to do things and prioritizes readability in its "Zen of Python" principles. Python is a multi-purpose language that is highly flexible and can be used for web development, scientific computing, statistical analysis, machine learning, database interaction, and artificial intelligence.
C was created by Dennis Ritchie at Bell Labs in 1972. C++ was created by Bjarne Stroustrup at Bell Labs in 1980 as an extension of C to support object-oriented programming. Both C and C++ originated at Bell Labs and were influenced by earlier languages like ALGOL and BCPL. C supports procedural programming while C++ supports both procedural and object-oriented programming.
The new standard for C++ language has been signed in 2011. This new (extended) language, called C++11, has a number of new semantics (in terms of language constructs) and a number of new standard library support. The major language extensions are discussed in this presentation. The library will be taken up in a later presentation.
C++ evolved from earlier languages like CPL, BCPL, B, and C. It was created by Bjarne Stroustrup at Bell Labs in 1983 to add object-oriented programming capabilities to C while still maintaining compatibility with C. C++ is a general purpose programming language that combines high-level and low-level language features, allowing programmers to write comprehensive code organized into modules and objects.
Event description:
Why Tangent Works chooses Julia: The Two Language Problem
TIM: Automatic Model Building for Energy Industry
Julia and its major differences to other technical computing languages (R, Matlab, ...)
- Why is vectorized code fast?
- Why is it not as fast as it could be?
Speaker:
Ján Dolinský, Tangent Works (www.tangent.works)
Language of the event: Julia, Slovak & English
------------------------------------
PyData Bratislava [Python Data Enthusiasts and Users, Data Scientists & Statisticians of all levels from Slovakia]
------------------------------------
--
This meetup group is for Data Scientists, Statisticians, Economists and Data Enthusiasts using Python for data analysis and data visualization. The goals are to provide Python enthusiasts a place to share ideas and learn from each other about how best to apply the language and tools to ever-evolving challenges in the vast realm of data management, processing, analytics, and visualization.
--
PyData is a group for users and developers of data analysis tools to share ideas and learn from each other. We gather to discuss how best to apply Python tools, as well as those using R and Julia, to meet the evolving challenges in data management, processing, analytics, and visualization. PyData groups, events, and conferences aim to provide a venue for users acrossall the various domains of data analysis to share their experiences and their techniques. PyData is organized by NumFOCUS.org, a 501(c)3 non-profit in the United States.
------------------------------------
Our Facebook group here: https://www.facebook.com/groups/1813599648877946/
Our Twitter account here: https://twitter.com/PyDataBA
Our LinkedIn group here: https://www.linkedin.com/groups/13506080
All materials from previous meetups on GitHub here: https://github.com/GapData/PyDataBratislava
Recordings of previous meetups on our YouTube here: https://www.youtube.com/watch?v=XYpKpmapqjI&list=PLISV6olKXnd9pE-KPtPgwwLe6qPXvb9K7
------------------------------------
Organizers:
GapData Institute (https://www.gapdata.org/) (GDI) is a nonprofit nonpartisan research institution harnessing power of data & wisdom of economics for public good.
|| Data. Think. Change. ||
--
NumFOCUS (http://www.numfocus.org/) is a 501(c)(3) nonprofit that supports and promotes world-class, innovative, open source scientific computing. The mission of NumFOCUS is to promote sustainable high-level programming languages, open code development, and reproducible scientific research. We accomplish this mission through our educational programs and events as well as through fiscal sponsorship of open source data science projects. We aim to increase collaboration and communication within the scientific computing community.
The document discusses the evolution of several programming languages from BCPL to Python. It describes how BCPL was developed in 1967 and influenced the creation of the B language in 1970. The B language then influenced the development of C in 1972. The document outlines the major versions of C and C++ and describes how Java was influenced by C and C++. Finally, it discusses the origins and evolution of Python from 1991 onward.
The presentation includes brief insight of mostly all important OOPs concepts including Exception Handling, File Handling, Dynamic Memory Allocation, Storage Classes, Namespaces, and Generic Programming.
This document provides an overview of key differences between C and C++. It discusses how C++ was designed to be compatible with C but adds features like classes, templates, and exceptions. It notes some common C constructs like function prototypes, printf/scanf, arrays, strings, memory management with malloc/free, macros, and const that have equivalents but sometimes subtle differences in C++. The document aims to help C++ programmers understand how to program in C when needed.
A relatively short Introduction to R as presented at the Belgian Software Craftmanship meetup group.
The goal of this presentation is to give you an introduction to:
• The style of the language
• It's ecosystem
• How common things like data manipulation and visualization work
• How to use it for machine learning
• Webdevelopment and report generation in R
• Integrating R in your system
License:
Introduction To R by Samuel Bosch
To the extent possible under law, the person who associated CC0 with Introduction To R has waived all copyright and related or neighboring rights
to Introduction To R.
http://creativecommons.org/publicdomain/zero/1.0/
Similar to 20130110 prs presentation ncim c++ 11 (20)
1. C++ 11
Ralph Langendam
NCIM-Groep
Januari 9th, 2013
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 1 / 39
2. Overview
Anonymous functions
1 Timeline
Override and Final
History
Alias templates
Present and Future
Enumerations and Unions
2 C++11 Development 5 New functionality
Directives Variadic templates
Enhancement categories Defaulted and deleted special
3 Run-time performance methods
enhancements 6 Standard library enhancements
Move semantics Threading facilities
Constant expression Smart pointers
4 Usability enhancements Type traits
Static assertions 7 Compiler support
Type inference 8 Further reading
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 2 / 39
3. Timeline
Outline
1 Timeline
History
Present and Future
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
6 Standard library enhancements
7 Compiler support
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 3 / 39
4. Timeline History
History
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
5. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
6. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
7. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
8. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
9. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
1990 Publication of The Annotated C++ Reference Manual,
Borland Turbo C++.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
10. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
1990 Publication of The Annotated C++ Reference Manual,
Borland Turbo C++.
1998 Standardization by ISO (C++98) and development of STL.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
11. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
1990 Publication of The Annotated C++ Reference Manual,
Borland Turbo C++.
1998 Standardization by ISO (C++98) and development of STL.
2003 C++03
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
12. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
1990 Publication of The Annotated C++ Reference Manual,
Borland Turbo C++.
1998 Standardization by ISO (C++98) and development of STL.
2003 C++03
2005 TR1 with features for C++0x.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
13. Timeline History
History
≈ 1979 C with classes (CFront): C, classes, inheritance, inline,
default argument values, strong type checking.
1983 C++ : exceptions, virtual functions, function overloading,
const, references, comment (//).
1985 Publication of Bjarne Stroustrup - The C++ Programming
Language.
1989 protected and static members.
1990 Publication of The Annotated C++ Reference Manual,
Borland Turbo C++.
1998 Standardization by ISO (C++98) and development of STL.
2003 C++03
2005 TR1 with features for C++0x.
2011 C++11
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
14. Timeline Present and Future
Present and Future
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
15. Timeline Present and Future
Present and Future
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
16. Timeline Present and Future
Present and Future
The Boost library project was a large source of inspiration to TR1.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
17. Timeline Present and Future
Present and Future
The Boost library project was a large source of inspiration to TR1.
Nowadays Boost is the main incubator for new C++ features.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
18. Timeline Present and Future
Present and Future
The Boost library project was a large source of inspiration to TR1.
Nowadays Boost is the main incubator for new C++ features.
Bugfixes for C++14.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
19. Timeline Present and Future
Present and Future
The Boost library project was a large source of inspiration to TR1.
Nowadays Boost is the main incubator for new C++ features.
Bugfixes for C++14.
TR2 for C++17.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
20. C++11 Development
Outline
1 Timeline
2 C++11 Development
Directives
Enhancement categories
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
6 Standard library enhancements
7 Compiler support
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 6 / 39
21. C++11 Development Directives
Directives
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
22. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
23. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
24. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Focus on programming techniques, systems and library design.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
25. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Focus on programming techniques, systems and library design.
Increase type safety.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
26. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Focus on programming techniques, systems and library design.
Increase type safety.
Increase performance and ability to work directly with hardware.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
27. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Focus on programming techniques, systems and library design.
Increase type safety.
Increase performance and ability to work directly with hardware.
Implement the zero overhead principle.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
28. C++11 Development Directives
Directives
Backwards compatibility with C++98 and C.
Extend primarily through STL and less through C++ core language.
Focus on programming techniques, systems and library design.
Increase type safety.
Increase performance and ability to work directly with hardware.
Implement the zero overhead principle.
Make C++ easier to learn.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
29. C++11 Development Enhancement categories
Enhancement categories
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
30. C++11 Development Enhancement categories
Enhancement categories
Run-time performance enhancements
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
31. C++11 Development Enhancement categories
Enhancement categories
Run-time performance enhancements
Build-time performance enhancements
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
32. C++11 Development Enhancement categories
Enhancement categories
Run-time performance enhancements
Build-time performance enhancements
Usability enhancements
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
33. C++11 Development Enhancement categories
Enhancement categories
Run-time performance enhancements
Build-time performance enhancements
Usability enhancements
New functionality
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
34. C++11 Development Enhancement categories
Enhancement categories
Run-time performance enhancements
Build-time performance enhancements
Usability enhancements
New functionality
Standard library enhancements
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
35. Run-time performance enhancements
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
Move semantics
Constant expression
4 Usability enhancements
5 New functionality
6 Standard library enhancements
7 Compiler support
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 9 / 39
37. Run-time performance enhancements Move semantics
R-value references
C++ distinguishes between l-values and r-values.
int l ;
l = 3 // Assign r - value 3 to l - value l
4 = l // Error : 4 is not an l - value
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
38. Run-time performance enhancements Move semantics
R-value references
C++ distinguishes between l-values and r-values.
int l ;
l = 3 // Assign r - value 3 to l - value l
4 = l // Error : 4 is not an l - value
Now, consider
int PlusOne ( int n ) {
return n +1;
}
int result ( PlusOne (3+4) ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
39. Run-time performance enhancements Move semantics
R-value references
C++ distinguishes between l-values and r-values.
int l ;
l = 3 // Assign r - value 3 to l - value l
4 = l // Error : 4 is not an l - value
Now, consider
int PlusOne ( int n ) {
return n +1;
}
int result ( PlusOne (3+4) ) ;
1 3+4 is evaluated and copied to a new int n (7) in PlusOne.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
40. Run-time performance enhancements Move semantics
R-value references
C++ distinguishes between l-values and r-values.
int l ;
l = 3 // Assign r - value 3 to l - value l
4 = l // Error : 4 is not an l - value
Now, consider
int PlusOne ( int n ) {
return n +1;
}
int result ( PlusOne (3+4) ) ;
1 3+4 is evaluated and copied to a new int n (7) in PlusOne.
2 n+1 is evaluated and copied to a new int result (8).
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
42. Run-time performance enhancements Move semantics
R-value references
Using r-value references we can get rid of the first copy:
int PlusOne ( int && n ) {
return n +1;
}
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
43. Run-time performance enhancements Move semantics
R-value references
Using r-value references we can get rid of the first copy:
int PlusOne ( int && n ) {
return n +1;
}
The evaluated integer instance 7 is used in evaluating n+1.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
44. Run-time performance enhancements Move semantics
R-value references
Using r-value references we can get rid of the first copy:
int PlusOne ( int && n ) {
return n +1;
}
The evaluated integer instance 7 is used in evaluating n+1.
STL containers benefit from this too:
std :: vector <int > v ;
// Use void std :: vector <T , A >:: push_back ( T &&)
v . push_back (3+4) ;
int r (7) ;
// Use void std :: vector <T , A >:: push_back ( T const &)
v . push_back (r);
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
45. Run-time performance enhancements Constant expression
Constant expression
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
46. Run-time performance enhancements Constant expression
Constant expression
Compile time calculations are ill-formed.
int Two () {
return 2;
}
double array [ Two () + 3]; // Ill - formed
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
47. Run-time performance enhancements Constant expression
Constant expression
Compile time calculations are ill-formed.
int Two () {
return 2;
}
double array [ Two () + 3]; // Ill - formed
The compiler is not aware of Two being constant.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
48. Run-time performance enhancements Constant expression
Constant expression
Compile time calculations are ill-formed.
int Two () {
return 2;
}
double array [ Two () + 3]; // Ill - formed
The compiler is not aware of Two being constant.
We resolve this with constexpr.
constexpr int Two () {
return 2;
}
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
49. Run-time performance enhancements Constant expression
Constant class expressions
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 13 / 39
50. Run-time performance enhancements Constant expression
Constant class expressions
This can be applied to classes as well
struct Square {
explicit constexpr Square ( unsigned side ) :
_side ( side )
{
}
constexpr unsigned Area () const {
return _side * _side ;
}
void SetSide ( unsigned side ) {
_side = side ;
}
private :
unsigned _side ;
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 13 / 39
51. Run-time performance enhancements Constant expression
Constant class expressions
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
52. Run-time performance enhancements Constant expression
Constant class expressions
constexpr Square ces (3) ;
const Square cs (4) ;
Square s (5) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
53. Run-time performance enhancements Constant expression
Constant class expressions
constexpr Square ces (3) ;
const Square cs (4) ;
Square s (5) ;
double cesArray [ ces . Area () ];
// Error : cs . Area () is not constexpr
double csArray [ cs . Area () ];
// Error : s . Area () is not constexpr
double sArray [ s . Area () ];
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
54. Run-time performance enhancements Constant expression
Constant class expressions
constexpr Square ces (3) ;
const Square cs (4) ;
Square s (5) ;
double cesArray [ ces . Area () ];
// Error : cs . Area () is not constexpr
double csArray [ cs . Area () ];
// Error : s . Area () is not constexpr
double sArray [ s . Area () ];
ces . SetSide (6) ; // Error : this is Square const *
cs . SetSide (6) ; // Error : this is Square const *
s . SetSide (6) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
55. Usability enhancements
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
Static assertions
Type inference
Anonymous functions
Override and Final
Alias templates
Enumerations and Unions
5 New functionality
6 Ralph Langendam library enhancements
Standard (NCIM-Groep) C++ 11 Januari 9th, 2013 15 / 39
56. Usability enhancements Static assertions
Static assertions
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
57. Usability enhancements Static assertions
Static assertions
We can perform compile time checks on constexpr.
constexpr bool b ( false ) ;
// Error : static assertion failed : b is false
static_assert (b , " b is false . " ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
58. Usability enhancements Static assertions
Static assertions
We can perform compile time checks on constexpr.
constexpr bool b ( false ) ;
// Error : static assertion failed : b is false
static_assert (b , " b is false . " ) ;
constexpr Square ces (3) ;
static_assert ( ces . Area () == 9 , " Oops . " ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
59. Usability enhancements Static assertions
Static assertions
We can perform compile time checks on constexpr.
constexpr bool b ( false ) ;
// Error : static assertion failed : b is false
static_assert (b , " b is false . " ) ;
constexpr Square ces (3) ;
static_assert ( ces . Area () == 9 , " Oops . " ) ;
This allows for static (unit) testing.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
60. Usability enhancements Static assertions
Static assertions
We can perform compile time checks on constexpr.
constexpr bool b ( false ) ;
// Error : static assertion failed : b is false
static_assert (b , " b is false . " ) ;
constexpr Square ces (3) ;
static_assert ( ces . Area () == 9 , " Oops . " ) ;
This allows for static (unit) testing.
TMP and revised constexpr are T¨ring complete.
u
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
61. Usability enhancements Static assertions
Static assertions
We can perform compile time checks on constexpr.
constexpr bool b ( false ) ;
// Error : static assertion failed : b is false
static_assert (b , " b is false . " ) ;
constexpr Square ces (3) ;
static_assert ( ces . Area () == 9 , " Oops . " ) ;
This allows for static (unit) testing.
TMP and revised constexpr are T¨ring complete.
u
All unit tests can be static unit tests!
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
62. Usability enhancements Type inference
Automatic type deduction
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
63. Usability enhancements Type inference
Automatic type deduction
Inability to overload function based on return type opens up the
possibility for type inference.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
64. Usability enhancements Type inference
Automatic type deduction
Inability to overload function based on return type opens up the
possibility for type inference.
Bonus: syntactic sugar
std :: set < float >:: const_iterator b ( s . begin () ) ;
auto b ( s . begin () ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
65. Usability enhancements Type inference
Automatic type deduction
Inability to overload function based on return type opens up the
possibility for type inference.
Bonus: syntactic sugar
std :: set < float >:: const_iterator b ( s . begin () ) ;
auto b ( s . begin () ) ;
Drawback: implicitness obfuscates bugs.
auto x ( f () ) ;
// Could be integer or float division .
// Even any matching division operator .
auto z = 1 / y ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
66. Usability enhancements Anonymous functions
Callbacks and closures
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
67. Usability enhancements Anonymous functions
Callbacks and closures
std::function makes callbacks more readable then conventional
function pointers.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
68. Usability enhancements Anonymous functions
Callbacks and closures
std::function makes callbacks more readable then conventional
function pointers.
# include < functional >
struct S {
int TimesTwo ( short s ) const {
return 2 * s ;
}
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
69. Usability enhancements Anonymous functions
Callbacks and closures
std::function makes callbacks more readable then conventional
function pointers.
# include < functional >
struct S {
int TimesTwo ( short s ) const {
return 2 * s ;
}
};
// Using function pointers
typedef int ( S ::* Method ) ( short ) const ;
Method p (& S :: TimesTwo ) ;
S const s ;
int const x (( s .* p ) (3) ) ; // x == 6
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
70. Usability enhancements Anonymous functions
Callbacks and closures
std::function makes callbacks more readable then conventional
function pointers.
# include < functional >
struct S {
int TimesTwo ( short s ) const {
return 2 * s ;
}
};
// Using function pointers
typedef int ( S ::* Method ) ( short ) const ;
Method p (& S :: TimesTwo ) ;
S const s ;
int const x (( s .* p ) (3) ) ; // x == 6
// Using std :: function
std :: function < int ( S const & , short ) > q (& S :: TimesTwo ) ;
int const y ( q (s , 4) ) ; // y == 8
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
71. Usability enhancements Anonymous functions
Lambda expressions
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
72. Usability enhancements Anonymous functions
Lambda expressions
Syntax: [capture clause] (parameter list)-> returnvalue {body}
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
73. Usability enhancements Anonymous functions
Lambda expressions
Syntax: [capture clause] (parameter list)-> returnvalue {body}
# include < functional >
double g ( std :: function < double ( int ) > const & f ) {
return f (4) ;
}
{
double x (2.) ;
std :: function < double ( int ) > const f (
[& x ] ( int n ) -> double {
return x * n ;
}
);
double const y ( g ( f ) ) ; // y == 8.
x = 3.;
double const z ( g ( f ) ) ; // z == 12.
}
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
74. Usability enhancements Override and Final
Override and Final
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
75. Usability enhancements Override and Final
Override and Final
Use override to avoid accidental creation of new virtual function.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
76. Usability enhancements Override and Final
Override and Final
Use override to avoid accidental creation of new virtual function.
Use final to prevent further specialization.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
77. Usability enhancements Override and Final
Override and Final
Use override to avoid accidental creation of new virtual function.
Use final to prevent further specialization.
struct Interface {
virtual void f () = 0;
virtual void g () = 0;
};
struct Base : Interface {
virtual void f () override ;
virtual void g () final ;
};
struct final Derived : Base {
// Error : Signature of f doesn ’t match
virtual void f ( int ) override ;
// Error : g finally overridden in Base
virtual void g () override ;
};
// Error : Derived is final
struct Derived2 : Derived { ... };
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
78. Usability enhancements Alias templates
Alias templates
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
79. Usability enhancements Alias templates
Alias templates
Templated typedefs were illegal in C++03.
// Error : templated typedef not allowed .
template < typename T >
typedef std :: vector <T , std :: allocator <T > > Vector ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
80. Usability enhancements Alias templates
Alias templates
Templated typedefs were illegal in C++03.
// Error : templated typedef not allowed .
template < typename T >
typedef std :: vector <T , std :: allocator <T > > Vector ;
Possible workaround can lead to difficulties.
template < typename T >
class Vector :
public std :: vector <T , std :: allocator <T > > {};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
81. Usability enhancements Alias templates
Alias templates
Templated typedefs were illegal in C++03.
// Error : templated typedef not allowed .
template < typename T >
typedef std :: vector <T , std :: allocator <T > > Vector ;
Possible workaround can lead to difficulties.
template < typename T >
class Vector :
public std :: vector <T , std :: allocator <T > > {};
C++11 allows us to solve it like this.
template < typename T >
using Vector = std :: vector <T , std :: allocator <T > >;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
82. Usability enhancements Enumerations and Unions
Enumerations and Unions
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
83. Usability enhancements Enumerations and Unions
Enumerations and Unions
Strongly typed enumerations Enumeration classes can no longer be
implicitly converted to int.
enum E ; // Error : unknown underlying type
enum class E : unsigned long ;
enum class E { A = 3 , B , C };
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
84. Usability enhancements Enumerations and Unions
Enumerations and Unions
Strongly typed enumerations Enumeration classes can no longer be
implicitly converted to int.
enum E ; // Error : unknown underlying type
enum class E : unsigned long ;
enum class E { A = 3 , B , C };
Unrestricted unions Union members can be non-trivially constructible
types, but the union constructor needs to be manually
defined then.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
85. New functionality
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
Variadic templates
Defaulted and deleted special methods
6 Standard library enhancements
7 Compiler support
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 23 / 39
86. New functionality Variadic templates
Variadic templates
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
87. New functionality Variadic templates
Variadic templates
Templated types can have a variadic template parameter list.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
88. New functionality Variadic templates
Variadic templates
Templated types can have a variadic template parameter list.
Unlike variadic macros and functions, variadic templates are type-safe.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
89. New functionality Variadic templates
Variadic templates
Templated types can have a variadic template parameter list.
Unlike variadic macros and functions, variadic templates are type-safe.
template < typename T , typename ... O >
struct Tuple {
T _value ;
Tuple <O ... > _others ;
explicit Tuple ( T value , O ... others ) :
_value ( value ) ,
_others ( others ...)
{
}
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
90. New functionality Variadic templates
Variadic templates
Specialization:
template < typename T >
struct Tuple <T > {
T _value ;
explicit Tuple ( T value ) :
_value ( value )
{
}
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 25 / 39
91. New functionality Variadic templates
Variadic templates
Specialization:
template < typename T >
struct Tuple <T > {
T _value ;
explicit Tuple ( T value ) :
_value ( value )
{
}
};
Usage:
Tuple <int , double , bool > tuple (3 , 2. , true ) ;
tuple . _value ; // == 3
tuple . _others . _value ; // == 2.
tuple . _others . _others . _value ; // == true
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 25 / 39
92. New functionality Variadic templates
std::tuple
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
93. New functionality Variadic templates
std::tuple
Better version provided by STL.
# include < tuple >
std :: tuple <int , double > idTuple (3 , 5.) ;
std :: get <1 > ( idTuple ) ; // == 5.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
94. New functionality Variadic templates
std::tuple
Better version provided by STL.
# include < tuple >
std :: tuple <int , double > idTuple (3 , 5.) ;
std :: get <1 > ( idTuple ) ; // == 5.
std :: tuple <int , bool > ibTuple (4 , false ) ;
idTuple = ibTuple ; // Error : different tuple types .
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
95. New functionality Variadic templates
std::tuple
Better version provided by STL.
# include < tuple >
std :: tuple <int , double > idTuple (3 , 5.) ;
std :: get <1 > ( idTuple ) ; // == 5.
std :: tuple <int , bool > ibTuple (4 , false ) ;
idTuple = ibTuple ; // Error : different tuple types .
bool inserted ;
std :: set <int >:: iterator i ;
std :: set <int > s ;
std :: tie (i , inserted ) = s . insert (3) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
96. New functionality Defaulted and deleted special methods
Defaulted special methods
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 27 / 39
97. New functionality Defaulted and deleted special methods
Defaulted special methods
Definition like class C { int i; }; defaults to
class C {
int i ;
public :
C () {} // Empty constructor
C ( C const & c ) : i ( c . i ) {} // Copy constructor
~ C () {} // Default destructor
C & operator = ( C const & c ) { // Assignment operator
if ( this != & c ) {
i = c.i;
}
return * this ;
}
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 27 / 39
98. New functionality Defaulted and deleted special methods
Default and Delete
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
99. New functionality Defaulted and deleted special methods
Default and Delete
C++11 allows control over these default methods.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
100. New functionality Defaulted and deleted special methods
Default and Delete
C++11 allows control over these default methods.
class C {
int i ;
public :
// Don ’t allow implicit empty construction
C () = delete ;
// Generate default implicit copy constructor
C ( C const &) = default ;
// Destructor and assignment operator left
// implicitly default .
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
101. New functionality Defaulted and deleted special methods
Prohibit method calls
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
102. New functionality Defaulted and deleted special methods
Prohibit method calls
deletecan also be used to prohibit calling methods with specific
arguments.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
103. New functionality Defaulted and deleted special methods
Prohibit method calls
deletecan also be used to prohibit calling methods with specific
arguments.
struct S {
void f ( double d ) ;
// Prohibit calling f with float argument
void f ( float ) = delete ;
// Prohibit calling f with any argument
// except double
template < typename T > void f ( T ) = delete ;
};
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
104. Standard library enhancements
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
6 Standard library enhancements
Threading facilities
Smart pointers
Type traits
7 Compiler support
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 30 / 39
105. Standard library enhancements Threading facilities
Threading facilities
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
106. Standard library enhancements Threading facilities
Threading facilities
C++11 provides platform independent threading facilities.
# include < thread >
auto f ([] ( int & out , short in ) { out = 2* in ; }) ;
int result (0) ;
std :: thread t (f , std :: ref ( result ) , 3) ;
t . join () ;
// result == 6
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
107. Standard library enhancements Threading facilities
Threading facilities
C++11 provides platform independent threading facilities.
# include < thread >
auto f ([] ( int & out , short in ) { out = 2* in ; }) ;
int result (0) ;
std :: thread t (f , std :: ref ( result ) , 3) ;
t . join () ;
// result == 6
They’re accompanied by objects like mutexes, conditional variables
and RAII locks.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
108. Standard library enhancements Threading facilities
Threading facilities
C++11 provides platform independent threading facilities.
# include < thread >
auto f ([] ( int & out , short in ) { out = 2* in ; }) ;
int result (0) ;
std :: thread t (f , std :: ref ( result ) , 3) ;
t . join () ;
// result == 6
They’re accompanied by objects like mutexes, conditional variables
and RAII locks.
Mutexes can be avoided by using atomic operations and memory
barriers.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
109. Standard library enhancements Threading facilities
Threading facilities
C++11 provides platform independent threading facilities.
# include < thread >
auto f ([] ( int & out , short in ) { out = 2* in ; }) ;
int result (0) ;
std :: thread t (f , std :: ref ( result ) , 3) ;
t . join () ;
// result == 6
They’re accompanied by objects like mutexes, conditional variables
and RAII locks.
Mutexes can be avoided by using atomic operations and memory
barriers.
Asynchronous thread communication is facilitated by futures and
promises.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
110. Standard library enhancements Threading facilities
Threading facilities
C++11 provides platform independent threading facilities.
# include < thread >
auto f ([] ( int & out , short in ) { out = 2* in ; }) ;
int result (0) ;
std :: thread t (f , std :: ref ( result ) , 3) ;
t . join () ;
// result == 6
They’re accompanied by objects like mutexes, conditional variables
and RAII locks.
Mutexes can be avoided by using atomic operations and memory
barriers.
Asynchronous thread communication is facilitated by futures and
promises.
Thread pools are planned for upcoming C++ standards.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
111. Standard library enhancements Smart pointers
Memory leaks
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
112. Standard library enhancements Smart pointers
Memory leaks
How to avoid memory leaks?
int * i ( new int (0) ) ;
f ( i ) ; // Could throw
delete i ; // Might be too late
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
113. Standard library enhancements Smart pointers
Memory leaks
How to avoid memory leaks?
int * i ( new int (0) ) ;
f ( i ) ; // Could throw
delete i ; // Might be too late
Cumbersome alternative.
int * i ( new int (1) ) ;
try {
f (i);
} catch ( fException const & e ) { ... }
delete i ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
114. Standard library enhancements Smart pointers
RAII as a solution
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
115. Standard library enhancements Smart pointers
RAII as a solution
The problem doesn’t occur on the stack
int i ;
f (& i ) ; // May throw ; i is cleaned up
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
116. Standard library enhancements Smart pointers
RAII as a solution
The problem doesn’t occur on the stack
int i ;
f (& i ) ; // May throw ; i is cleaned up
Solution: Make a stack object responsible for deprecation of
dynamically allocated space.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
117. Standard library enhancements Smart pointers
RAII as a solution
The problem doesn’t occur on the stack
int i ;
f (& i ) ; // May throw ; i is cleaned up
Solution: Make a stack object responsible for deprecation of
dynamically allocated space.
RAII: Resource Acquisition Is Initialization.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
118. Standard library enhancements Smart pointers
RAII as a solution
The problem doesn’t occur on the stack
int i ;
f (& i ) ; // May throw ; i is cleaned up
Solution: Make a stack object responsible for deprecation of
dynamically allocated space.
RAII: Resource Acquisition Is Initialization.
C++11 improves on smart pointers implementing RAII.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
119. Standard library enhancements Smart pointers
Smart pointers
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
120. Standard library enhancements Smart pointers
Smart pointers
std::unique_ptr deprecates std::auto_ptr.
# include < memory >
std :: unique_ptr <int > i ( new int (0) ) ;
// Error : no copy constructor
std :: unique_ptr <int > j ( i ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
121. Standard library enhancements Smart pointers
Smart pointers
std::unique_ptr deprecates std::auto_ptr.
# include < memory >
std :: unique_ptr <int > i ( new int (0) ) ;
// Error : no copy constructor
std :: unique_ptr <int > j ( i ) ;
Joint ownership is facilitated by std::shared_ptr and std::weak_ptr.
std :: shared_ptr <int > i ( new int (1) ) ;
std :: shared_ptr <int > j ( i ) ; // Joint ownership
// Doesn ’t contribute to reference counting
std :: weak_ptr <int > w (i);
std :: shared_ptr <int > k (w);
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
122. Standard library enhancements Smart pointers
Smart pointers
std::unique_ptr deprecates std::auto_ptr.
# include < memory >
std :: unique_ptr <int > i ( new int (0) ) ;
// Error : no copy constructor
std :: unique_ptr <int > j ( i ) ;
Joint ownership is facilitated by std::shared_ptr and std::weak_ptr.
std :: shared_ptr <int > i ( new int (1) ) ;
std :: shared_ptr <int > j ( i ) ; // Joint ownership
// Doesn ’t contribute to reference counting
std :: weak_ptr <int > w (i);
std :: shared_ptr <int > k (w);
Behaviour is similar to a real pointer. e.g. casting:
std :: shared_ptr < Derived > d ( new Derived () ) ;
std :: shared_ptr < Base > b (
std :: d y n a m i c _ pointer_cast < Base , Derived > ( d ) ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
123. Standard library enhancements Type traits
Type traits for TMP
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
124. Standard library enhancements Type traits
Type traits for TMP
C++11 elaborates on type computation and transformation at
compile time.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
125. Standard library enhancements Type traits
Type traits for TMP
C++11 elaborates on type computation and transformation at
compile time.
struct Base {}; struct Derived : Base {};
static_assert ( std :: is_base_of < Base , Derived >:: value ,
" Oops " ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
126. Standard library enhancements Type traits
Type traits for TMP
C++11 elaborates on type computation and transformation at
compile time.
struct Base {}; struct Derived : Base {};
static_assert ( std :: is_base_of < Base , Derived >:: value ,
" Oops " ) ;
template < typename T > struct Algorithm {
static int Execute ( typename std :: conditional <
std :: is_arithmetic <T >:: value , T ,
typename std :: add_lvalue_reference <T >:: type
>:: type
);
};
// int Execute ( int ) ;
Algorithm <int >:: Execute (5) ;
// int Execute ( std :: vector <int >&) ;
Algorithm < std :: vector <int > >:: Execute ( v ) ;
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
127. Compiler support
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
6 Standard library enhancements
7 Compiler support
8 Further reading
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 36 / 39
130. Compiler support
Compiler support
C++11 covers about 40 subjects.
MSVC 2012 supports about half of them, while GCC 4.8 and CLang
3.1 are almost feature complete.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
131. Compiler support
Compiler support
C++11 covers about 40 subjects.
MSVC 2012 supports about half of them, while GCC 4.8 and CLang
3.1 are almost feature complete.
Enabling C++ 11 is automatic for MSVC, but requires an additional
commandline option -std=c++11 for GCC and CLang.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
132. Compiler support
Compiler support
C++11 covers about 40 subjects.
MSVC 2012 supports about half of them, while GCC 4.8 and CLang
3.1 are almost feature complete.
Enabling C++ 11 is automatic for MSVC, but requires an additional
commandline option -std=c++11 for GCC and CLang.
TR2 is already being implemented in GCC.
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
133. Further reading
Outline
1 Timeline
2 C++11 Development
3 Run-time performance enhancements
4 Usability enhancements
5 New functionality
6 Standard library enhancements
7 Compiler support
8 Further reading
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 38 / 39
134. Further reading
Further reading
Thank you for your attention.
Some resources for further reading.
C++ Reference
ISO C++
Boost
C++ 11 Compiler support
C++ 11 Wiki
TR1 and TR2
Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 39 / 39