exception.hpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. // Copyright 2006-2009 Daniel James.
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #if !defined(BOOST_UNORDERED_EXCEPTION_TEST_OBJECTS_HEADER)
  5. #define BOOST_UNORDERED_EXCEPTION_TEST_OBJECTS_HEADER
  6. #include "../helpers/exception_test.hpp"
  7. #include "../helpers/count.hpp"
  8. #include "../helpers/fwd.hpp"
  9. #include "../helpers/generators.hpp"
  10. #include "../helpers/memory.hpp"
  11. #include "./fwd.hpp"
  12. #include <boost/limits.hpp>
  13. #include <cstddef>
  14. #include <new>
  15. namespace test {
  16. namespace exception {
  17. class object;
  18. class hash;
  19. class equal_to;
  20. template <class T> class allocator;
  21. object generate(object const*, random_generator);
  22. std::pair<object, object> generate(
  23. std::pair<object, object> const*, random_generator);
  24. struct true_type
  25. {
  26. enum
  27. {
  28. value = true
  29. };
  30. };
  31. struct false_type
  32. {
  33. enum
  34. {
  35. value = false
  36. };
  37. };
  38. class object : private counted_object
  39. {
  40. public:
  41. int tag1_, tag2_;
  42. explicit object() : tag1_(0), tag2_(0)
  43. {
  44. UNORDERED_SCOPE(object::object())
  45. {
  46. UNORDERED_EPOINT("Mock object default constructor.");
  47. }
  48. }
  49. explicit object(int t1, int t2 = 0) : tag1_(t1), tag2_(t2)
  50. {
  51. UNORDERED_SCOPE(object::object(int))
  52. {
  53. UNORDERED_EPOINT("Mock object constructor by value.");
  54. }
  55. }
  56. object(object const& x)
  57. : counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
  58. {
  59. UNORDERED_SCOPE(object::object(object))
  60. {
  61. UNORDERED_EPOINT("Mock object copy constructor.");
  62. }
  63. }
  64. ~object()
  65. {
  66. tag1_ = -1;
  67. tag2_ = -1;
  68. }
  69. object& operator=(object const& x)
  70. {
  71. UNORDERED_SCOPE(object::operator=(object))
  72. {
  73. tag1_ = x.tag1_;
  74. UNORDERED_EPOINT("Mock object assign operator 1.");
  75. tag2_ = x.tag2_;
  76. // UNORDERED_EPOINT("Mock object assign operator 2.");
  77. }
  78. return *this;
  79. }
  80. friend bool operator==(object const& x1, object const& x2)
  81. {
  82. UNORDERED_SCOPE(operator==(object, object))
  83. {
  84. UNORDERED_EPOINT("Mock object equality operator.");
  85. }
  86. return x1.tag1_ == x2.tag1_ && x1.tag2_ == x2.tag2_;
  87. }
  88. friend bool operator!=(object const& x1, object const& x2)
  89. {
  90. UNORDERED_SCOPE(operator!=(object, object))
  91. {
  92. UNORDERED_EPOINT("Mock object inequality operator.");
  93. }
  94. return !(x1.tag1_ == x2.tag1_ && x1.tag2_ == x2.tag2_);
  95. }
  96. // None of the last few functions are used by the unordered associative
  97. // containers - so there aren't any exception points.
  98. friend bool operator<(object const& x1, object const& x2)
  99. {
  100. return x1.tag1_ < x2.tag1_ ||
  101. (x1.tag1_ == x2.tag1_ && x1.tag2_ < x2.tag2_);
  102. }
  103. friend object generate(object const*, random_generator g)
  104. {
  105. int* x = 0;
  106. return object(::test::generate(x, g), ::test::generate(x, g));
  107. }
  108. friend std::ostream& operator<<(std::ostream& out, object const& o)
  109. {
  110. return out << "(" << o.tag1_ << "," << o.tag2_ << ")";
  111. }
  112. };
  113. std::pair<object, object> generate(
  114. std::pair<object, object> const*, random_generator g)
  115. {
  116. int* x = 0;
  117. return std::make_pair(
  118. object(::test::generate(x, g), ::test::generate(x, g)),
  119. object(::test::generate(x, g), ::test::generate(x, g)));
  120. }
  121. class hash
  122. {
  123. int tag_;
  124. public:
  125. hash(int t = 0) : tag_(t)
  126. {
  127. UNORDERED_SCOPE(hash::object())
  128. {
  129. UNORDERED_EPOINT("Mock hash default constructor.");
  130. }
  131. }
  132. hash(hash const& x) : tag_(x.tag_)
  133. {
  134. UNORDERED_SCOPE(hash::hash(hash))
  135. {
  136. UNORDERED_EPOINT("Mock hash copy constructor.");
  137. }
  138. }
  139. hash& operator=(hash const& x)
  140. {
  141. UNORDERED_SCOPE(hash::operator=(hash))
  142. {
  143. UNORDERED_EPOINT("Mock hash assign operator 1.");
  144. tag_ = x.tag_;
  145. UNORDERED_EPOINT("Mock hash assign operator 2.");
  146. }
  147. return *this;
  148. }
  149. std::size_t operator()(object const& x) const
  150. {
  151. UNORDERED_SCOPE(hash::operator()(object))
  152. {
  153. UNORDERED_EPOINT("Mock hash function.");
  154. }
  155. return hash_impl(x);
  156. }
  157. std::size_t operator()(std::pair<object, object> const& x) const
  158. {
  159. UNORDERED_SCOPE(hash::operator()(std::pair<object, object>))
  160. {
  161. UNORDERED_EPOINT("Mock hash pair function.");
  162. }
  163. return hash_impl(x.first) * 193ul + hash_impl(x.second) * 97ul + 29ul;
  164. }
  165. std::size_t hash_impl(object const& x) const
  166. {
  167. int result;
  168. switch (tag_) {
  169. case 1:
  170. result = x.tag1_;
  171. break;
  172. case 2:
  173. result = x.tag2_;
  174. break;
  175. default:
  176. result = x.tag1_ + x.tag2_;
  177. }
  178. return static_cast<std::size_t>(result);
  179. }
  180. friend bool operator==(hash const& x1, hash const& x2)
  181. {
  182. UNORDERED_SCOPE(operator==(hash, hash))
  183. {
  184. UNORDERED_EPOINT("Mock hash equality function.");
  185. }
  186. return x1.tag_ == x2.tag_;
  187. }
  188. friend bool operator!=(hash const& x1, hash const& x2)
  189. {
  190. UNORDERED_SCOPE(hash::operator!=(hash, hash))
  191. {
  192. UNORDERED_EPOINT("Mock hash inequality function.");
  193. }
  194. return x1.tag_ != x2.tag_;
  195. }
  196. };
  197. class less
  198. {
  199. int tag_;
  200. public:
  201. less(int t = 0) : tag_(t) {}
  202. less(less const& x) : tag_(x.tag_) {}
  203. bool operator()(object const& x1, object const& x2) const
  204. {
  205. return less_impl(x1, x2);
  206. }
  207. bool operator()(std::pair<object, object> const& x1,
  208. std::pair<object, object> const& x2) const
  209. {
  210. if (less_impl(x1.first, x2.first)) {
  211. return true;
  212. }
  213. if (!less_impl(x1.first, x2.first)) {
  214. return false;
  215. }
  216. return less_impl(x1.second, x2.second);
  217. }
  218. bool less_impl(object const& x1, object const& x2) const
  219. {
  220. switch (tag_) {
  221. case 1:
  222. return x1.tag1_ < x2.tag1_;
  223. case 2:
  224. return x1.tag2_ < x2.tag2_;
  225. default:
  226. return x1 < x2;
  227. }
  228. }
  229. friend bool operator==(less const& x1, less const& x2)
  230. {
  231. return x1.tag_ == x2.tag_;
  232. }
  233. friend bool operator!=(less const& x1, less const& x2)
  234. {
  235. return x1.tag_ != x2.tag_;
  236. }
  237. };
  238. class equal_to
  239. {
  240. int tag_;
  241. public:
  242. equal_to(int t = 0) : tag_(t)
  243. {
  244. UNORDERED_SCOPE(equal_to::equal_to())
  245. {
  246. UNORDERED_EPOINT("Mock equal_to default constructor.");
  247. }
  248. }
  249. equal_to(equal_to const& x) : tag_(x.tag_)
  250. {
  251. UNORDERED_SCOPE(equal_to::equal_to(equal_to))
  252. {
  253. UNORDERED_EPOINT("Mock equal_to copy constructor.");
  254. }
  255. }
  256. equal_to& operator=(equal_to const& x)
  257. {
  258. UNORDERED_SCOPE(equal_to::operator=(equal_to))
  259. {
  260. UNORDERED_EPOINT("Mock equal_to assign operator 1.");
  261. tag_ = x.tag_;
  262. UNORDERED_EPOINT("Mock equal_to assign operator 2.");
  263. }
  264. return *this;
  265. }
  266. bool operator()(object const& x1, object const& x2) const
  267. {
  268. UNORDERED_SCOPE(equal_to::operator()(object, object))
  269. {
  270. UNORDERED_EPOINT("Mock equal_to function.");
  271. }
  272. return equal_impl(x1, x2);
  273. }
  274. bool operator()(std::pair<object, object> const& x1,
  275. std::pair<object, object> const& x2) const
  276. {
  277. UNORDERED_SCOPE(equal_to::operator()(
  278. std::pair<object, object>, std::pair<object, object>))
  279. {
  280. UNORDERED_EPOINT("Mock equal_to function.");
  281. }
  282. return equal_impl(x1.first, x2.first) &&
  283. equal_impl(x1.second, x2.second);
  284. }
  285. bool equal_impl(object const& x1, object const& x2) const
  286. {
  287. switch (tag_) {
  288. case 1:
  289. return x1.tag1_ == x2.tag1_;
  290. case 2:
  291. return x1.tag2_ == x2.tag2_;
  292. default:
  293. return x1 == x2;
  294. }
  295. }
  296. friend bool operator==(equal_to const& x1, equal_to const& x2)
  297. {
  298. UNORDERED_SCOPE(operator==(equal_to, equal_to))
  299. {
  300. UNORDERED_EPOINT("Mock equal_to equality function.");
  301. }
  302. return x1.tag_ == x2.tag_;
  303. }
  304. friend bool operator!=(equal_to const& x1, equal_to const& x2)
  305. {
  306. UNORDERED_SCOPE(operator!=(equal_to, equal_to))
  307. {
  308. UNORDERED_EPOINT("Mock equal_to inequality function.");
  309. }
  310. return x1.tag_ != x2.tag_;
  311. }
  312. friend less create_compare(equal_to x) { return less(x.tag_); }
  313. };
  314. template <class T> class allocator
  315. {
  316. public:
  317. int tag_;
  318. typedef std::size_t size_type;
  319. typedef std::ptrdiff_t difference_type;
  320. typedef T* pointer;
  321. typedef T const* const_pointer;
  322. typedef T& reference;
  323. typedef T const& const_reference;
  324. typedef T value_type;
  325. template <class U> struct rebind
  326. {
  327. typedef allocator<U> other;
  328. };
  329. explicit allocator(int t = 0) : tag_(t)
  330. {
  331. UNORDERED_SCOPE(allocator::allocator())
  332. {
  333. UNORDERED_EPOINT("Mock allocator default constructor.");
  334. }
  335. test::detail::tracker.allocator_ref();
  336. }
  337. template <class Y> allocator(allocator<Y> const& x) : tag_(x.tag_)
  338. {
  339. test::detail::tracker.allocator_ref();
  340. }
  341. allocator(allocator const& x) : tag_(x.tag_)
  342. {
  343. test::detail::tracker.allocator_ref();
  344. }
  345. ~allocator() { test::detail::tracker.allocator_unref(); }
  346. allocator& operator=(allocator const& x)
  347. {
  348. tag_ = x.tag_;
  349. return *this;
  350. }
  351. // If address throws, then it can't be used in erase or the
  352. // destructor, which is very limiting. I need to check up on
  353. // this.
  354. pointer address(reference r)
  355. {
  356. // UNORDERED_SCOPE(allocator::address(reference)) {
  357. // UNORDERED_EPOINT("Mock allocator address function.");
  358. //}
  359. return pointer(&r);
  360. }
  361. const_pointer address(const_reference r)
  362. {
  363. // UNORDERED_SCOPE(allocator::address(const_reference)) {
  364. // UNORDERED_EPOINT("Mock allocator const address function.");
  365. //}
  366. return const_pointer(&r);
  367. }
  368. pointer allocate(size_type n)
  369. {
  370. T* ptr = 0;
  371. UNORDERED_SCOPE(allocator::allocate(size_type))
  372. {
  373. UNORDERED_EPOINT("Mock allocator allocate function.");
  374. using namespace std;
  375. ptr = (T*)malloc(n * sizeof(T));
  376. if (!ptr)
  377. throw std::bad_alloc();
  378. }
  379. test::detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
  380. return pointer(ptr);
  381. // return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
  382. }
  383. pointer allocate(size_type n, void const*)
  384. {
  385. T* ptr = 0;
  386. UNORDERED_SCOPE(allocator::allocate(size_type, const_pointer))
  387. {
  388. UNORDERED_EPOINT("Mock allocator allocate function.");
  389. using namespace std;
  390. ptr = (T*)malloc(n * sizeof(T));
  391. if (!ptr)
  392. throw std::bad_alloc();
  393. }
  394. test::detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
  395. return pointer(ptr);
  396. // return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
  397. }
  398. void deallocate(pointer p, size_type n)
  399. {
  400. //::operator delete((void*) p);
  401. if (p) {
  402. test::detail::tracker.track_deallocate((void*)p, n, sizeof(T), tag_);
  403. using namespace std;
  404. free(p);
  405. }
  406. }
  407. void construct(pointer p, T const& t)
  408. {
  409. UNORDERED_SCOPE(allocator::construct(T*, T))
  410. {
  411. UNORDERED_EPOINT("Mock allocator construct function.");
  412. new (p) T(t);
  413. }
  414. test::detail::tracker.track_construct((void*)p, sizeof(T), tag_);
  415. }
  416. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  417. template <class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args)
  418. {
  419. UNORDERED_SCOPE(allocator::construct(pointer, BOOST_FWD_REF(Args)...))
  420. {
  421. UNORDERED_EPOINT("Mock allocator construct function.");
  422. new (p) T(boost::forward<Args>(args)...);
  423. }
  424. test::detail::tracker.track_construct((void*)p, sizeof(T), tag_);
  425. }
  426. #endif
  427. void destroy(T* p)
  428. {
  429. test::detail::tracker.track_destroy((void*)p, sizeof(T), tag_);
  430. p->~T();
  431. }
  432. size_type max_size() const
  433. {
  434. UNORDERED_SCOPE(allocator::construct(pointer, T))
  435. {
  436. UNORDERED_EPOINT("Mock allocator max_size function.");
  437. }
  438. return (std::numeric_limits<std::size_t>::max)();
  439. }
  440. typedef true_type propagate_on_container_copy_assignment;
  441. typedef true_type propagate_on_container_move_assignment;
  442. typedef true_type propagate_on_container_swap;
  443. };
  444. template <class T> void swap(allocator<T>& x, allocator<T>& y)
  445. {
  446. std::swap(x.tag_, y.tag_);
  447. }
  448. // It's pretty much impossible to write a compliant swap when these
  449. // two can throw. So they don't.
  450. template <class T>
  451. inline bool operator==(allocator<T> const& x, allocator<T> const& y)
  452. {
  453. // UNORDERED_SCOPE(operator==(allocator, allocator)) {
  454. // UNORDERED_EPOINT("Mock allocator equality operator.");
  455. //}
  456. return x.tag_ == y.tag_;
  457. }
  458. template <class T>
  459. inline bool operator!=(allocator<T> const& x, allocator<T> const& y)
  460. {
  461. // UNORDERED_SCOPE(operator!=(allocator, allocator)) {
  462. // UNORDERED_EPOINT("Mock allocator inequality operator.");
  463. //}
  464. return x.tag_ != y.tag_;
  465. }
  466. template <class T> class allocator2
  467. {
  468. public:
  469. int tag_;
  470. typedef std::size_t size_type;
  471. typedef std::ptrdiff_t difference_type;
  472. typedef T* pointer;
  473. typedef T const* const_pointer;
  474. typedef T& reference;
  475. typedef T const& const_reference;
  476. typedef T value_type;
  477. template <class U> struct rebind
  478. {
  479. typedef allocator2<U> other;
  480. };
  481. explicit allocator2(int t = 0) : tag_(t)
  482. {
  483. UNORDERED_SCOPE(allocator2::allocator2())
  484. {
  485. UNORDERED_EPOINT("Mock allocator2 default constructor.");
  486. }
  487. test::detail::tracker.allocator_ref();
  488. }
  489. allocator2(allocator<T> const& x) : tag_(x.tag_)
  490. {
  491. test::detail::tracker.allocator_ref();
  492. }
  493. template <class Y> allocator2(allocator2<Y> const& x) : tag_(x.tag_)
  494. {
  495. test::detail::tracker.allocator_ref();
  496. }
  497. allocator2(allocator2 const& x) : tag_(x.tag_)
  498. {
  499. test::detail::tracker.allocator_ref();
  500. }
  501. ~allocator2() { test::detail::tracker.allocator_unref(); }
  502. allocator2& operator=(allocator2 const&) { return *this; }
  503. // If address throws, then it can't be used in erase or the
  504. // destructor, which is very limiting. I need to check up on
  505. // this.
  506. pointer address(reference r)
  507. {
  508. // UNORDERED_SCOPE(allocator2::address(reference)) {
  509. // UNORDERED_EPOINT("Mock allocator2 address function.");
  510. //}
  511. return pointer(&r);
  512. }
  513. const_pointer address(const_reference r)
  514. {
  515. // UNORDERED_SCOPE(allocator2::address(const_reference)) {
  516. // UNORDERED_EPOINT("Mock allocator2 const address function.");
  517. //}
  518. return const_pointer(&r);
  519. }
  520. pointer allocate(size_type n)
  521. {
  522. T* ptr = 0;
  523. UNORDERED_SCOPE(allocator2::allocate(size_type))
  524. {
  525. UNORDERED_EPOINT("Mock allocator2 allocate function.");
  526. using namespace std;
  527. ptr = (T*)malloc(n * sizeof(T));
  528. if (!ptr)
  529. throw std::bad_alloc();
  530. }
  531. test::detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
  532. return pointer(ptr);
  533. // return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
  534. }
  535. pointer allocate(size_type n, void const*)
  536. {
  537. T* ptr = 0;
  538. UNORDERED_SCOPE(allocator2::allocate(size_type, const_pointer))
  539. {
  540. UNORDERED_EPOINT("Mock allocator2 allocate function.");
  541. using namespace std;
  542. ptr = (T*)malloc(n * sizeof(T));
  543. if (!ptr)
  544. throw std::bad_alloc();
  545. }
  546. test::detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
  547. return pointer(ptr);
  548. // return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
  549. }
  550. void deallocate(pointer p, size_type n)
  551. {
  552. //::operator delete((void*) p);
  553. if (p) {
  554. test::detail::tracker.track_deallocate((void*)p, n, sizeof(T), tag_);
  555. using namespace std;
  556. free(p);
  557. }
  558. }
  559. void construct(pointer p, T const& t)
  560. {
  561. UNORDERED_SCOPE(allocator2::construct(T*, T))
  562. {
  563. UNORDERED_EPOINT("Mock allocator2 construct function.");
  564. new (p) T(t);
  565. }
  566. test::detail::tracker.track_construct((void*)p, sizeof(T), tag_);
  567. }
  568. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  569. template <class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args)
  570. {
  571. UNORDERED_SCOPE(allocator2::construct(pointer, BOOST_FWD_REF(Args)...))
  572. {
  573. UNORDERED_EPOINT("Mock allocator2 construct function.");
  574. new (p) T(boost::forward<Args>(args)...);
  575. }
  576. test::detail::tracker.track_construct((void*)p, sizeof(T), tag_);
  577. }
  578. #endif
  579. void destroy(T* p)
  580. {
  581. test::detail::tracker.track_destroy((void*)p, sizeof(T), tag_);
  582. p->~T();
  583. }
  584. size_type max_size() const
  585. {
  586. UNORDERED_SCOPE(allocator2::construct(pointer, T))
  587. {
  588. UNORDERED_EPOINT("Mock allocator2 max_size function.");
  589. }
  590. return (std::numeric_limits<std::size_t>::max)();
  591. }
  592. typedef false_type propagate_on_container_copy_assignment;
  593. typedef false_type propagate_on_container_move_assignment;
  594. typedef false_type propagate_on_container_swap;
  595. };
  596. template <class T> void swap(allocator2<T>& x, allocator2<T>& y)
  597. {
  598. std::swap(x.tag_, y.tag_);
  599. }
  600. // It's pretty much impossible to write a compliant swap when these
  601. // two can throw. So they don't.
  602. template <class T>
  603. inline bool operator==(allocator2<T> const& x, allocator2<T> const& y)
  604. {
  605. // UNORDERED_SCOPE(operator==(allocator2, allocator2)) {
  606. // UNORDERED_EPOINT("Mock allocator2 equality operator.");
  607. //}
  608. return x.tag_ == y.tag_;
  609. }
  610. template <class T>
  611. inline bool operator!=(allocator2<T> const& x, allocator2<T> const& y)
  612. {
  613. // UNORDERED_SCOPE(operator!=(allocator2, allocator2)) {
  614. // UNORDERED_EPOINT("Mock allocator2 inequality operator.");
  615. //}
  616. return x.tag_ != y.tag_;
  617. }
  618. }
  619. }
  620. namespace test {
  621. template <typename X> struct equals_to_compare;
  622. template <> struct equals_to_compare<test::exception::equal_to>
  623. {
  624. typedef test::exception::less type;
  625. };
  626. }
  627. // Workaround for ADL deficient compilers
  628. #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
  629. namespace test {
  630. test::exception::object generate(
  631. test::exception::object const* x, random_generator g)
  632. {
  633. return test::exception::generate(x, g);
  634. }
  635. std::pair<test::exception::object, test::exception::object> generate(
  636. std::pair<test::exception::object, test::exception::object> const* x,
  637. random_generator g)
  638. {
  639. return test::exception::generate(x, g);
  640. }
  641. }
  642. #endif
  643. #endif