◐ Shell
clean mode source ↗

std::scoped_allocator_adaptor::construct – cppreference.com

<metanoindex/>

<tbody> </tbody>

definiert in Header

<scoped_allocator>

template < class T, class... Args > void construct( T* p, Args&&... args )

(1)

template< class T1, class T2, class... Args1, class... Args2 > void construct( std::pair<T1, T2>* p, std::piecewise_construct_t, std::tuple<Args1...> x, std::tuple<Args2...> y )

(2)

template< class T1, class T2 > void construct( std::pair<T1, T2>* p )

(3)

template< class T1, class T2, class U, class V > void construct( std::pair<T1, T2>* p, U&& x, V&& y )

(4)

template< class T1, class T2, class U, class V > void construct( std::pair<T1, T2>* p, const std::pair<U, V>& xy )

(5)

template< class T1, class T2, class U, class V > void construct( std::pair<T1, T2>* p, std::pair<U, V>&& xy );

(6)

Erzeugt ein Objekt in zugeordnet, aber nicht initialisiert Speicher, auf den p mit OuterAllocator und die vorgesehenen Konstruktorargumente. Wenn das Objekt vom Typ dass selbst verwendet Zuordnern, oder wenn es std :: Paar ist, übergibt InnerAllocator auf dem aufgebauten Objekt .

Original:

Constructs an object in allocated, but not initialized storage pointed to by p using OuterAllocator and the provided constructor arguments. If the object is of type that itself uses allocators, or if it is std::pair, passes InnerAllocator down to the constructed object.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Zuerst bestimmt die äußerste allocator Typ OUTERMOST: es ist die Art, die durch den Aufruf this->outer_allocator(), und rufen dann die outer_allocator() Member-Funktion rekursiv auf das Ergebnis dieses Aufrufs bis zum Erreichen der Typ, der keine solche Member-Funktion ist zurückgekehrt wäre. Diese Art ist die äußerste Zuordner .

Original:

First, determines the outermost allocator type OUTERMOST: it is the type that would be returned by calling this->outer_allocator(), and then calling the outer_allocator() member function recursively on the result of this call until reaching the type that has no such member function. That type is the outermost allocator.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Dann:

Original:

Then:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

1)

Wenn std::uses_allocator<T, inner_allocator_type>::value==false (die Art T nicht verwendet Zuweiser) und wenn std::is_constructible<T, Args...>::value==true, dann ruft

Original:

If std::uses_allocator<T, inner_allocator_type>::value==false (the type T does not use allocators) and if std::is_constructible<T, Args...>::value==true, then calls

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this), p, std::forward<Args>(args)... );

Andernfalls, wenn std::uses_allocator<T, inner_allocator_type>::value==true (die Art T verwendet Zuweiser, zB ein Container ist) und wenn std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, dann ruft

Original:

Otherwise, if std::uses_allocator<T, inner_allocator_type>::value==true (the type T uses allocators, e.g. it is a container) and if std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, then calls

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this), p, std::allocator_arg, inner_allocator(), std::forward<Args>(args)... );

Ansonsten std::uses_allocator<T, inner_allocator_type>::value==true (die Art T verwendet Zuweiser, zB ist es ein Container), und wenn std::is_constructible<T, Args..., inner_allocator_type>::value==true, dann ruft

Original:

Otherwise, std::uses_allocator<T, inner_allocator_type>::value==true (the type T uses allocators, e.g. it is a container) and if std::is_constructible<T, Args..., inner_allocator_type>::value==true, then calls

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this), p, std::forward<Args>(args)..., inner_allocator());

Andernfalls wird Kompilierungsfehler ausgegeben, denn obwohl std::uses_allocator<T>, dass T Allocator-aware vorliegt, ist es entweder Form Allocator-akzeptierenden Konstruktoren fehlt .

Original:

Otherwise, compilation error is issued because although std::uses_allocator<T> claimed that T is allocator-aware, it lacks either form of allocator-accepting constructors.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2)

Erstens, wenn entweder T1 oder T2 Zuordner-bekannt ist, ändert die Tupel und x y passende innere Zuordner beinhalten, was in den zwei neuen Tupeln xprime und yprime, gemäß den drei folgenden Regeln:

Original:

