msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified Han script) (Boost Json Translation "
"(zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-06 22:46+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese (Simplified Han script) <https://"
"insights.cppalliance.org/weblate/projects/boost-json-documentation-zh_Hans/"
"doc-pages-allocators-storage-ptr-adoc/zh_Hans/>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 2026.5\n"

#: :11
#, safe-html, strict-same
msgid ""
"= `storage_ptr` Variable-length containers in this library all use "
"dynamically allocated memory to store their contents. Callers can gain "
"control over the strategy used for allocation by specifying a "
"<<ref_storage_ptr>> in select constructors and function parameter lists. A "
"<<ref_storage_ptr>> has these properties:"
msgstr ""
"= `storage_ptr` 本库中的可变长度容器均使用动态分配的内存来存储其内容。调用方"
"可通过在特定构造函数和函数参数列表中指定 &lt;<ref_storage_ptr>&gt; ，以控制所"
"使用的内存分配策略。&lt;<ref_storage_ptr>&gt; 具有以下特性：</"
"ref_storage_ptr></ref_storage_ptr>"

#: :17
#, safe-html, strict-same
msgid "A storage pointer always points to a valid,"
msgstr "存储指针始终指向一个有效的、"

#: :18
#, safe-html, strict-same
msgid "type-erased {ref_memory_resource}."
msgstr "类型擦除后的 {ref_memory_resource}。"

#: :20
#, safe-html, strict-same
msgid "Default-constructed storage pointers reference the"
msgstr "默认构造的存储指针引用"

#: :21
#, safe-html, strict-same
msgid ""
"<<default_memory_resource,default resource>>, an implementation-defined "
"instance which always uses the equivalent of global operator new and delete."
msgstr ""
"&lt;<default_memory_resource,default resource=\"\">&gt;（默认资源），这是一个"
"由实现定义的实例，始终使用等效于全局 operator new 和 operator delete 的方式"
"。</default_memory_resource,default>"

#: :24
#, safe-html, strict-same
msgid "Storage pointers constructed from a {ref_memory_resource} or"
msgstr "从 {ref_memory_resource} 构造的存储指针，或"

#: :25
#, safe-html, strict-same
msgid ""
"{ref_polymorphic_allocator} do not acquire ownership; the caller is "
"responsible for ensuring that the lifetime of the resource extends until it "
"is no longer referenced."
msgstr ""
"从 {ref_polymorphic_allocator} 构造的存储指针，不获取所有权；调用方负责确保资"
"源的生命周期持续到不再被引用为止。"

#: :29
#, safe-html, strict-same
msgid ""
"A storage pointer obtained from <<ref_make_shared_resource>> acquires shared"
msgstr ""
"通过 &lt;<ref_make_shared_resource>&gt; 获取的存储指针会获得</"
"ref_make_shared_resource>"

#: :30
#, safe-html, strict-same
msgid ""
"ownership of the memory resource; the lifetime of the resource is extended "
"until all copies of the storage pointer are destroyed."
msgstr ""
"对内存资源的共享所有权；该资源的生命周期将延长，直至所有该存储指针的副本均被"
"销毁。"

#: :33
#, safe-html, strict-same
msgid ""
"The storage pointer remembers the value of <<ref_is_deallocate_trivial>>"
msgstr ""
"存储指针会记录 &lt;<ref_is_deallocate_trivial>&gt; 的值，</"
"ref_is_deallocate_trivial>"

#: :34
#, safe-html, strict-same
msgid ""
"before type-erasing the resource, allowing the value to be queried at run-"
"time."
msgstr ""
"（&lt;&gt; 值的记录是）在对资源进行类型擦除之前进行的,从而允许在运行时查询该"
"值。"

#: :37
#, safe-html, strict-same
msgid ""
"This lists all of the allocation-related types and functions available when "
"using the library:"
msgstr "此列表列出了在使用该库时可用的所有与分配相关的类型和函数："

#: :41
#, safe-html, strict-same
msgid "Name"
msgstr "Name"

#: :41
#, safe-html, strict-same
msgid "Description"
msgstr "描述"

#: :41
#, safe-html, strict-same
msgid "<<ref_get_null_resource>>"
msgstr "&lt;&gt;"

#: :41
#, safe-html, strict-same
msgid "Returns a pointer to a memory resource instance which always throws an"
msgstr "返回一个指向内存资源实例的指针，该实例总是在"

#: :46
#, safe-html, strict-same
msgid ""
"exception upon allocation. This is used to to achieve the invariant that no "
"parsing or container operation will dynamically allocate memory."
msgstr ""
"分配内存时抛出异常。此机制用于确保解析或容器操作不会进行动态内存分配，从而维"
"持该不变性。"

#: :49
#, safe-html, strict-same
msgid "<<ref_is_deallocate_trivial>>"
msgstr "&lt;<ref_is_deallocate_trivial>&gt;</ref_is_deallocate_trivial>"

#: :49
#, safe-html, strict-same
msgid ""
"A customization point allowing a memory resource type to indicate that calls"
msgstr "一个自定义点，允许内存资源类型表明其"

#: :51
#, safe-html, strict-same
msgid "to deallocate are trivial."
msgstr "deallocate 的调用是平凡的。"

#: :53
#, safe-html, strict-same
msgid "<<ref_make_shared_resource>>"
msgstr "&lt;<ref_make_shared_resource>&gt;</ref_make_shared_resource>"

#: :53
#, safe-html, strict-same
msgid "A function returning a smart pointer with shared ownership of a newly"
msgstr "一个返回智能指针的函数，该智能指针对新"

#: :55
#, safe-html, strict-same
msgid "allocated memory resource."
msgstr "分配的内存资源具有共享所有权。"

#: :57
#, safe-html, strict-same
msgid "{ref_memory_resource}"
msgstr "{ref_memory_resource}"

#: :57
#, safe-html, strict-same
msgid "The abstract base class representing an allocator."
msgstr "表示分配器的抽象基类。"

#: :57
#, safe-html, strict-same
msgid "<<ref_monotonic_resource>>"
msgstr "&lt;<ref_monotonic_resource>&gt;</ref_monotonic_resource>"

#: :57
#, safe-html, strict-same
msgid ""
"A memory resource which allocates large blocks of memory and has a trivial"
msgstr "一种内存资源，用于分配大块内存，且该资源具有平凡的"

#: :62
#, safe-html, strict-same
msgid ""
"deallocate function. Allocated memory is not freed until the resource is "
"destroyed, making it fast for parsing but not suited for performing "
"modifications."
msgstr ""
"deallocate 函数。所分配的内存不会被释放，直到该资源被销毁，因此在解析场景下速"
"度很快，但不适合执行修改操作。"

#: :66
#, safe-html, strict-same
msgid "{ref_polymorphic_allocator}"
msgstr "{ref_polymorphic_allocator}"

#: :66
#, safe-html, strict-same
msgid "An {req_Allocator} which uses a reference to a {ref_memory_resource} to"
msgstr "一个 {req_Allocator}，它通过引用 {ref_memory_resource}"

#: :68
#, safe-html, strict-same
msgid "perform allocations."
msgstr "执行内存分配。"

#: :70
#, safe-html, strict-same
msgid "<<ref_static_resource>>"
msgstr "&lt;<ref_static_resource>&gt;</ref_static_resource>"

#: :70
#, safe-html, strict-same
msgid "A memory resource that uses a single caller provided buffer. No dynamic"
msgstr "一种使用调用方提供的单一缓冲区的内存资源，不进行任何动态"

#: :72
#, safe-html, strict-same
msgid ""
"allocations are used. This is fast for parsing but not suited for performing "
"modifications."
msgstr "分配。该资源在解析时速度很快，但不适合执行修改操作。"

#: :75
#, safe-html, strict-same
msgid "<<ref_storage_ptr>>"
msgstr "&lt;<ref_storage_ptr>&gt;</ref_storage_ptr>"

#: :75
#, safe-html, strict-same
msgid "A smart pointer through which a {ref_memory_resource} is managed and"
msgstr "A smart pointer through which a {ref_memory_resource} is managed and"

#: :77
#, safe-html, strict-same
msgid "accessed. |==="
msgstr "访问. |==="

#: :80
#, safe-html, strict-same
msgid "Default Memory Resource"
msgstr "默认内存资源"

#: :81
#, safe-html, strict-same
msgid ""
"The default memory resource uses the global `operator new` and `operator "
"delete` to allocate memory. This resource is not reference counted and has a "
"non-trivial deallocate function. All default-constructed <<ref_storage_ptr>> "
"objects reference the same memory resource:"
msgstr ""
"默认内存资源使用全局 `operator new` 和 `operator delete` 来进行内存分配。该资"
"源不采用引用计数，且其 deallocate 函数是非平凡的。所有默认构造的 "
"&lt;<ref_storage_ptr>&gt; 对象均引用同一个内存资源：</ref_storage_ptr>"

#: :91
#, safe-html, strict-same
msgid "Default-constructed library containers use the default memory resource:"
msgstr "默认构造的库容器使用默认内存资源："

#: :98
#, safe-html, strict-same
msgid ""
"The default memory resource is well suited for general usage. It offers "
"reasonable performance for parsing, and conservative memory usage for "
"modification of the contents of containers."
msgstr ""
"默认内存资源适用于一般用途。它在解析时提供合理的性能，在修改容器内容时则具有"
"保守的内存使用特性。"

#: :103
#, safe-html, strict-same
msgid ""
"This memory resource is not guaranteed to be the same as the result of "
"`boost::container::pmr::get_default_resource`. It also cannot be changed "
"with `boost::container::pmr::set_default_resource`."
msgstr ""
"该内存资源不保证与 `boost::container::pmr::get_default_resource` 的返回结果相"
"同，也无法通过 `boost::container::pmr::set_default_resource` 进行更改。"

#: :107
#, safe-html, strict-same
msgid "Monotonic Resource"
msgstr "单调资源"

#: :108
#, safe-html, strict-same
msgid ""
"Consider the pattern of memory allocation during parsing: when an array, "
"object, or string is encountered the parser accumulates elements in its "
"temporary storage area. When all of the elements are known, a single memory "
"allocation is requested from the resource when constructing the value. Thus, "
"parsing only allocates and constructs containers at their final size. Memory "
"is not reallocated; that is, a memory buffer never needs to grow by "
"allocating a new larger buffer and deallocating the previous buffer."
msgstr ""
"考虑解析过程中的内存分配模式：当遇到数组、对象或字符串时，解析器会将其元素累"
"积在临时存储区中。当所有元素都已知后，在构造值时会向内存资源发起一次内存分配"
"请求。因此，解析过程仅在容器最终大小确定时进行一次分配和构造，不会发生内存重"
"分配；也就是说，内存缓冲区无需通过分配更大的新缓冲区并释放旧缓冲区的方式来扩"
"容。"

#: :116
#, safe-html, strict-same
msgid ""
"The <<ref_monotonic_resource>> optimizes this memory allocation pattern by "
"allocating increasingly large blocks of global memory internally and "
"parceling those blocks out in smaller pieces to fulfill allocation requests. "
"It has a trivial deallocate function. The monotonic resource does not "
"actually deallocate memory until the resource is destroyed. Thus, it is "
"ideally suited for the use-case where JSON is parsed, and the resulting "
"value is then inspected but not modified."
msgstr ""
"&lt;<ref_monotonic_resource>&gt; 通过在内部分配逐渐增大的全局内存块，并将这些"
"块切分为更小的部分以满足分配请求，从而优化了该内存分配模式。它具有平凡的 "
"deallocate 函数，实际上不会释放内存，直到该资源被销毁。因此，它非常适合用于解"
"析 JSON 后仅检查结果值而不对其进行修改的场景。</ref_monotonic_resource>"

#: :124
#, safe-html, strict-same
msgid ""
"The resource to use when constructing values may be specified in calls to "
"<<ref_parse>> as shown here:"
msgstr ""
"在调用 &lt;<ref_parse>&gt; 时，可按如下方式指定构造值所使用的内存资源：</"
"ref_parse>"

#: :132
#, safe-html, strict-same
msgid "Or, to parse into a value with shared ownership of the memory resource:"
msgstr "或者，可按如下方式解析到一个对内存资源具有共享所有权的值："

#: :139
#, safe-html, strict-same
msgid ""
"A monotonic resource may be optionally constructed with an initial buffer to "
"use first, before going to the heap. This allows the caller to use stack "
"space and avoid dynamic allocations for most parsed JSON, falling back to "
"dynamic allocation from the heap if the input JSON is larger than average, "
"as shown here:"
msgstr ""
"单调资源在构造时可选择性地指定一个初始缓冲区，优先使用该缓冲区，之后才会转而"
"使用堆内存。这使得调用方可以利用栈空间，避免对大多数 JSON 解析进行动态分配；"
"仅当输入的 JSON 大于平均水平时，才会退回到从堆中进行动态分配，如下所示："

#: :150
#, safe-html, strict-same
msgid "Static Resource"
msgstr "静态资源"

#: :151
#, safe-html, strict-same
msgid ""
"A <<ref_static_resource>> constructs from a caller-provided buffer, and "
"satisfies all memory allocation requests from the buffer. Once the buffer is "
"exhausted, subsequent calls to allocate throw the exception "
"`std::bad_alloc`. The resource offers a simple invariant: dynamic heap "
"allocations are never performed."
msgstr ""
"&lt;<ref_static_resource>&gt; 由调用方提供的缓冲区构造而成，并从该缓冲区满足"
"所有内存分配请求。一旦缓冲区耗尽，后续的分配调用将抛出 `std::bad_alloc` 异常"
"。该资源提供一个简单的不变式：永不执行动态堆分配。</ref_static_resource>"

#: :157
#, safe-html, strict-same
msgid "To use the resource, construct it with a local buffer:"
msgstr "要使用该资源，请用一个局部缓冲区对其进行构造："

#: :164
#, safe-html, strict-same
msgid "Null Resource"
msgstr "空资源"

#: :165
#, safe-html, strict-same
msgid ""
"The function <<ref_get_null_resource>> returns a global instance of the null "
"resource. This resource offers a simple invariant: all calls to allocate "
"will throw the exception `std::bad_alloc`. An instance of the null resource "
"can be used to make parsing guarantee that allocations from the heap are "
"never made. This is explored in more detail in a later section."
msgstr ""
"函数 &lt;<ref_get_null_resource>&gt; 返回一个全局的空资源实例。该资源提供一个"
"简单的不变式：所有内存分配调用都会抛出 `std::bad_alloc` 异常。通过使用空资源"
"实例，可确保解析过程绝不会进行堆内存分配。这一点将在后文进一步详细说明。</"
"ref_get_null_resource>"

#: :171
#, safe-html, strict-same
msgid "Allocator Propagation"
msgstr "分配器传播"

#: :172
#, safe-html, strict-same
msgid ""
"The containers <<ref_array>>, <<ref_object>>, and <<ref_value>> all "
"propagate the memory resource they were constructed with to child elements:"
msgstr ""
"容器 &lt;<ref_array>&gt;, &lt;<ref_object>&gt; 和 &lt;<ref_value>&gt; 在构造"
"时所使用的内存资源会自动传播给其子元素：</ref_value></ref_object></ref_array>"

#: :180
#, safe-html, strict-same
msgid ""
"This propagation acts recursively, containers within containers will all "
"have the resource propagated. Once a container is constructed, its memory "
"resource can never be changed."
msgstr ""
"这种传播是递归进行的：嵌套容器中的所有子容器都会获得相同的内存资源。一旦容器"
"被构造，其内存资源就永远无法更改。"

#: :184
#, safe-html, strict-same
msgid "Resource Lifetime"
msgstr "资源生命周期"

#: :185
#, safe-html, strict-same
msgid ""
"It is important to note that <<ref_storage_ptr>> supports both shared-"
"ownership and reference lifetime models. Construction from a memory resource "
"pointer does not transfer ownership:"
msgstr ""
"需要注意的是，&lt;<ref_storage_ptr>&gt; 同时支持共享所有权和引用生命周期模型"
"。从内存资源指针构造时不会转移所有权：</ref_storage_ptr>"

#: :194
#, safe-html, strict-same
msgid ""
"When using a memory resource in this fashion, including the case where a "
"storage pointer or container is constructed from a "
"{ref_polymorphic_allocator}, the caller must ensure that the lifetime of the "
"resource is extended until it is no longer referenced by any variables; "
"otherwise, undefined behavior is possible."
msgstr ""
"以这种方式使用内存资源时（包括从 {ref_polymorphic_allocator} 构造存储指针或容"
"器的情况），调用方必须确保资源的生命周期延长至不再被任何变量引用为止；否则，"
"可能会出现未定义行为。"

#: :200
#, safe-html, strict-same
msgid ""
"Shared ownership is achieved using the function <<ref_make_shared_resource>>"
", which creates a new, reference-counted memory resource using a dynamic "
"memory allocation and returns it as a <<ref_storage_ptr>>:"
msgstr ""
"通过函数 &lt;<ref_make_shared_resource>&gt; 可实现共享所有权，该函数会动态分"
"配内存以创建一个新的、带引用计数的内存资源，并将其以 &lt;<ref_storage_ptr>"
"&gt; 的形式返回：</ref_storage_ptr></ref_make_shared_resource>"

#: :209
#, safe-html, strict-same
msgid ""
"When a storage pointer is constructed this way, the lifetime of the "
"referenced memory resource is extended until all variables which reference "
"it are destroyed."
msgstr ""
"当存储指针以这种方式构造时，其所引用的内存资源的生命周期将延长，直至所有引用"
"它的变量均被销毁为止。"

#: :213
#, safe-html, strict-same
msgid "User-Defined Resource"
msgstr "用户定义资源"

#: :214
#, safe-html, strict-same
msgid ""
"To implement custom memory allocation strategies, derive your class from "
"{ref_memory_resource} and implement the functions `do_allocate`, "
"`do_deallocate`, and `do_is_equal` as seen in this example below, which logs "
"each operation it performs to the console:"
msgstr ""
"要实现自定义内存分配策略，请从 {ref_memory_resource} 派生类，并实现函数 "
"`do_allocate`、`do_deallocate` 和 `do_is_equal`，如下例所示，该示例将其执行的"
"每个操作记录到控制台："
