libstdc++: stl_function.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56#ifndef _STL_FUNCTION_H

57#define _STL_FUNCTION_H 1

58

59#if __cplusplus > 201103L

61#endif

62

63namespace std _GLIBCXX_VISIBILITY(default)

64{

65_GLIBCXX_BEGIN_NAMESPACE_VERSION

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116 template<typename _Arg, typename _Result>

118 {

119

121

122

124 } _GLIBCXX11_DEPRECATED;

125

126

127

128

129

130 template<typename _Arg1, typename _Arg2, typename _Result>

132 {

133

135

136

138

139

141 } _GLIBCXX11_DEPRECATED;

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156#if __glibcxx_transparent_operators

157 struct __is_transparent;

158

159 template<typename _Tp = void>

161

162 template<typename _Tp = void>

164

165 template<typename _Tp = void>

167

168 template<typename _Tp = void>

170

171 template<typename _Tp = void>

173

174 template<typename _Tp = void>

176#endif

177

178

179#pragma GCC diagnostic push

180#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

181

182

183 template<typename _Tp>

185 {

186

187 _GLIBCXX14_CONSTEXPR

188 _Tp

190 { return __x + __y; }

191 };

192

193

194 template<typename _Tp>

196 {

197 _GLIBCXX14_CONSTEXPR

198 _Tp

199 operator()(const _Tp& __x, const _Tp& __y) const

200 { return __x - __y; }

201 };

202

203

204 template<typename _Tp>

206 {

207 _GLIBCXX14_CONSTEXPR

208 _Tp

209 operator()(const _Tp& __x, const _Tp& __y) const

210 { return __x * __y; }

211 };

212

213

214 template<typename _Tp>

216 {

217 _GLIBCXX14_CONSTEXPR

218 _Tp

219 operator()(const _Tp& __x, const _Tp& __y) const

220 { return __x / __y; }

221 };

222

223

224 template<typename _Tp>

226 {

227 _GLIBCXX14_CONSTEXPR

228 _Tp

229 operator()(const _Tp& __x, const _Tp& __y) const

230 { return __x % __y; }

231 };

232

233

234 template<typename _Tp>

236 {

237 _GLIBCXX14_CONSTEXPR

238 _Tp

239 operator()(const _Tp& __x) const

240 { return -__x; }

241 };

242#pragma GCC diagnostic pop

243

244#ifdef __glibcxx_transparent_operators

245 template<>

246 struct plus

247 {

248 template <typename _Tp, typename _Up>

249 _GLIBCXX14_CONSTEXPR

250 auto

251 operator()(_Tp&& __t, _Up&& __u) const

252 noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u)))

253 -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u))

254 { return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }

255

256 typedef __is_transparent is_transparent;

257 };

258

259

260 template<>

262 {

263 template <typename _Tp, typename _Up>

264 _GLIBCXX14_CONSTEXPR

265 auto

266 operator()(_Tp&& __t, _Up&& __u) const

267 noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u)))

268 -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u))

269 { return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }

270

271 typedef __is_transparent is_transparent;

272 };

273

274

275 template<>

277 {

278 template <typename _Tp, typename _Up>

279 _GLIBCXX14_CONSTEXPR

280 auto

281 operator()(_Tp&& __t, _Up&& __u) const

282 noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u)))

283 -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u))

284 { return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }

285

286 typedef __is_transparent is_transparent;

287 };

288

289

290 template<>

292 {

293 template <typename _Tp, typename _Up>

294 _GLIBCXX14_CONSTEXPR

295 auto

296 operator()(_Tp&& __t, _Up&& __u) const

297 noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u)))

298 -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u))

299 { return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }

300

301 typedef __is_transparent is_transparent;

302 };

303

304

305 template<>

307 {

308 template <typename _Tp, typename _Up>

309 _GLIBCXX14_CONSTEXPR

310 auto

311 operator()(_Tp&& __t, _Up&& __u) const

312 noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u)))

313 -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u))

