Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::uses_allocator(3)	      C++ Standard Libary	std::uses_allocator(3)

NAME
       std::uses_allocator - std::uses_allocator

Synopsis
	  Defined in header <tuple>
	  template< class... Types, class Alloc	>
	  struct    uses_allocator<    std::tuple<Types...>,	Alloc	 >   :
       std::true_type  (since C++11)
	  { };

	  This specialization of  std::uses_allocator  informs	other  library
       components that
	  tuples  support uses-allocator construction, even though they	do not
       have a nested
	  allocator_type.

Member constants
	  value	   true
	  [static] (public static member constant)

Member functions
	  operator bool	converts the object to bool, returns value
			(public	member function)
	  operator()	returns	value
	  (C++14)	(public	member function)

Member types
	  Type	     Definition
	  value_type bool
	  type	     std::integral_constant<bool, value>

Example
	// myalloc is a	stateful Allocator with	a single-argument constructor
	// that	takes an int. It has no	default	constructor.

	    using innervector_t	= std::vector<int, myalloc<int>>;
	    using elem_t = std::tuple<int, innervector_t>;
	    using  Alloc  =  std::scoped_allocator_adaptor<   myalloc<elem_t>,
       myalloc<int>>;

	    Alloc a(1,2);
	    std::vector<elem_t,	Alloc> v(a);
	    v.resize(1);		  // uses allocator #1 for elements of
       v
	    std::get<1>(v[0]).resize(10);  //  uses allocator #2 for innervec-
       tor_t

See also
	  uses_allocator checks	if the specified type supports	uses-allocator
       construction
	  (C++11)	 (class	template)

http://cppreference.com		  2024.06.10		std::uses_allocator(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::uses_allocator&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help