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

std::floating_point - std::floating_point


Defined in header <concepts>
template < class T > (since C++20)
concept floating_point = std::is_floating_point_v<T>;


The concept floating_point<T> is satisfied if and only if T is a floating-point
type.

// Run this code


#include <concepts>
#include <iostream>
#include <type_traits>


constexpr std::floating_point auto x2(std::floating_point auto x) {
return x + x;
}


constexpr std::integral auto x2(std::integral auto x) {
return x << 1;
}


int main() {
constexpr auto d = x2(1.1);
static_assert(std::is_same_v<double const, decltype(d)>);
std::cout << d << '\n';


constexpr auto f = x2(2.2f);
static_assert(std::is_same_v<float const, decltype(f)>);
std::cout << f << '\n';


constexpr auto i = x2(444);
static_assert(std::is_same_v<int const, decltype(i)>);
std::cout << i << '\n';
}


2.2
4.4
888


is_floating_point checks if a type is a floating-point 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.