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

FreeBSD Manual Pages

  
 
  

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

NAME
       std::convertible_to - std::convertible_to

Synopsis
	  Defined in header <concepts>
	  template< class From,	class To >

	  concept convertible_to =
	      std::is_convertible_v<From, To> &&	  (since C++20)
	      requires {
		  static_cast<To>(std::declval<From>());

	      };

	  The concept convertible_to<From, To> specifies that an expression of
       the same	type
	  and  value  category as those	of std::declval<From>()	can be implic-
       itly and	explicitly
	  converted to the type	To, and	the two	forms  of  conversion  produce
       equal results.

	  Semantic requirements

	  convertible_to<From, To> is modeled only if, given a function	fun of
       type
	  std::add_rvalue_reference_t<From>()  such  that the expression fun()
       is
	  equality-preserving,

	    * Either
		 * To is neither an  object  type  nor	a  reference-to-object
       type, or
		 *  static_cast<To>(fun())  is	equal  to  []()	-> To {	return
       fun(); }(), and
	    * One of the following is true:
		 * std::add_rvalue_reference_t<From> is	not a reference-to-ob-
       ject type, or
		 * std::add_rvalue_reference_t<From> is	an rvalue reference to
       a
		   non-const-qualified type, and the resulting	state  of  the
       object referenced
		   by  fun()  is valid but unspecified after either expression
       above; or
		 * the object referred to by fun() is not modified  by	either
       expression above.

	  Equality preservation

	  Expressions declared in requires expressions of the standard library
       concepts	are
	  required to be equality-preserving (except where stated otherwise).

See also
	  is_convertible
	  is_nothrow_convertible  checks  if  a	 type  can be converted	to the
       other type
	  (C++11)		 (class	template)
	  (C++20)

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

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

home | help