Namespace
Varianti

std::scoped_allocator_adaptor::construct

Da cppreference.com.

 
 
Gestione della memoria dinamica
Basso livello di gestione della memoria
Allocatori
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
allocator
allocator_traits(C++11)
allocator_arg_t(C++11)
allocator_arg(C++11)
uses_allocator(C++11)
scoped_allocator_adaptor(C++11)
Non inizializzata stoccaggio
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
uninitialized_copy
uninitialized_copy_n(C++11)
uninitialized_fill
uninitialized_fill_n
raw_storage_iterator
get_temporary_buffer
return_temporary_buffer
Puntatori intelligenti
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unique_ptr(C++11)
shared_ptr(C++11)
weak_ptr(C++11)
auto_ptr(deprecato)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
Garbage collection supporto
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declare_reachable(C++11)
undeclare_reachable(C++11)
declare_no_pointers(C++11)
undeclare_no_pointers(C++11)
pointer_safety(C++11)
get_pointer_safety(C++11)
Varie
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pointer_traits(C++11)
addressof(C++11)
align(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::scoped_allocator_adaptor
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
scoped_allocator_adaptor::scoped_allocator_adaptor
scoped_allocator_adaptor::~scoped_allocator_adaptor
scoped_allocator_adaptor::inner_allocator
scoped_allocator_adaptor::outer_allocator
scoped_allocator_adaptor::allocate
scoped_allocator_adaptor::deallocate
scoped_allocator_adaptor::max_size
scoped_allocator_adaptor::construct
scoped_allocator_adaptor::destroy
scoped_allocator_adaptor::select_on_container_copy_construction
Non membri funzioni
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator==
operator!=
 
Defined 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)
Costruisce un oggetto allocato, ma non inizializzato stoccaggio puntato da p utilizzando OuterAllocator e gli argomenti del costruttore fornite. Se l'oggetto è di tipo che si utilizza allocatore, o se è std :: pair, passa InnerAllocator verso l'oggetto costruito.
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.
Prima, determina il tipo più esterno allocatore OUTERMOST: è il tipo che verrebbe restituito chiamando this->outer_allocator(), e quindi chiamando la funzione membro outer_allocator() ricorsivamente sul risultato di questa chiamata fino a raggiungere il tipo che non ha funzione di tale membro. Questo tipo è il più esterno allocatore.
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.
Quindi:
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)
Se std::uses_allocator<T, inner_allocator_type>::value==false (il T tipo non fa uso di ripartitori) e se std::is_constructible<T, Args...>::value==true, poi chiama
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)... );

In caso contrario, se std::uses_allocator<T, inner_allocator_type>::value==true (il T tipo utilizza allocatore, ad esempio, si tratta di un contenitore) e se std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, poi chiama
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)... );

In caso contrario, std::uses_allocator<T, inner_allocator_type>::value==true (il T tipo utilizza allocatore, ad esempio, si tratta di un contenitore) e se std::is_constructible<T, Args..., inner_allocator_type>::value==true, poi chiama
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());

In caso contrario, errore di compilazione viene emesso perché, anche se ha affermato che std::uses_allocator<T> T è allocatore-aware, è priva di qualsiasi forma di allocatore-costruttori che accettano.
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)
In primo luogo, se uno o T1 T2 è allocatore-aware, modifica le tuple x e y per includere l'allocatore appropriato interno, con conseguente due tuple nuove xprime e yprime, secondo le seguenti tre regole:
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.
2 bis) se non è T1 allocatore-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, allora xprime è x, non modificato. (Si richiede inoltre che 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) se T1 è allocatore-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), e il suo costruttore accetta un tag allocatore ( std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, allora è xprime
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) se T1 è allocatore-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), e il suo costruttore prende l'allocatore come ultimo argomento (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), allora è xprime 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.
Le stesse regole si applicano a T2 e la sostituzione di y con 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.
Una volta xprime e yprime sono costruiti (questo richiede anche che tutti i tipi di args1... e... sono Args2 CopyConstructible), costruisce la p coppia in memoria allocata chiamando
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)
Equivalente a construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), cioè, passa l'allocatore interna a tipi di membri della coppia se li accettano.
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)
Equivalente a
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)
Equivalente a
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)
Equivalente a
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)))

Indice

[modifica] Parametri

p -
puntatore assegnato, ma non inizializzata archiviazione
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... -
del costruttore argomenti da passare al costruttore di T
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 -
del costruttore argomenti da passare al costruttore di T1
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 -
del costruttore argomenti da passare al costruttore di T2
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 -
la coppia i cui due membri sono gli argomenti del costruttore per T1 e 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.

[modifica] Valore di ritorno

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

[modifica] Note

Questa funzione viene chiamata (tramite std::allocator_traits) da qualsiasi allocatore-consapevoli oggetto, come std::vector, che è stato dato un std::scoped_allocator_adaptor come allocatore di utilizzare. Poiché inner_allocator stessa è un esempio di std::scoped_allocator_adaptor, questa funzione sarà anche chiamato quando l'allocatore-aware oggetti costruiti attraverso questa funzione iniziare a costruire i propri membri.
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.

[modifica] Vedi anche

[statico]
costruisce un oggetto nella memoria allocata
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.

(funzione di modello) [edit]
costruisce un oggetto nella memoria allocata
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.

(membro pubblico of std::allocator funzione) [edit]