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

FreeBSD Manual Pages

  
 
  

home | help
deductiongu...forward_list(3) C++ Standard Libarydeductiongu...forward_list(3)

NAME
       deductionguidesforstd::forward_list    -	   deductionguidesforstd::for-
       ward_list

Synopsis
	  Defined in header <forward_list>
	  template< class InputIt,

	  class	Alloc =	std::allocator<typename
	  std::iterator_traits<InputIt>::value_type>>
       (since C++17)
	  forward_list(InputIt,	InputIt, Alloc = Alloc())

	  -> forward_list<typename std::iterator_traits<InputIt>::value_type,
	  Alloc>;

	  This deduction guide is provided for forward_list to allow deduction
       from an
	  iterator range. This overload	participates  in  overload  resolution
       only if InputIt
	  satisfies LegacyInputIterator	and Alloc satisfies Allocator.

	  Note:	 the  extent  to which the library determines that a type does
       not satisfy
	  LegacyInputIterator is unspecified, except that as a	minimum	 inte-
       gral types do not
	  qualify  as input iterators. Likewise, the extent to which it	deter-
       mines that a type
	  does not satisfy Allocator is	unspecified, except that as a  minimum
       the member type
	  Alloc::value_type must exist and the expression
	  std::declval<Alloc&>().allocate(std::size_t{})  must	be well-formed
       when treated as
	  an unevaluated operand.

Example
       // Run this code

	#include <forward_list>
	#include <vector>
	int main() {
	   std::vector<int> v =	{1, 2, 3, 4};

	   // uses explicit deduction guide to deduce std::forward_list<int>
	   std::forward_list x(v.begin(), v.end());

	   // deduces std::forward_list<std::vector<int>::iterator>
	   // first phase of overload resolution for  list-initialization  se-
       lects the candidate
	   //  synthesized from	the initializer-list constructor; second phase
       is not performed	and
	   // deduction	guide has no effect
	   std::forward_list y{v.begin(), v.end()};
	}

http://cppreference.com		  2022.07.31	 deductiongu...forward_list(3)

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

home | help