First, if either T1 or T2 is allocator-aware, modifies the tuples x and y to include the appropriate inner allocator, resulting in the two new tuples xprime and yprime, according to the following three rules:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2a), wenn T1 nicht Allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, dann xprime ist x, unverändert. (Es ist auch erforderlich, dass std::is_constructible<T1, Args1...>::value==true)

Original:

2a) if T1 is not allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, then xprime is x, unmodified. (it is also required that std::is_constructible<T1, Args1...>::value==true)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2b), wenn T1 ist allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true) und seine Konstruktor nimmt einen Zuordner tag ( std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, dann xprime ist

Original:

2b) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes an allocator tag (std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, then xprime is

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::tuple_cat( std::tuple<std::allocator_arg_t, inner_allocator_type&>( std::allocator_arg, inner_allocator_type() ), x)

2c), wenn T1 ist allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true) und seinem Konstruktor nimmt die Zuweisung als letztes Argument (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), dann xprime ist std::tuple_cat(x, std::tuple<inner_allocator_type&>(inner_allocator_type())) .

Original:

2c) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes the allocator as the last argument (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), then xprime is std::tuple_cat(x, std::tuple<inner_allocator_type&>(inner_allocator_type())).

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Dieselben Regeln gelten für T2 und der Austausch von y mit yprime

Original:

Same rules apply to T2 and the replacement of y with yprime

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sobald xprime und yprime konstruiert sind (dies erfordert auch, dass alle Typen in Args1 ... und Args2 ... CopyConstructible sind), baut das Paar p in zugewiesenen Lagerstätten durch den Aufruf

Original:

Once xprime and yprime are constructed (this also requires that all types in Args1... and Args2... are CopyConstructible), constructs the pair p in allocated storage by calling

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this), p, std::piecewise_construct, xprime, yprime);

3)

Entspricht construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), das heißt, geht die innere allocator auf des Paares Mitglied Typen, wenn sie sie zu akzeptieren .

Original:

Equivalent to construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), that is, passes the inner allocator on to the pair's member types if they accept them.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

4)

Entspricht

Original:

Equivalent to

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

construct(p, std::piecewise_construct, std::forward_as_tuple(std::forward<U>(x)), std::forward_as_tuple(std::forward<V>(y)))

5)

Entspricht

Original:

Equivalent to

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

construct(p, std::piecewise_construct, std::forward_as_tuple(xy.first), std::forward_as_tuple(xy.second))

6)

Entspricht

Original:

Equivalent to

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

construct(p, std::piecewise_construct, std::forward_as_tuple(std::forward<U>(xy.first)), std::forward_as_tuple(std::forward<V>(xy.second)))

Parameter

p -

Zeiger auf reservierten, aber nicht initialisiert Lagerung

Original:

pointer to allocated, but not initialized storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

args... -

der Konstruktor Argumente an den Konstruktor T passieren

Original:

the constructor arguments to pass to the constructor of T

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

x -

der Konstruktor Argumente an den Konstruktor T1 passieren

Original:

the constructor arguments to pass to the constructor of T1

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

y -

der Konstruktor Argumente an den Konstruktor T2 passieren

Original:

the constructor arguments to pass to the constructor of T2

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

xy -

das Paar, dessen zwei Mitglieder sind die Konstruktor Argumente für T1 und T2

Original:

the pair whose two members are the constructor arguments for T1 and T2

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Rückgabewert

(None)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Notes

Diese Funktion wird aufgerufen (durch std::allocator_traits) von jedem Zuordner-fähigen Objekt wie std::vector, die einen gegebenen std::scoped_allocator_adaptor als Zuordner zu verwenden war. Da inner_allocator selbst ist ein Beispiel für std::scoped_allocator_adaptor, wird diese Funktion auch aufgerufen, wenn die Zuweisung-aware Objekte durch diese Funktion konstruiert Bau ihrer eigenen Mitglieder zu starten .

Original:

This function is called (through std::allocator_traits) by any allocator-aware object, such as std::vector, that was given a std::scoped_allocator_adaptor as the allocator to use. Since inner_allocator is itself an instance of std::scoped_allocator_adaptor, this function will also be called when the allocator-aware objects constructed through this function start constructing their own members.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Siehe auch

konstruiert ein Objekt in dem zugewiesenen Speicher

Original:

constructs an object in the allocated storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(Funktions-Template) [edit]

baut ein Objekt in zugewiesenen Lagerstätten

Original:

constructs an object in allocated storage

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(öffentliche Elementfunktion of std::allocator) [edit]