314 { return std::forward<_Tp>(__t) % std::forward<_Up>(__u); }

315

316 typedef __is_transparent is_transparent;

317 };

318

319

320 template<>

322 {

323 template <typename _Tp>

324 _GLIBCXX14_CONSTEXPR

325 auto

326 operator()(_Tp&& __t) const

327 noexcept(noexcept(-std::forward<_Tp>(__t)))

328 -> decltype(-std::forward<_Tp>(__t))

329 { return -std::forward<_Tp>(__t); }

330

331 typedef __is_transparent is_transparent;

332 };

333#endif

334

335

336

337

338

339

340

341

342

343

344

345#if __glibcxx_transparent_operators

346 template<typename _Tp = void>

348

349 template<typename _Tp = void>

351

352 template<typename _Tp = void>

354

355 template<typename _Tp = void>

357

358 template<typename _Tp = void>

360

361 template<typename _Tp = void>

363#endif

364

365#pragma GCC diagnostic push

366#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

367

368

369 template<typename _Tp>

371 {

372 _GLIBCXX14_CONSTEXPR

373 bool

374 operator()(const _Tp& __x, const _Tp& __y) const

375 { return __x == __y; }

376 };

377

378

379 template<typename _Tp>

381 {

382 _GLIBCXX14_CONSTEXPR

383 bool

384 operator()(const _Tp& __x, const _Tp& __y) const

385 { return __x != __y; }

386 };

387

388

389 template<typename _Tp>

391 {

392 _GLIBCXX14_CONSTEXPR

393 bool

394 operator()(const _Tp& __x, const _Tp& __y) const

395 { return __x > __y; }

396 };

397

398

399 template<typename _Tp>

401 {

402 _GLIBCXX14_CONSTEXPR

403 bool

404 operator()(const _Tp& __x, const _Tp& __y) const

405 { return __x < __y; }

406 };

407

408

409 template<typename _Tp>

411 {

412 _GLIBCXX14_CONSTEXPR

413 bool

414 operator()(const _Tp& __x, const _Tp& __y) const

415 { return __x >= __y; }

416 };

417

418

419 template<typename _Tp>

421 {

422 _GLIBCXX14_CONSTEXPR

423 bool

424 operator()(const _Tp& __x, const _Tp& __y) const

425 { return __x <= __y; }

426 };

427

428

429 template<typename _Tp>

431 {

432 _GLIBCXX14_CONSTEXPR bool

433 operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW

434 {

435#if __cplusplus >= 201402L

436 if (std::__is_constant_evaluated())

437 return __x > __y;

438#endif

439 return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;

440 }

441 };

442

443

444 template<typename _Tp>

445 struct less<_Tp*> : public binary_function<_Tp*, _Tp*, bool>

446 {

447 _GLIBCXX14_CONSTEXPR bool

448 operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW

449 {

450#if __cplusplus >= 201402L

451 if (std::__is_constant_evaluated())

452 return __x < __y;

453#endif

454 return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y;

455 }

456 };

457

458

459 template<typename _Tp>

460 struct greater_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool>

461 {

462 _GLIBCXX14_CONSTEXPR bool

463 operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW

464 {

465#if __cplusplus >= 201402L

466 if (std::__is_constant_evaluated())

467 return __x >= __y;

468#endif

469 return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y;

470 }

471 };

472

473

474 template<typename _Tp>

475 struct less_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool>

476 {

477 _GLIBCXX14_CONSTEXPR bool

478 operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW

479 {

480#if __cplusplus >= 201402L

481 if (std::__is_constant_evaluated())

482 return __x <= __y;

483#endif

484 return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;

485 }

486 };

487#pragma GCC diagnostic pop

488

489#ifdef __glibcxx_transparent_operators

490

491 template<>

493 {

494 template <typename _Tp, typename _Up>

495 constexpr auto

496 operator()(_Tp&& __t, _Up&& __u) const

497 noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))

498 -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u))

499 { return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }

500

501 typedef __is_transparent is_transparent;

502 };

