Changeset 0a414494 in mainline
- Timestamp:
- 2018-07-05T21:41:22Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 72f5379e
- Parents:
- ca32d45
- git-author:
- Dzejrou <dzejrou@…> (2018-05-03 21:45:11)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:22)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/functional.hpp
rca32d45 r0a414494 707 707 708 708 template<class Predicate> 709 class unary_negate; 709 class unary_negate 710 { 711 public: 712 using result_type = bool; 713 using argument_type = typename Predicate::argument_type; 714 715 constexpr explicit unary_negate(const Predicate& pred) 716 : pred_{pred} 717 { /* DUMMY BODY */ } 718 719 constexpr result_type operator()(const argument_type& arg) 720 { 721 return !pred_(arg); 722 } 723 724 private: 725 Predicate pred_; 726 }; 710 727 711 728 template<class Predicate> 712 constexpr unary_negate<Predicate> not1(const Predicate& pred); 729 constexpr unary_negate<Predicate> not1(const Predicate& pred) 730 { 731 return unary_negate<Predicate>{pred}; 732 } 713 733 714 734 template<class Predicate> 715 class binary_negate; 735 class binary_negate 736 { 737 public: 738 using result_type = bool; 739 using first_argument_type = typename Predicate::first_argument_type; 740 using second_argument_type = typename Predicate::second_argument_type; 741 742 constexpr explicit binary_negate(const Predicate& pred) 743 : pred_{pred} 744 { /* DUMMY BODY */ } 745 746 constexpr result_type operator()(const first_argument_type& arg1, 747 const second_argument_type& arg2) 748 { 749 return !pred_(arg1, arg2); 750 } 751 752 private: 753 Predicate pred_; 754 }; 716 755 717 756 template<class Predicate>
Note:
See TracChangeset
for help on using the changeset viewer.