xtd 1.0.0
Loading...
Searching...
No Matches
value_type.hpp
Go to the documentation of this file.
1
4#pragma once
5#define __XTD_STD_INTERNAL__
7#undef __XTD_STD_INTERNAL__
8#include "raw_type.hpp"
9#include <concepts>
10#include <iostream>
11#include <type_traits>
12
14namespace xtd {
16
30 template<typename type_t>
31 struct value_type {
33
36 using native_type = type_t;
38
40
43 constexpr value_type() noexcept = default;
46 template<typename other_t>
47 requires std::is_same_v<xtd::raw_type<other_t>, native_type> && (!std::is_same_v<xtd::raw_type<other_t>, value_type>)
48 constexpr value_type(other_t&& value) noexcept : __t__ {value} {}
50
52 template<typename other_t>
53 requires std::is_same_v<xtd::raw_type<other_t>, native_type> && (!std::is_same_v<xtd::raw_type<other_t>, value_type>)
54 auto operator =(other_t&& value) noexcept -> value_type& {__t__ = value; return *this;}
55 [[nodiscard]] constexpr operator native_type() const noexcept {return __t__;}
56 native_type __t__ {};
58 };
59
60
62 template<typename type_t>
63 auto operator <<(std::ostream& os, const xtd::value_type<type_t>& v) -> std::ostream& {return os << v.__t__;}
64 inline auto operator <<(std::ostream& os, const xtd::value_type<bool>& v) -> std::ostream& {return os << (v ? "true" : "false");}
66}
std::remove_cvref_t< value_t > raw_type
Represents a raw type alias equivalent to std::remove_cvref_t<value_t>.
Definition raw_type.hpp:25
@ v
The V key.
Definition console_key.hpp:130
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
type_t value_type
Represents the read_only_span value type.
Definition read_only_span.hpp:63
Contains xtd::raw_type alias.
type_t native_type
Represents the native type.
Definition value_type.hpp:36
constexpr value_type() noexcept=default
Create a new instance of the value_type.