503

504

505 template<>

507 {

508 template <typename _Tp, typename _Up>

509 constexpr auto

510 operator()(_Tp&& __t, _Up&& __u) const

511 noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u)))

512 -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u))

513 { return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }

514

515 typedef __is_transparent is_transparent;

516 };

517

518

519 template<>

521 {

522 template <typename _Tp, typename _Up>

523 constexpr auto

524 operator()(_Tp&& __t, _Up&& __u) const

525 noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u)))

526 -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u))

527 {

528 return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u),

529 __ptr_cmp<_Tp, _Up>{});

530 }

531

532 template<typename _Tp, typename _Up>

533 constexpr bool

534 operator()(_Tp* __t, _Up* __u) const noexcept

536

537 typedef __is_transparent is_transparent;

538

539 private:

540 template <typename _Tp, typename _Up>

541 static constexpr decltype(auto)

542 _S_cmp(_Tp&& __t, _Up&& __u, false_type)

543 { return std::forward<_Tp>(__t) > std::forward<_Up>(__u); }

544

545 template <typename _Tp, typename _Up>

546 static constexpr bool

547 _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept

548 {

550 static_cast<const volatile void*>(std::forward<_Tp>(__t)),

551 static_cast<const volatile void*>(std::forward<_Up>(__u)));

552 }

553

554

555 template<typename _Tp, typename _Up, typename = void>

556 struct __not_overloaded2 : true_type { };

557

558

559 template<typename _Tp, typename _Up>

560 struct __not_overloaded2<_Tp, _Up, __void_t<

561 decltype(std::declval<_Tp>().operator>(std::declval<_Up>()))>>

563

564

565 template<typename _Tp, typename _Up, typename = void>

566 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };

567

568

569 template<typename _Tp, typename _Up>

570 struct __not_overloaded<_Tp, _Up, __void_t<

573

574 template<typename _Tp, typename _Up>

575 using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>,

578 };

579

580

581 template<>

583 {

584 template <typename _Tp, typename _Up>

585 constexpr auto

586 operator()(_Tp&& __t, _Up&& __u) const

587 noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))

588 -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u))

589 {

590 return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u),

591 __ptr_cmp<_Tp, _Up>{});

592 }

593

594 template<typename _Tp, typename _Up>

595 constexpr bool

596 operator()(_Tp* __t, _Up* __u) const noexcept

598

599 typedef __is_transparent is_transparent;

600

601 private:

602 template <typename _Tp, typename _Up>

603 static constexpr decltype(auto)

604 _S_cmp(_Tp&& __t, _Up&& __u, false_type)

605 { return std::forward<_Tp>(__t) < std::forward<_Up>(__u); }

606

607 template <typename _Tp, typename _Up>

608 static constexpr bool

609 _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept

610 {

612 static_cast<const volatile void*>(std::forward<_Tp>(__t)),

613 static_cast<const volatile void*>(std::forward<_Up>(__u)));

614 }

615

616

617 template<typename _Tp, typename _Up, typename = void>

618 struct __not_overloaded2 : true_type { };

619

620

621 template<typename _Tp, typename _Up>

622 struct __not_overloaded2<_Tp, _Up, __void_t<

623 decltype(std::declval<_Tp>().operator<(std::declval<_Up>()))>>

625

626

627 template<typename _Tp, typename _Up, typename = void>

628 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };

629

630

631 template<typename _Tp, typename _Up>

632 struct __not_overloaded<_Tp, _Up, __void_t<

635

636 template<typename _Tp, typename _Up>

637 using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>,

640 };

641

642

643 template<>

645 {

646 template <typename _Tp, typename _Up>

647 constexpr auto

648 operator()(_Tp&& __t, _Up&& __u) const

649 noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)))

650 -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))

651 {

652 return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u),

653 __ptr_cmp<_Tp, _Up>{});

654 }

655

656 template<typename _Tp, typename _Up>

657 constexpr bool

658 operator()(_Tp* __t, _Up* __u) const noexcept

