From 975b95a3eb8cafdc41fd043d1e18abf9d5598499 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Fri, 10 Nov 2023 14:32:38 +0100 Subject: [PATCH] Adding Storage_Pool attribute/aspect to the code example --- .../anonymous_access_types.rst | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst b/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst index 729c07b8d..174d94fd4 100644 --- a/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst +++ b/content/courses/advanced-ada/parts/resource_management/anonymous_access_types.rst @@ -472,8 +472,18 @@ for anonymous access-to-object types: -- Having a specific storage pool associated -- with the access type: + type String_Access is + access String; + -- Automatically creates + -- String_Access'Storage_Pool + type Integer_Access is - access Integer; + access Integer + with Storage_Pool => + String_Access'Storage_Pool; + -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + -- Using the pool from another + -- access type. -- Specifying a deallocation function for the -- access type: @@ -501,7 +511,10 @@ cannot use for the anonymous :ada:`access Integer` type, but that are available for equivalent named access types: - There's no specific memory pool associated with the access object :ada:`IA`. - In contrast the :ada:`Integer_Access` has an associated pool. + In contrast, named types |mdash| such as :ada:`String_Access` and + :ada:`Integer_Access` |mdash| have an associated pool, and we can use the + :ada:`Storage_Pool` aspect and the :ada:`Storage_Pool` attribute to + customize them. - We cannot instantiate the :ada:`Ada.Unchecked_Deallocation` procedure for the :ada:`access Integer` type. However, we can instantiate it for named