GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::same_as(3) C++ Standard Libary std::same_as(3)

std::same_as - std::same_as


Defined in header <concepts>
template < class T, class U > (since C++20)
concept same_as = /* see below */;


The concept same_as<T, U> is satisfied if and only if T and U denote the same type.


std::same_as<T, U> subsumes std::same_as<U, T> and vice versa.


namespace detail {
template< class T, class U >
concept SameHelper = std::is_same_v<T, U>;
}


template< class T, class U >
concept same_as = detail::SameHelper<T, U> && detail::SameHelper<U, T>;

// Run this code


#include <concepts>
#include <iostream>


template<typename T, typename ... U>
concept IsAnyOf = (std::same_as<T, U> || ...);


template<typename T>
concept IsPrintable = std::integral<T> || std::floating_point<T> ||
IsAnyOf<std::remove_cvref_t<std::remove_pointer_t<std::decay_t<T>>>, char, wchar_t>;


void println(IsPrintable auto const ... arguments)
{
(std::wcout << ... << arguments) << '\n';
}


int main() { println("Example: ", 3.14, " : ", 42, " : [", 'a', L'-', L"Z]"); }


Example: 3.14 : 42 : [a-Z]


is_same checks if two types are the same
(C++11) (class template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.