Espaces de noms
Variantes
Affichages
Actions

std::scoped_allocator_adaptor::construct

De cppreference.com

 
 
La gestion dynamique de la mémoire
Faible niveau de gestion de la mémoire
Répartiteurs
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 initialisée stockage
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
Pointeurs intelligents
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 (obsolète)
owner_less (C++11)
enable_shared_from_this (C++11)
bad_weak_ptr (C++11)
default_delete (C++11)
Soutien garbage collection
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)
Divers
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)
Bibliothèque C
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
Les fonctions membres
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
Tiers fonctions
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)
Construit un objet dans alloué, mais pas de stockage initialisé pointé par p utilisant OuterAllocator et les arguments du constructeur fournis. Si l'objet est de type que lui-même utilise les répartiteurs, ou si elle est std :: pair, passe InnerAllocator vers l'objet construit .
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.
Tout d'abord, détermine le type d'allocation extérieur OUTERMOST: c'est le type qui doit être retourné en appelant this->outer_allocator(), puis en appelant la fonction membre outer_allocator() récursivement sur le résultat de cet appel jusqu'à ce qu'il atteigne le type qui n'a pas de fonction membre. Ce type est l'allocateur extérieur .
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.
Puis:
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)
Si std::uses_allocator<T, inner_allocator_type>::value==false (le type de T ne pas utiliser les répartiteurs) et si std::is_constructible<T, Args...>::value==true, puis appelle
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)... );

Sinon, si std::uses_allocator<T, inner_allocator_type>::value==true (le T type utilise les répartiteurs, par exemple, il s'agit d'un conteneur) et si std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, puis appelle
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)... );

Sinon, std::uses_allocator<T, inner_allocator_type>::value==true (le T type utilise les répartiteurs, par exemple, il s'agit d'un conteneur) et si std::is_constructible<T, Args..., inner_allocator_type>::value==true, puis appelle
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());

Dans le cas contraire, une erreur de compilation est émis, car même si std::uses_allocator<T> affirmé que T est allocateur-conscient, il lui manque les deux formes de l'allocateur acceptant les constructeurs .
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)
Tout d'abord, si l'une ou T1 T2 est allocateur-courant, modifie les tuples x et y d'inclure l'allocation appropriée intérieure, résultant dans les deux nouveaux tuples xprime et yprime, selon les trois règles suivantes:
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) si T1 n'est pas d'allocation-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, puis xprime est x, non modifié. (Il est également nécessaire que 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) si T1 est allocateur-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), et son constructeur prend un tag allocateur ( std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, puis xprime est
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) si T1 est allocateur-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), et son constructeur prend l'allocateur comme dernier argument (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), puis xprime est 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.
Les mêmes règles s'appliquent à T2 et le remplacement de y avec 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.
Une fois xprime et yprime sont construits (ce qui exige aussi que tous les types de args1 ... et ... Args2 sont CopyConstructible), construit le p paire de stockage alloué par téléphone
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)
Équivalent à construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), c'est-à-passe interne sur le dispositif d'attribution de types de membres de la paire s'ils les acceptent .
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)
Équivalent à
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)
Équivalent à
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)
Équivalent à
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)))

Sommaire

[modifier] Paramètres

p -
pointeur alloué, mais non initialisé stockage
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... -
le constructeur arguments à passer au constructeur de 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 -
le constructeur arguments à passer au constructeur de 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 -
le constructeur arguments à passer au constructeur de 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 paire dont les deux membres sont les arguments du constructeur pour T1 et 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.

[modifier] Retourne la valeur

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

[modifier] Notes

Cette fonction est appelée (par std::allocator_traits) par n'importe quel objet allocateur-courant, comme std::vector, qui a été donné un std::scoped_allocator_adaptor que l'allocateur à utiliser. Depuis inner_allocator est elle-même une instance de std::scoped_allocator_adaptor, cette fonction sera également appelée lorsque l'objet allocateur-aware construits par cette fonction démarre la construction de leurs propres membres .
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.

[modifier] Voir aussi

[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
construit un objet à l'emplacement alloué
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.

(fonction générique) [edit]
construit un objet de stockage alloué
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.

(fonction membre publique de std::allocator) [edit]