660

661 typedef __is_transparent is_transparent;

662

663 private:

664 template <typename _Tp, typename _Up>

665 static constexpr decltype(auto)

666 _S_cmp(_Tp&& __t, _Up&& __u, false_type)

667 { return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); }

668

669 template <typename _Tp, typename _Up>

670 static constexpr bool

671 _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept

672 {

674 static_cast<const volatile void*>(std::forward<_Tp>(__t)),

675 static_cast<const volatile void*>(std::forward<_Up>(__u)));

676 }

677

678

679 template<typename _Tp, typename _Up, typename = void>

680 struct __not_overloaded2 : true_type { };

681

682

683 template<typename _Tp, typename _Up>

684 struct __not_overloaded2<_Tp, _Up, __void_t<

685 decltype(std::declval<_Tp>().operator>=(std::declval<_Up>()))>>

687

688

689 template<typename _Tp, typename _Up, typename = void>

690 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };

691

692

693 template<typename _Tp, typename _Up>

694 struct __not_overloaded<_Tp, _Up, __void_t<

695 decltype(operator>=(std::declval<_Tp>(), std::declval<_Up>()))>>

697

698 template<typename _Tp, typename _Up>

699 using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>,

702 };

703

704

705 template<>

707 {

708 template <typename _Tp, typename _Up>

709 constexpr auto

710 operator()(_Tp&& __t, _Up&& __u) const

711 noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)))

712 -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))

713 {

714 return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u),

715 __ptr_cmp<_Tp, _Up>{});

716 }

717

718 template<typename _Tp, typename _Up>

719 constexpr bool

720 operator()(_Tp* __t, _Up* __u) const noexcept

722

723 typedef __is_transparent is_transparent;

724

725 private:

726 template <typename _Tp, typename _Up>

727 static constexpr decltype(auto)

728 _S_cmp(_Tp&& __t, _Up&& __u, false_type)

729 { return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); }

730

731 template <typename _Tp, typename _Up>

732 static constexpr bool

733 _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept

734 {

736 static_cast<const volatile void*>(std::forward<_Tp>(__t)),

737 static_cast<const volatile void*>(std::forward<_Up>(__u)));

738 }

739

740

741 template<typename _Tp, typename _Up, typename = void>

742 struct __not_overloaded2 : true_type { };

743

744

745 template<typename _Tp, typename _Up>

746 struct __not_overloaded2<_Tp, _Up, __void_t<

747 decltype(std::declval<_Tp>().operator<=(std::declval<_Up>()))>>

749

750

751 template<typename _Tp, typename _Up, typename = void>

752 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };

753

754

755 template<typename _Tp, typename _Up>

756 struct __not_overloaded<_Tp, _Up, __void_t<

757 decltype(operator<=(std::declval<_Tp>(), std::declval<_Up>()))>>

759

760 template<typename _Tp, typename _Up>

761 using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>,

764 };

765#endif

766

767

768

769

770

771

772

773

774

775

776

777#ifdef __glibcxx_transparent_operators

778 template<typename _Tp = void>

780

781 template<typename _Tp = void>

783

784 template<typename _Tp = void>

786#endif

787

788#pragma GCC diagnostic push

789#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

790

791

792 template<typename _Tp>

794 {

795 _GLIBCXX14_CONSTEXPR

796 bool

797 operator()(const _Tp& __x, const _Tp& __y) const

798 { return __x && __y; }

799 };

800

801

802 template<typename _Tp>

804 {

805 _GLIBCXX14_CONSTEXPR

806 bool

807 operator()(const _Tp& __x, const _Tp& __y) const

808 { return __x || __y; }

809 };

810

811

812 template<typename _Tp>

814 {

815 _GLIBCXX14_CONSTEXPR

816 bool

817 operator()(const _Tp& __x) const

818 { return !__x; }

819 };

820#pragma GCC diagnostic pop

821

822#ifdef __glibcxx_transparent_operators

823

824 template<>

