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

FreeBSD Manual Pages

  
 
  

home | help
std::experi...iew::compare(3) C++ Standard Libarystd::experi...iew::compare(3)

NAME
       std::experimental::basic_string_view::compare  -	std::experimental::ba-
       sic_string_view::compare

Synopsis
	  constexpr int	compare(basic_string_view v) const	 (1)  (library
       fundamentals TS)
	  noexcept;
	  constexpr int	compare(size_type pos1,	size_type
	  count1,						  (2) (library
       fundamentals TS)
	  basic_string_view v) const
	  constexpr int	compare(size_type pos1,	size_type
	  count1, basic_string_view v,				 (3)  (library
       fundamentals TS)
	  size_type pos2, size_type count2) const;
	  constexpr  int compare(const CharT* s) const;		  (4) (library
       fundamentals TS)
	  constexpr int	compare(size_type pos1,	size_type
	  count1,						 (5)  (library
       fundamentals TS)
	  const	CharT* s) const;
	  constexpr int	compare(size_type pos1,	size_type
	  count1,						  (6) (library
       fundamentals TS)
	  const	CharT* s, size_type count2) const;

	  Compares two character sequences.

	  1) The length	rlen of	the sequences to compare  is  the  smaller  of
       size() and
	  v.size().   The   function   compares	  the  two  views  by  calling
       traits::compare(data(),
	  v.data(), rlen), and returns a value according to the	following  ta-
       ble:

				Condition				Result
       Return value
	  Traits::compare(data(), v.data(), rlen) < 0		 this is  less
       <0
								 than v
						       size()  <  this is less
       <0
						       v.size()	 than v
	  Traits::compare(data(), v.data(), rlen) == 0 size() == this is equal
       to 0
						       v.size()	 v
						       size()	>    this   is
       greater	>0
						       v.size()	 than v
	  Traits::compare(data(),  v.data(),  rlen)  >	0	      this  is
       greater	>0
								 than v

	  2) Equivalent	to substr(pos1,	count1).compare(v).
	  3)   Equivalent   to	 substr(pos1,	count1).compare(v.substr(pos2,
       count2)).
	  4) Equivalent	to compare(basic_string_view(s)).
	  5) Equivalent	to substr(pos1,	count1).compare(basic_string_view(s)).
	  6)  Equivalent  to substr(pos1, count1).compare(basic_string_view(s,
       count2)).

Parameters
	  v	 - view	to compare
	  s	 - pointer to the character string to compare to
	  count1 - number of characters	of this	view to	compare
	  pos1	 - position of the first character in this view	to compare
	  count2 - number of characters	of the given view to compare
	  pos2	 - position of the first character of the given	view  to  com-
       pare

Return value
	  negative  value  if  this  view is less than the other character se-
       quence, zero if the
	  both character sequences are equal, positive value if	this  view  is
       greater than the
	  other	character sequence.

Complexity
	  1) Linear in the number of characters	compared.

See also
	  operator==
	  operator!=
	  operator<  lexicographically compares	two views
	  operator>  (function template)
	  operator<=
	  operator>=

http://cppreference.com		  2022.07.31	 std::experi...iew::compare(3)

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

home | help