Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/experimental/lib extensions"

From cppreference.com
m (Array support for {{tt|shared_ptr}})
(Type-erased and polymorphic allocators: switch order)
Line 23: Line 23:
  
 
=== Type-erased and polymorphic allocators ===
 
=== Type-erased and polymorphic allocators ===
 
==== Modified versions of existing classes to support type-erased allocators ====
 
{{dsc begin}}
 
{{dsc header | experimental/functional}}
 
{{dsc tclass | cpp/experimental/function | a modified version of {{lc|std::function}} with support for type-erased allocators }}
 
{{dsc header | experimental/future}}
 
{{dsc tclass | cpp/experimental/promise | a modified version of {{lc|std::promise}} with support for type-erased allocators }}
 
{{dsc tclass | cpp/experimental/packaged_task | a modified version of {{lc|std::packaged_task}} with support for type-erased allocators }}
 
{{dsc end}}
 
  
 
==== Polymorphic allocators and memory resources ====
 
==== Polymorphic allocators and memory resources ====
Line 45: Line 36:
 
{{dsc tclass | cpp/experimental/polymorphic_allocator | An allocator that supports run-time polymorphism based on the {{lc|memory_resource}} it is constructed with }}
 
{{dsc tclass | cpp/experimental/polymorphic_allocator | An allocator that supports run-time polymorphism based on the {{lc|memory_resource}} it is constructed with }}
 
{{dsc talias | cpp/experimental/resource_adaptor | Adapts an allocator into a {{lc|memory_resource}}}}
 
{{dsc talias | cpp/experimental/resource_adaptor | Adapts an allocator into a {{lc|memory_resource}}}}
 +
{{dsc end}}
 +
 +
 +
==== Modified versions of existing classes to support type-erased allocators ====
 +
{{dsc begin}}
 +
{{dsc header | experimental/functional}}
 +
{{dsc tclass | cpp/experimental/function | a modified version of {{lc|std::function}} with support for type-erased allocators }}
 +
{{dsc header | experimental/future}}
 +
{{dsc tclass | cpp/experimental/promise | a modified version of {{lc|std::promise}} with support for type-erased allocators }}
 +
{{dsc tclass | cpp/experimental/packaged_task | a modified version of {{lc|std::packaged_task}} with support for type-erased allocators }}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 15:08, 23 July 2015

 
 
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
 
 

The C++ Extensions for Library Fundamentals, ISO/IEC TS 19568:xxxx, defines the following new components for the C++ standard library:

Contents

optional objects

Defined in header <experimental/optional>
a class template representing optional objects
(class template)

class any

Defined in header <experimental/any>
a type-safe container for single values of any type
(class)

string_view

Defined in header <experimental/string_view>
a non-owning reference to a string
(class template)

Type-erased and polymorphic allocators

Polymorphic allocators and memory resources

The following entities are declared in the std::experimental::pmr namespace.

Class Description
an abstract interface for classes that encapsulate memory resources
(class)
A type of memory_resource for managing allocations in pools of different block sizes.
(class)
A special-purpose memory_resource that releases the allocated memory only when the resource is destroyed
(class)
An allocator that supports run-time polymorphism based on the memory_resource it is constructed with
(class template)
Adapts an allocator into a memory_resource
(alias template)


Modified versions of existing classes to support type-erased allocators

Defined in header <experimental/functional>
a modified version of std::function with support for type-erased allocators
(class template)
Defined in header <experimental/future>
a modified version of std::promise with support for type-erased allocators
(class template)
a modified version of std::packaged_task with support for type-erased allocators
(class template)

Convenience aliases for containers using polymorphic allocators

Defined in header <experimental/vector>
convenience alias template for a std::vector with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/deque>
convenience alias template for a std::deque with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/forward_list>
convenience alias template for a std::forward_list with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/list>
convenience alias template for a std::list with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/string>
convenience alias template for a std::basic_string with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience typedefs for common character types
(typedef)
Defined in header <experimental/map>
convenience alias template for a std::map with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience alias template for a std::multimap with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/set>
convenience alias template for a std::set with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience alias template for a std::multiset with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/map>
convenience alias template for a std::unordered_map with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience alias template for a std::unordered_multimap with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/unordered_set>
convenience alias template for a std::unordered_set with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience alias template for a std::unordered_multiset with a std::experimental::pmr::polymorphic_allocator
(alias template)
Defined in header <experimental/regex>
convenience alias template for a std::match_results with a std::experimental::pmr::polymorphic_allocator
(alias template)
convenience typedefs for common character sequence types
(typedef)

