SlideShare a Scribd company logo
Concepts library
https://en.cppreference.com/w/cpp/header/concepts
three_way_comparable
<compare> 헤더에 정의
three_way_comparable 하다는 아래의 조건을 모두 만족시켜야 한다
(a ⇔ b == 0) == bool(a == b) 가 true
(a ⇔ b != 0) == bool(a != b) 가 true
((a ⇔ b) ⇔ 0) 과 (0 ⇔ (b ⇔ a) 가 상등
(a ⇔ b < 0) == bool(a < b) 가 true
(a ⇔ b > 0) == bool(a > b) 가 true
(a ⇔ b <= 0) == bool(a <= b) 가 true
(a ⇔ b >= 0) == bool(a b) 가 true
core language concepts
<concepts>
관계
same_as : 두 형식이 같음
derived_from : 한 형식이 다른 형식의 파생 형식
convertible_to : 한 형식을 다른 형식으로 변환할 수 있음
common_reference_with : 두 형식을 어떤 공통의 참조 형식으로 변환할 수 있음
common_with : 공통형식이 참조형식이 아니어도 되고, common_type_t<T, U> 와
같다
core language concepts
assignable_from : 한 형식의 값을 다른 형식으로 배정할 수 있음.
swappable : 두 형식의 값을 교환할 수 있음
산술
integral : 정수 형식
signed_integral : 부호 있는 정수 형식
floating_point : 부동소수점 형식
core language concepts
수명
destructible : 파괴 가능
constructible_from : 한 형식으로 다른 형식을 생성할 수 있음
default_initializable : 기본 생성 가능
move_constructible : 이동 생성 가능
copy_constructible : 복사 생성 가능
comparison concepts
<concepts>
equality_comparable : 상등 비교 가능
totally_ordered : 전순서
object concepts
movable : 이동 가능
copyable : 복사 가능
semiregular : 준정규 형식(복사가능, 기본생성자 있음)
regular : 정규 형식(복사가능, 기본생성자 있음, 동등비교 가능 ex. int 처럼)
callable concepts
invocable : 함수 형태로 호출 가능
regular_invocable : invocable을 충족하고, 같은 입력에 대해 같은 출력을 산출하고,
함수 인수들을 수정하지 않아야 한다
predicate : invocable을 충족하고, bool 로 변환가능한 값을 리턴해야 한다

More Related Content

More from 진화 손

C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
C++ 20 Make stateful allocator propagation more consistent for operator+(basi...C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
진화 손
 
C++ 20 Unevaluated asm-declaration in constexpr functions
C++ 20 Unevaluated asm-declaration in constexpr functionsC++ 20 Unevaluated asm-declaration in constexpr functions
C++ 20 Unevaluated asm-declaration in constexpr functions
진화 손
 
C++20 Utility functions to implement uses-allocator construction
C++20 Utility functions to implement uses-allocator constructionC++20 Utility functions to implement uses-allocator construction
C++20 Utility functions to implement uses-allocator construction
진화 손
 
C++ 20 std__reference_wrapper for incomplete types
C++ 20 std__reference_wrapper for incomplete typesC++ 20 std__reference_wrapper for incomplete types
C++ 20 std__reference_wrapper for incomplete types
진화 손
 
C++ 20 Stronger Unicode requirements
C++ 20 Stronger Unicode requirementsC++ 20 Stronger Unicode requirements
C++ 20 Stronger Unicode requirements
진화 손
 
C++20 Coroutine
C++20 CoroutineC++20 Coroutine
C++20 Coroutine
진화 손
 
C++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rulesC++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rules
진화 손
 
C++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rulesC++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rules
진화 손
 
C++20 explicit(bool)
C++20 explicit(bool)C++20 explicit(bool)
C++20 explicit(bool)
진화 손
 
C++20 std::map::contains
C++20 std::map::containsC++20 std::map::contains
C++20 std::map::contains
진화 손
 
C++20 Comparing unordered containers
C++20 Comparing unordered containersC++20 Comparing unordered containers
C++20 Comparing unordered containers
진화 손
 
C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]
진화 손
 
C++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contextsC++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contexts
진화 손
 
C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>
진화 손
 
C++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptrC++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptr
진화 손
 
C++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fieldsC++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fields
진화 손
 
C++ 20 constexpr for algorithm and utility
C++ 20 constexpr for  algorithm and utilityC++ 20 constexpr for  algorithm and utility
C++ 20 constexpr for algorithm and utility
진화 손
 
C++17 init-statements for if and switch
C++17 init-statements for if and switchC++17 init-statements for if and switch
C++17 init-statements for if and switch
진화 손
 
C++17 Aggregate classes with base classes
C++17 Aggregate classes with base classesC++17 Aggregate classes with base classes
C++17 Aggregate classes with base classes
진화 손
 
C++17 std::byte
C++17 std::byteC++17 std::byte
C++17 std::byte
진화 손
 

More from 진화 손 (20)

C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
C++ 20 Make stateful allocator propagation more consistent for operator+(basi...C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
C++ 20 Make stateful allocator propagation more consistent for operator+(basi...
 
C++ 20 Unevaluated asm-declaration in constexpr functions
C++ 20 Unevaluated asm-declaration in constexpr functionsC++ 20 Unevaluated asm-declaration in constexpr functions
C++ 20 Unevaluated asm-declaration in constexpr functions
 
C++20 Utility functions to implement uses-allocator construction
C++20 Utility functions to implement uses-allocator constructionC++20 Utility functions to implement uses-allocator construction
C++20 Utility functions to implement uses-allocator construction
 
C++ 20 std__reference_wrapper for incomplete types
C++ 20 std__reference_wrapper for incomplete typesC++ 20 std__reference_wrapper for incomplete types
C++ 20 std__reference_wrapper for incomplete types
 
C++ 20 Stronger Unicode requirements
C++ 20 Stronger Unicode requirementsC++ 20 Stronger Unicode requirements
C++ 20 Stronger Unicode requirements
 
C++20 Coroutine
C++20 CoroutineC++20 Coroutine
C++20 Coroutine
 
C++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rulesC++ 20 Relaxing the range-for loop customization point finding rules
C++ 20 Relaxing the range-for loop customization point finding rules
 
C++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rulesC++ 20 Relaxing the structured bindings customization point finding rules
C++ 20 Relaxing the structured bindings customization point finding rules
 
C++20 explicit(bool)
C++20 explicit(bool)C++20 explicit(bool)
C++20 explicit(bool)
 
C++20 std::map::contains
C++20 std::map::containsC++20 std::map::contains
C++20 std::map::contains
 
C++20 Comparing unordered containers
C++20 Comparing unordered containersC++20 Comparing unordered containers
C++20 Comparing unordered containers
 
C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]C++20 Attributes [[likely]] and [[unlikely]]
C++20 Attributes [[likely]] and [[unlikely]]
 
C++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contextsC++ 20 Lambdas in unevaluated contexts
C++ 20 Lambdas in unevaluated contexts
 
C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>C++20 Library support for operator<=> <compare>
C++20 Library support for operator<=> <compare>
 
C++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptrC++20 Atomic std::shared_ptr and std::weak_ptr
C++20 Atomic std::shared_ptr and std::weak_ptr
 
C++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fieldsC++20 Default member initializers for bit-fields
C++20 Default member initializers for bit-fields
 
C++ 20 constexpr for algorithm and utility
C++ 20 constexpr for  algorithm and utilityC++ 20 constexpr for  algorithm and utility
C++ 20 constexpr for algorithm and utility
 
C++17 init-statements for if and switch
C++17 init-statements for if and switchC++17 init-statements for if and switch
C++17 init-statements for if and switch
 
C++17 Aggregate classes with base classes
C++17 Aggregate classes with base classesC++17 Aggregate classes with base classes
C++17 Aggregate classes with base classes
 
C++17 std::byte
C++17 std::byteC++17 std::byte
C++17 std::byte
 

C++20 Concepts library

  • 2. three_way_comparable <compare> 헤더에 정의 three_way_comparable 하다는 아래의 조건을 모두 만족시켜야 한다 (a ⇔ b == 0) == bool(a == b) 가 true (a ⇔ b != 0) == bool(a != b) 가 true ((a ⇔ b) ⇔ 0) 과 (0 ⇔ (b ⇔ a) 가 상등 (a ⇔ b < 0) == bool(a < b) 가 true (a ⇔ b > 0) == bool(a > b) 가 true (a ⇔ b <= 0) == bool(a <= b) 가 true (a ⇔ b >= 0) == bool(a b) 가 true
  • 3.
  • 4. core language concepts <concepts> 관계 same_as : 두 형식이 같음 derived_from : 한 형식이 다른 형식의 파생 형식 convertible_to : 한 형식을 다른 형식으로 변환할 수 있음 common_reference_with : 두 형식을 어떤 공통의 참조 형식으로 변환할 수 있음 common_with : 공통형식이 참조형식이 아니어도 되고, common_type_t<T, U> 와 같다
  • 5. core language concepts assignable_from : 한 형식의 값을 다른 형식으로 배정할 수 있음. swappable : 두 형식의 값을 교환할 수 있음 산술 integral : 정수 형식 signed_integral : 부호 있는 정수 형식 floating_point : 부동소수점 형식
  • 6. core language concepts 수명 destructible : 파괴 가능 constructible_from : 한 형식으로 다른 형식을 생성할 수 있음 default_initializable : 기본 생성 가능 move_constructible : 이동 생성 가능 copy_constructible : 복사 생성 가능
  • 7. comparison concepts <concepts> equality_comparable : 상등 비교 가능 totally_ordered : 전순서
  • 8. object concepts movable : 이동 가능 copyable : 복사 가능 semiregular : 준정규 형식(복사가능, 기본생성자 있음) regular : 정규 형식(복사가능, 기본생성자 있음, 동등비교 가능 ex. int 처럼)
  • 9. callable concepts invocable : 함수 형태로 호출 가능 regular_invocable : invocable을 충족하고, 같은 입력에 대해 같은 출력을 산출하고, 함수 인수들을 수정하지 않아야 한다 predicate : invocable을 충족하고, bool 로 변환가능한 값을 리턴해야 한다