Skip to content

Code for the talk, "Allocators: the Good Parts", at CppCon2017

License

Notifications You must be signed in to change notification settings

phalpern/CppCon2017Code

Repository files navigation

Allocators: the Good Parts

Pablo Halpern

This repository contains all of the code presented in my talk at CppCon 2017, including an implementation of polymorphic_allocators, a C++17 feature implemented here using only C++11 features.

Also included is the PDF of my PowerPoint presentation.

Look for a video of my presentation, coming soon to the CppCon Channel of YouTube.

Components and namespaces

Several of the components in this repository are implementations of C++17 library features using C++11 language and library facilities. The C++17 features are implemented in the cpp17 namespace instead of the std namespace. The cpp17 namespace imports the std namespace, so any standard feature is available in the cpp17 namespace.

Each component comprises 3 files: a .h file containing the interface, template implementations, and inline functions, a .cpp file containing the non-template and non-inline parts of the implementation, and a .t.cpp file containing a test driver for the component. The components in this repository are:

  • polymorphic_allocator: An implementation of cpp17::pmr::memory_resource and cpp17::pmr::polymorphic_allocator<Tp> from C++17, using only C++11 language and library features.

  • pmr_vector (header only): An implementation of cpp17::pmr::vector<Tp> from C++17, which is the same as std::vector<Tp, cpp17::pmr::polymoprhic_allocator<Tp>>.

  • pmr_string (header only): An implementation of cpp17::pmr::basic_string<charT, Traits>, from C++17, which is the same as std::basic_string<charT, Traits, cpp17::pmr::polymorpic_allocator<charT>>, This component also contains the aliases cpp17::pmr::string and cpp17::pmr::wstring.

  • test_resource: A memory resource for testing purposes that maintains statistics on memory usage and checks for mismatched deallocations and memory leaks. A subset of this component is explicated in my talk.

  • slist: An implementation of a forward list that uses only the good parts of the C++17 allocator model. A subset of this component is explicated in my talk.

About

Code for the talk, "Allocators: the Good Parts", at CppCon2017

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published