826 {

827 template <typename _Tp, typename _Up>

828 _GLIBCXX14_CONSTEXPR

829 auto

830 operator()(_Tp&& __t, _Up&& __u) const

831 noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u)))

832 -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u))

833 { return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }

834

835 typedef __is_transparent is_transparent;

836 };

837

838

839 template<>

841 {

842 template <typename _Tp, typename _Up>

843 _GLIBCXX14_CONSTEXPR

844 auto

845 operator()(_Tp&& __t, _Up&& __u) const

846 noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u)))

847 -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u))

848 { return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }

849

850 typedef __is_transparent is_transparent;

851 };

852

853

854 template<>

856 {

857 template <typename _Tp>

858 _GLIBCXX14_CONSTEXPR

859 auto

860 operator()(_Tp&& __t) const

861 noexcept(noexcept(!std::forward<_Tp>(__t)))

862 -> decltype(!std::forward<_Tp>(__t))

863 { return !std::forward<_Tp>(__t); }

864

865 typedef __is_transparent is_transparent;

866 };

867#endif

868

869

870#ifdef __glibcxx_transparent_operators

871 template<typename _Tp = void>

872 struct bit_and;

873

874 template<typename _Tp = void>

875 struct bit_or;

876

877 template<typename _Tp = void>

878 struct bit_xor;

879

880 template<typename _Tp = void>

881 struct bit_not;

882#endif

883

884#pragma GCC diagnostic push

885#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

886

887

888

889 template<typename _Tp>

891 {

892 _GLIBCXX14_CONSTEXPR

893 _Tp

894 operator()(const _Tp& __x, const _Tp& __y) const

895 { return __x & __y; }

896 };

897

898 template<typename _Tp>

899 struct bit_or : public binary_function<_Tp, _Tp, _Tp>

900 {

901 _GLIBCXX14_CONSTEXPR

902 _Tp

903 operator()(const _Tp& __x, const _Tp& __y) const

904 { return __x | __y; }

905 };

906

907 template<typename _Tp>

908 struct bit_xor : public binary_function<_Tp, _Tp, _Tp>

909 {

910 _GLIBCXX14_CONSTEXPR

911 _Tp

912 operator()(const _Tp& __x, const _Tp& __y) const

913 { return __x ^ __y; }

914 };

915

916 template<typename _Tp>

917 struct bit_not : public unary_function<_Tp, _Tp>

918 {

919 _GLIBCXX14_CONSTEXPR

920 _Tp

921 operator()(const _Tp& __x) const

922 { return ~__x; }

923 };

924#pragma GCC diagnostic pop

925

926#ifdef __glibcxx_transparent_operators

927 template <>

928 struct bit_and

929 {

930 template <typename _Tp, typename _Up>

931 _GLIBCXX14_CONSTEXPR

932 auto

933 operator()(_Tp&& __t, _Up&& __u) const

934 noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u)))

935 -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u))

936 { return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }

937

938 typedef __is_transparent is_transparent;

939 };

940

941 template <>

942 struct bit_or

943 {

944 template <typename _Tp, typename _Up>

945 _GLIBCXX14_CONSTEXPR

946 auto

947 operator()(_Tp&& __t, _Up&& __u) const

948 noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u)))

949 -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u))

950 { return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }

951

952 typedef __is_transparent is_transparent;

953 };

954

955 template <>

956 struct bit_xor

957 {

958 template <typename _Tp, typename _Up>

959 _GLIBCXX14_CONSTEXPR

960 auto

961 operator()(_Tp&& __t, _Up&& __u) const

962 noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)))

963 -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))

964 { return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }

965

966 typedef __is_transparent is_transparent;

967 };

968

969 template <>

970 struct bit_not

971 {

972 template <typename _Tp>

973 _GLIBCXX14_CONSTEXPR

974 auto

975 operator()(_Tp&& __t) const

976 noexcept(noexcept(~std::forward<_Tp>(__t)))

977 -> decltype(~std::forward<_Tp>(__t))

978 { return ~std::forward<_Tp>(__t); }

979

980 typedef __is_transparent is_transparent;

981 };

