CAN/CSA ISO/IEC TR 19768-08 (R2018): C++ Standard Library Extensions — Technical Overview and Compliance Guide

Understanding the Canadian Adoption of the International Technical Report on C++ Library Extensions

Scope and Purpose

CAN/CSA ISO/IEC TR 19768-08 (R2018) is the Canadian Standards Association (CSA) adoption of the international ISO/IEC TR 19768, titled “Information technology — Programming languages — C++ — Library Extensions”. Originally published in 2007 and reaffirmed in 2018, this Technical Report—commonly known as TR1 (Technical Report 1)—served as the foundation for many features later integrated into the C++11 standard. The Canadian adoption preserves the entire content of the international technical report while aligning it with the Canadian regulatory framework for ICT systems.

The scope of this document is limited to library extensions for the C++ programming language. It does not modify the core language itself; rather, it introduces a set of new components for the C++ standard library, including utilities for type traits, function binders, and sophisticated resource management tools. The primary objective is to provide a stable reference for implementers, compiler vendors, and software developers who require a well-defined, backwards-compatible library enhancement path before the publication of C++11.

Tip: TR1 was designed as a formal “draft” for future standardization. Many of its components—such as std::tr1::shared_ptr and std::tr1::array—were later moved to std:: and widely adopted. Understanding TR1 is still valuable for maintaining legacy systems that target pre-C++11 environments.

Technical Requirements and Core Components

TR1 defines a set of library additions that reside in the std::tr1 namespace. The standard mandates specific functional requirements, interfaces, and behavioral guarantees for each component. Below is a summary of the major categories covered by CAN/CSA ISO/IEC TR 19768-08.

1. Utility Components

  • Smart Pointers: shared_ptr and weak_ptr for automatic memory management with reference counting and weak references.
  • Enhanced Function Objects: function for type-erased callables, bind for argument binding, and mem_fn for wrapping member pointers.
  • Type Traits: A comprehensive set of compile-time type queries (e.g., is_integral, remove_reference), laying the foundation for template metaprogramming.
  • Tuples: The tuple class template for fixed-size heterogeneous collections of types.
  • Array Wrapper: The array container (fixed-size stack-allocated array with STL-compatible interface).
  • Random Number Facility: The complete random number generation infrastructure with engines (e.g., Mersenne Twister) and distributions.

2. Containers and Algorithms

  • Unordered Associative Containers: unordered_map, unordered_set, unordered_multimap, unordered_multiset based on hash tables.
  • Enhanced Numerics: Special mathematical functions (e.g., Bessel functions, elliptic integrals) and compile-time rational arithmetic via ratio.
  • Regular Expressions: The regex library (based on ECMAScript syntax) for pattern matching and string replacement.
  • Enhanced I/O: Stream manipulators for localized and formatted I/O and additional features such as move semantics support.

3. Concurrency Support (Limited)

Although the TR1 predates the full C++11 memory model, it introduced preliminary building blocks for concurrency, such as the low-level atomic for lock-free integer operations. These were later superseded by the more comprehensive std::atomic facilities in C++11.

Important: TR1 components are not guaranteed to be thread-safe in a pre‑C++11 environment. Implementations that provide TR1 must document any additional synchronization guarantees. When porting to a newer standard, always prefer std::shared_ptr over std::tr1::shared_ptr to benefit from the later concurrency guarantees.
Key TR1 Components and Their Status
Component Header Namespace Origin / Status
shared_ptr <memory> std::tr1 From Boost; adopted into C++11 with minor changes
weak_ptr <memory> std::tr1 From Boost; preserved in C++11
function <functional> std::tr1 Polymorphic function wrapper; part of C++11
bind <functional> std::tr1 Argument binding; superseded by std::bind in C++11
array <array> std::tr1 Standardized in C++11
unordered_map <unordered_map> std::tr1 Hash table; replaced hash_map extensions
regex <regex> std::tr1 Standardized in C++11 with minor changes
tuple <tuple> std::tr1 From Boost; adopted in C++11
type_traits <type_traits> std::tr1 Fully integrated into C++11
random <random> std::tr1 Engine + distribution model; C++11 compatible

Implementation Highlights and Migration Pathways

Implementing CAN/CSA ISO/IEC TR 19768-08 requires adherence to the interface and behavioral specifications defined in the technical report. Compiler vendors typically provide TR1 support through a separate header and namespace (<tr1/…> or std::tr1). The table above summarises the origin and eventual standardisation of each component. For developers, the following best practices are recommended when working with TR1:

