[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/types/is_copy_assignable [Back]  [Original]

std::is_copy_assignable, std::is_trivially_copy_assignable, std::is_nothrow_copy_assignable cppreference.com
cppreference.com

std::is_copy_assignable, std::is_trivially_copy_assignable, std::is_nothrow_copy_assignable

cppreference.com
 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
(C++11)
(C++14)  
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)( C++20*)
(C++11)( C++20)
(C++11)
(C++17)
(C++11)(C++11)(C++11)
(C++11)( C++23)
(C++11)( C++23)
(C++11)
(C++11)
(C++17)

(C++11)( C++20*)(C++17)
 
<tbody> </tbody>
template< class T > struct is_copy_assignable;
(1) ( C++11)
template< class T > struct is_trivially_copy_assignable;
(2) ( C++11)
template< class T > struct is_nothrow_copy_assignable;
(3) ( C++11)
1) T , (.., , cv- void cv- ), - value, false. - value, std::is_assignable<T&, const T&>::value.
2) , (1), std::is_trivially_assignable<T&, const T&>
3) , (1), std::is_nothrow_assignable<T&, const T&>

T , (, cv-) void . .

, , , .

, , .

<tbody> </tbody>
template< class T > inline constexpr bool is_copy_assignable_v = is_copy_assignable<T>::value;
( C++17)
template< class T > inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<T>::value;
( C++17)
template< class T > inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<T>::value;
( C++17)

std::integral_constant

value
[static]
true, T , false
(public static -)

-

operator bool
bool, value
(public -)
operator()
(C++14)
value
(public -)

value_type bool
type std::integral_constant<bool, value>

template< class T>
struct is_copy_assignable
    : std::is_assignable< typename std::add_lvalue_reference<T>::type,
                          typename std::add_lvalue_reference<const T>::type> {};

template< class T>
struct is_trivially_copy_assignable
    : std::is_trivially_assignable< typename std::add_lvalue_reference<T>::type,
                                    typename std::add_lvalue_reference<const T>::type> {};

template< class T>
struct is_nothrow_copy_assignable
    : std::is_nothrow_assignable< typename std::add_lvalue_reference<T>::type,
                                  typename std::add_lvalue_reference<const T>::type> {};

std::is_copy_assignable , CopyAssignable, ( CopyAssignable T) , . , T MoveAssignable, CopyAssignable.

#include <iostream>
#include <utility>
#include <type_traits>
struct Foo { int n; };
int main() {
    std::cout << std::boolalpha
              << "Foo     ? "
              << std::is_trivially_copy_assignable<Foo>::value << '\n'
              << "int[2]    ? "
              << std::is_copy_assignable<int[2]>::value << '\n'
              << "int      ? "
              << std::is_nothrow_copy_assignable<int>::value << '\n';
}

:

Foo     ? true
int[2]    ? false
int      ? true

,
( ) []
,
( ) []

Web Proxy Viewer  |  New URL  |  Original Page