982#endif

983

984#pragma GCC diagnostic push

985#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020 template<typename _Predicate>

1022 : public unary_function<typename _Predicate::argument_type, bool>

1023 {

1024 protected:

1025 _Predicate _M_pred;

1026

1027 public:

1028 _GLIBCXX14_CONSTEXPR

1029 explicit

1030 unary_negate(const _Predicate& __x) : _M_pred(__x) { }

1031

1032 _GLIBCXX14_CONSTEXPR

1033 bool

1034 operator()(const typename _Predicate::argument_type& __x) const

1035 { return !_M_pred(__x); }

1036 };

1037

1038

1039 template<typename _Predicate>

1040 _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn")

1041 _GLIBCXX14_CONSTEXPR

1043 not1(const _Predicate& __pred)

1045

1046

1047 template<typename _Predicate>

1049 : public binary_function<typename _Predicate::first_argument_type,

1050 typename _Predicate::second_argument_type, bool>

1051 {

1052 protected:

1053 _Predicate _M_pred;

1054

1055 public:

1056 _GLIBCXX14_CONSTEXPR

1057 explicit

1058 binary_negate(const _Predicate& __x) : _M_pred(__x) { }

1059

1060 _GLIBCXX14_CONSTEXPR

1061 bool

1062 operator()(const typename _Predicate::first_argument_type& __x,

1063 const typename _Predicate::second_argument_type& __y) const

1064 { return !_M_pred(__x, __y); }

1065 };

1066

1067

1068 template<typename _Predicate>

1069 _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn")

1070 _GLIBCXX14_CONSTEXPR

1072 not2(const _Predicate& __pred)

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101 template<typename _Arg, typename _Result>

1103 {

1104 protected:

1105 _Result (*_M_ptr)(_Arg);

1106

1107 public:

1109

1110 explicit

1112 : _M_ptr(__x) { }

1113

1114 _Result

1115 operator()(_Arg __x) const

1116 { return _M_ptr(__x); }

1117 } _GLIBCXX11_DEPRECATED;

1118

1119

1120 template<typename _Arg, typename _Result>

1121 _GLIBCXX11_DEPRECATED_SUGGEST("std::function")

1125

1126

1127 template<typename _Arg1, typename _Arg2, typename _Result>

1130 {

1131 protected:

1132 _Result (*_M_ptr)(_Arg1, _Arg2);

1133

1134 public:

1136

1137 explicit

1139 : _M_ptr(__x) { }

1140

1141 _Result

1142 operator()(_Arg1 __x, _Arg2 __y) const

1143 { return _M_ptr(__x, __y); }

1144 } _GLIBCXX11_DEPRECATED;

1145

1146

1147 template<typename _Arg1, typename _Arg2, typename _Result>

1148 _GLIBCXX11_DEPRECATED_SUGGEST("std::function")

1152

1153

1154 template<typename _Tp>

1155 struct _Identity

1156 : public unary_function<_Tp, _Tp>

1157 {

1158 _Tp&

1159 operator()(_Tp& __x) const

1160 { return __x; }

1161

1162 const _Tp&

1163 operator()(const _Tp& __x) const

1164 { return __x; }

1165 };

1166

1167

1168 template<typename _Tp> struct _Identity<const _Tp> : _Identity<_Tp> { };

1169

1170 template<typename _Pair>

1171 struct _Select1st

1172 : public unary_function<_Pair, typename _Pair::first_type>

1173 {

1174 typename _Pair::first_type&

1175 operator()(_Pair& __x) const

1176 { return __x.first; }

1177

1178 const typename _Pair::first_type&

1179 operator()(const _Pair& __x) const

1180 { return __x.first; }

1181

1182#if __cplusplus >= 201103L

1183 template<typename _Pair2>

1184 typename _Pair2::first_type&

1185 operator()(_Pair2& __x) const

1186 { return __x.first; }

1187

1188 template<typename _Pair2>

1189 const typename _Pair2::first_type&

1190 operator()(const _Pair2& __x) const

1191 { return __x.first; }

1192#endif

1193 };