Best Practice: Use std::tr1::shared_ptr only when compiling with a pre‑C++11 toolchain. For new projects that target C++11 or later, always use the std:: versions. If you must support both standards, consider using a compatibility wrapper such as BOOST_CPP11 defines or the std::shared_ptr fallback.
  • Porting Guidance: Most TR1 components have a direct equivalent in the C++11 standard library. The migration is often a simple replacement of std::tr1:: with std::. However, some components (e.g., bind) had slight changes in semantics; verify affected code thoroughly.
  • Compiler Compatibility: Legacy codebases that still rely on TR1 must be compiled with a compiler that explicitly implements the TR1 specification. Commonly, GCC 4.1+ and Visual C++ 2008+ shipped with TR1 implementations. The standard does not mandate performance characteristics, but implementations are expected to be at least as efficient as a naive baseline.
  • Testing and Validation: A conforming implementation should pass the test suite provided in the TR1 annex (if available). For critical systems, certification bodies often require evidence that the library functions as specified under the Canadian adoption reference.
Warning: The TR1 regular expression library is known to have incomplete or buggy implementations in some early vendor releases. Always verify std::tr1::regex behavior with edge cases (e.g., nested captures, back-references) before relying on it in production code.

Compliance and Certification Notes

Compliance with CAN/CSA ISO/IEC TR 19768-08 is assessed based on a set of documented requirements. For organizations seeking certification (e.g., for federal ICT projects in Canada or for conformance with a corporate coding standard), the following principles apply:

  • Conformance Level: The standard defines strict conformance (all components present and behaving as specified) and extended conformance (implementation-defined extensions are allowed as long as they do not break any mandatory behavior).
  • Documentation Requirements: Deviations from the international report must be clearly documented. When a CSA adoption is claimed, any divergence from the original ISO/IEC TR 19768 text (e.g., Canadian localization, deprecated headers) must be listed.
  • Lifecycle and Reaffirmation: This Canadian standard carries a 2018 reaffirmation date. CSA standards are typically reviewed every five years. As of 2026, the technical report is still recognized, though it may be superseded by later C++ International Standards. Users are encouraged to transition to current ISO/IEC 14882 editions where possible.
  • Certification Bodies: Testing for compliance can be performed by accredited laboratories using the conformance tests provided by ISO or CSA. In-house self-declaration is also permitted under the CSA’s conformity assessment program for informational standards.
Note: The TR1 is not a normative standard in the same sense as the C++ Standard (ISO/IEC 14882). It is a Technical Report, meaning it is intended as a basis for future standardisation rather than as a standalone specification. For mandatory compliance requirements (e.g., avionics, medical devices), always reference the formal C++ standard and not a technical report alone.
Q: What is the relationship between ISO/IEC TR 19768 and the current C++ standard?
A: ISO/IEC TR 19768 (TR1) is a precursor to the library extensions that became part of the C++11 standard (ISO/IEC 14882:2011). Almost all TR1 components were incorporated into the C++ Standard Library (with minor changes). The TR is now superseded for new designs, but it remains officially adopted by CSA Canada for legacy system compliance.
Q: Does CAN/CSA ISO/IEC TR 19768-08 impose any Canadian-specific requirements not found in the international report?
A: No. The CSA adoption is identical in technical content to ISO/IEC TR 19768. The CSA prefix merely signifies that the standard has been formally recognized under the Canadian standards framework. Any national deviations, if present, would be identified in the CSA foreword; in this case, there are none.
Q: How can I verify that my compiler’s TR1 implementation is compliant?
A: The best approach is to use a test suite derived from the official TR1 document (Annex D contains sample implementations and tests). Several open-source projects (e.g., STLPort, libc++’s backward compatibility headers) provide conformance tests for TR1. Additionally, the compiler vendor should supply a statement of conformance for the specific version and platform.
Q: Should I use std::tr1::shared_ptr or std::shared_ptr in a project that must compile both C++03 and C++11?
A: A recommended pattern is to use a preprocessor conditional: #if __cplusplus >= 201103L to select std::shared_ptr; otherwise fall back to std::tr1::shared_ptr. This approach avoids namespace ambiguity and ensures you get the thread-safety improvements of the C++11 version when available.

This article is intended for general informational purposes and should not be used as a substitute for the official standard text. Always consult the latest adopted version of CAN/CSA ISO/IEC TR 19768-08 for precise technical and legal requirements.

📥 Standard Documents Download

🔒
Please wait 10 seconds, the download links will appear after the ad loads

Leave a Reply

Your email address will not be published. Required fields are marked *