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::signed_integral(3) C++ Standard Libary std::signed_integral(3)

std::signed_integral - std::signed_integral


Defined in header <concepts>
template < class T > (since C++20)
concept signed_integral = std::integral<T> && std::is_signed_v<T>;


The concept signed_integral<T> is satisfied if and only if T is an integral type and
std::is_signed_v<T> is true.


signed_integral<T> may be satisfied by a type that is not a signed integer type, for
example, char (on a system where char is signed).

// Run this code


#include <concepts>
#include <iostream>


void print(std::signed_integral auto i) {
std::cout << "Signed integral: " << i << '\n';
}


void print(std::unsigned_integral auto u) {
std::cout << "Unsigned integral: " << u << '\n';
}


void print(auto x) {
std::cout << "Non-integral: " << x << '\n';
}


int main() {
print(42); // signed
print(0xFull); // unsigned
print(true); // unsigned
print('A'); // platform-dependent
print(4e-2); // non-integral (hex-float)
print("∫∫∫"); // non-integral
}


Signed integral: 42
Unsigned integral: 15
Unsigned integral: 1
Signed integral: A
Non-integral: 0.04
Non-integral: ∫∫∫


is_integral checks if a type is an integral type
(C++11) (class template)
is_signed checks if a type is a signed arithmetic type
(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.