1194

1195 template<typename _Pair>

1196 struct _Select2nd

1197 : public unary_function<_Pair, typename _Pair::second_type>

1198 {

1199 typename _Pair::second_type&

1200 operator()(_Pair& __x) const

1201 { return __x.second; }

1202

1203 const typename _Pair::second_type&

1204 operator()(const _Pair& __x) const

1205 { return __x.second; }

1206 };

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228 template<typename _Ret, typename _Tp>

1230 {

1231 public:

1232 explicit

1234 : _M_f(__pf) { }

1235

1236 _Ret

1237 operator()(_Tp* __p) const

1238 { return (__p->*_M_f)(); }

1239

1240 private:

1241 _Ret (_Tp::*_M_f)();

1242 } _GLIBCXX11_DEPRECATED;

1243

1244

1245 template<typename _Ret, typename _Tp>

1247 {

1248 public:

1249 explicit

1251 : _M_f(__pf) { }

1252

1253 _Ret

1254 operator()(const _Tp* __p) const

1255 { return (__p->*_M_f)(); }

1256

1257 private:

1258 _Ret (_Tp::*_M_f)() const;

1259 } _GLIBCXX11_DEPRECATED;

1260

1261

1262 template<typename _Ret, typename _Tp>

1264 {

1265 public:

1266 explicit

1268 : _M_f(__pf) { }

1269

1270 _Ret

1271 operator()(_Tp& __r) const

1272 { return (__r.*_M_f)(); }

1273

1274 private:

1275 _Ret (_Tp::*_M_f)();

1276 } _GLIBCXX11_DEPRECATED;

1277

1278

1279 template<typename _Ret, typename _Tp>

1281 {

1282 public:

1283 explicit

1285 : _M_f(__pf) { }

1286

1287 _Ret

1288 operator()(const _Tp& __r) const

1289 { return (__r.*_M_f)(); }

1290

1291 private:

1292 _Ret (_Tp::*_M_f)() const;

1293 } _GLIBCXX11_DEPRECATED;

1294

1295

1296 template<typename _Ret, typename _Tp, typename _Arg>

1298 {

1299 public:

1300 explicit

1302 : _M_f(__pf) { }

1303

1304 _Ret

1305 operator()(_Tp* __p, _Arg __x) const

1306 { return (__p->*_M_f)(__x); }

1307

1308 private:

1309 _Ret (_Tp::*_M_f)(_Arg);

1310 } _GLIBCXX11_DEPRECATED;

1311

1312

1313 template<typename _Ret, typename _Tp, typename _Arg>

1315 {

1316 public:

1317 explicit

1319 : _M_f(__pf) { }

1320

1321 _Ret

1322 operator()(const _Tp* __p, _Arg __x) const

1323 { return (__p->*_M_f)(__x); }

1324

1325 private:

1326 _Ret (_Tp::*_M_f)(_Arg) const;

1327 } _GLIBCXX11_DEPRECATED;

1328

1329

1330 template<typename _Ret, typename _Tp, typename _Arg>

1332 {

1333 public:

1334 explicit

1336 : _M_f(__pf) { }

1337

1338 _Ret

1339 operator()(_Tp& __r, _Arg __x) const

1340 { return (__r.*_M_f)(__x); }

1341

1342 private:

1343 _Ret (_Tp::*_M_f)(_Arg);

1344 } _GLIBCXX11_DEPRECATED;

1345

1346

1347 template<typename _Ret, typename _Tp, typename _Arg>

1349 {

1350 public:

1351 explicit

1353 : _M_f(__pf) { }

1354

1355 _Ret

1356 operator()(const _Tp& __r, _Arg __x) const

1357 { return (__r.*_M_f)(__x); }

1358

1359 private:

1360 _Ret (_Tp::*_M_f)(_Arg) const;

1361 } _GLIBCXX11_DEPRECATED;