Array support for shared_ptr

Defined in header <experimental/memory>
Class Description
A modified version of std::shared_ptr that supports arrays
(class template)

Sampling and searching algorithms

Defined in header <experimental/algorithm>
selects n random elements from a sequence
(function template)
applies a Searcher to a sequence
(function template)
Defined in header <experimental/functional>
standard C++ library search algorithm implementation
(class template)
helper function to create a default_searcher
(function template)
Boyer-Moore search algorithm implementation
(class template)
helper function to create a boyer_moore_searcher
(function template)
Boyer-Moore-Horspool search algorithm implementation
(class template)
helper function to create a boyer_moore_horspool_searcher
(function template)

General utilities

Defined in header <experimental/utility>
placeholder type for type erasure, such as in allocators
(class)
Defined in header <experimental/tuple>
calls a function to a tuple of arguments
(function template)
Defined in header <experimental/type_traits>
deduce the implied function type of the callable object when called with the given argument types
(class template)

Variable templates for type traits and similar templates

Defined in header <experimental/tuple>
exposes std::tuple_size as a variable template
(variable template)
Defined in header <experimental/ratio>
exposes std::ratio_equal as a variable template
(variable template)
exposes std::ratio_not_equal as a variable template
(variable template)
exposes std::ratio_less as a variable template
(variable template)
exposes std::ratio_less_equal as a variable template
(variable template)
exposes std::ratio_greater as a variable template
(variable template)
exposes std::ratio_greater_equal as a variable template
(variable template)
Defined in header <experimental/chrono>
exposes std::chrono::treat_as_floating_point as a variable template
(variable template)
Defined in header <experimental/system_error>
exposes std::is_error_code_enum as a variable template
(variable template)
exposes std::is_error_condition_enum as a variable template
(variable template)
Defined in header <experimental/functional>
exposes std::is_bind_expression as a variable template
(variable template)
exposes std::is_placeholder as a variable template
(variable template)
Defined in header <experimental/memory>
exposes std::uses_allocator as a variable template
(variable template)
Defined in header <experimental/type_traits>
exposes std::is_void as a variable template
(variable template)
exposes std::is_null_pointer as a variable template
(variable template)

Feature test macros

Defined in header <experimental/optional>
__cpp_lib_experimental_optional
a value of at least 201411 indicates that the optional type is supported
(macro constant)
Defined in header <experimental/any>
__cpp_lib_experimental_any
a value of at least 201411 indicates that the any type is supported
(macro constant)
Defined in header <experimental/string_view>
__cpp_lib_experimental_string_view
a value of at least 201411 indicates that basic_string_view template is supported
(macro constant)
Defined in header <experimental/tuple>
__cpp_lib_experimental_apply
a value of at least 201402 indicates that the tuple apply() function is supported
(macro constant)
Defined in header <experimental/type_traits>
__cpp_lib_experimental_type_trait_variable_templates
a value of at least 201402 indicates that variable template type traits are supported
(macro constant)
Defined in header <experimental/type_traits>
__cpp_lib_experimental_invocation_type
a value of at least 201406 indicates that invocation type traits are supported
(macro constant)
Defined in header <experimental/functional>
__cpp_lib_experimental_boyer_moore_searching
a value of at least 201411 indicates that additional searching algorithms are supported
(macro constant)
Defined in header <experimental/functional>
__cpp_lib_experimental_function_erased_allocator
a value of at least 201406 indicates that type-erased allocator for std::function is supported
(macro constant)
Defined in header <experimental/future>
__cpp_lib_experimental_promise_erased_allocator
a value of at least 201406 indicates that type-erased allocator for std::promise is supported
(macro constant)
Defined in header <experimental/future>
__cpp_lib_experimental_packaged_task_erased_allocator
a value of at least 201406 indicates that type-erased allocator for std::packaged_task is supported
(macro constant)
Defined in header <experimental/memory>
__cpp_lib_experimental_shared_ptr_arrays
a value of at least 201406 indicates that shared_ptr arrays are supported
(macro constant)
__cpp_lib_experimental_memory_resources
a value of at least 201402 indicates that polymorphic memory resources are supported
(macro constant)
Defined in header <experimental/algorithm>
__cpp_lib_experimental_sample
a value of 201402 indicates that the sample algorithm is supported
(macro constant)