1362

1363

1364

1365 template<typename _Ret, typename _Tp>

1366 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1368 mem_fun(_Ret (_Tp::*__f)())

1370

1371 template<typename _Ret, typename _Tp>

1372 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1373 inline const_mem_fun_t<_Ret, _Tp>

1374 mem_fun(_Ret (_Tp::*__f)() const)

1375 { return const_mem_fun_t<_Ret, _Tp>(__f); }

1376

1377 template<typename _Ret, typename _Tp>

1378 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1379 inline mem_fun_ref_t<_Ret, _Tp>

1380 mem_fun_ref(_Ret (_Tp::*__f)())

1381 { return mem_fun_ref_t<_Ret, _Tp>(__f); }

1382

1383 template<typename _Ret, typename _Tp>

1384 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1385 inline const_mem_fun_ref_t<_Ret, _Tp>

1386 mem_fun_ref(_Ret (_Tp::*__f)() const)

1387 { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }

1388

1389 template<typename _Ret, typename _Tp, typename _Arg>

1390 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1391 inline mem_fun1_t<_Ret, _Tp, _Arg>

1392 mem_fun(_Ret (_Tp::*__f)(_Arg))

1393 { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }

1394

1395 template<typename _Ret, typename _Tp, typename _Arg>

1396 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1397 inline const_mem_fun1_t<_Ret, _Tp, _Arg>

1398 mem_fun(_Ret (_Tp::*__f)(_Arg) const)

1399 { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }

1400

1401 template<typename _Ret, typename _Tp, typename _Arg>

1402 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1403 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>

1404 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))

1405 { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }

1406

1407 template<typename _Ret, typename _Tp, typename _Arg>

1408 _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")

1409 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>

1410 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)

1411 { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }

1412#pragma GCC diagnostic pop

1413

1414

1415

1416#ifdef __glibcxx_transparent_operators

1417 template<typename _Func, typename _SfinaeType, typename = __void_t<>>

1418 struct __has_is_transparent

1419 { };

1420

1421 template<typename _Func, typename _SfinaeType>

1422 struct __has_is_transparent<_Func, _SfinaeType,

1423 __void_t<typename _Func::is_transparent>>

1424 { typedef void type; };

1425

1426 template<typename _Func, typename _SfinaeType>

1427 using __has_is_transparent_t

1428 = typename __has_is_transparent<_Func, _SfinaeType>::type;

1429#endif

1430

1431_GLIBCXX_END_NAMESPACE_VERSION

1432}

1433

1434#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED

1436#endif

1437

1438#endif

__bool_constant< true > true_type

The type used as a compile-time boolean with true value.

__bool_constant< false > false_type

The type used as a compile-time boolean with false value.

auto declval() noexcept -> decltype(__declval< _Tp >(0))

constexpr binary_negate< _Predicate > not2(const _Predicate &__pred)

One of the negation functors.

constexpr unary_negate< _Predicate > not1(const _Predicate &__pred)

One of the negation functors.

pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__x)(_Arg))

One of the adaptors for function pointers.

ISO C++ entities toplevel namespace is std.

_Arg argument_type

argument_type is the type of the argument

_Result result_type

result_type is the return type

_Result result_type

result_type is the return type

_Arg2 second_argument_type

second_argument_type is the type of the second argument

_Arg1 first_argument_type

first_argument_type is the type of the first argument

One of the math functors.

constexpr _Tp operator()(const _Tp &__x, const _Tp &__y) const

Returns the sum.

One of the math functors.

One of the math functors.

One of the math functors.

One of the math functors.

One of the math functors.

One of the comparison functors.

One of the comparison functors.

One of the comparison functors.

One of the comparison functors.

One of the comparison functors.

One of the comparison functors.

One of the Boolean operations functors.

One of the Boolean operations functors.

One of the Boolean operations functors.

One of the negation functors.

One of the negation functors.

One of the adaptors for function pointers.

One of the adaptors for function pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.

One of the adaptors for member pointers.