From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/mpl/CMakeLists.txt | 26 ++ src/boost/libs/mpl/Jamfile | 11 + src/boost/libs/mpl/LICENSE | 23 + src/boost/libs/mpl/README.md | 34 ++ src/boost/libs/mpl/book/chapter1/binary.hpp | 18 + src/boost/libs/mpl/example/Jamfile.v2 | 15 + src/boost/libs/mpl/example/fsm/README.txt | 28 ++ .../libs/mpl/example/fsm/aux_/STT_impl_gen.hpp | 145 ++++++ src/boost/libs/mpl/example/fsm/aux_/base_event.hpp | 59 +++ src/boost/libs/mpl/example/fsm/aux_/event.hpp | 54 +++ src/boost/libs/mpl/example/fsm/aux_/state.hpp | 42 ++ src/boost/libs/mpl/example/fsm/aux_/transition.hpp | 47 ++ src/boost/libs/mpl/example/fsm/player.cpp | 76 +++ src/boost/libs/mpl/example/fsm/player1.cpp | 287 ++++++++++++ src/boost/libs/mpl/example/fsm/player2.cpp | 326 +++++++++++++ src/boost/libs/mpl/example/fsm/state_machine.hpp | 145 ++++++ src/boost/libs/mpl/example/inherit_linearly.cpp | 62 +++ src/boost/libs/mpl/example/inherit_multiply.cpp | 58 +++ src/boost/libs/mpl/example/integer.cpp | 67 +++ src/boost/libs/mpl/example/tuple_from_list.cpp | 46 ++ src/boost/libs/mpl/index.html | 13 + src/boost/libs/mpl/meta/libraries.json | 14 + src/boost/libs/mpl/preprocessed/README.txt | 70 +++ .../libs/mpl/preprocessed/boost_mpl_preprocess.py | 250 ++++++++++ .../mpl/preprocessed/fix_boost_mpl_preprocess.py | 205 ++++++++ .../libs/mpl/preprocessed/include/bcc/user.hpp | 27 ++ .../libs/mpl/preprocessed/include/bcc551/user.hpp | 25 + .../mpl/preprocessed/include/bcc_pre590/user.hpp | 26 ++ .../libs/mpl/preprocessed/include/dmc/user.hpp | 15 + .../libs/mpl/preprocessed/include/gcc/user.hpp | 15 + .../libs/mpl/preprocessed/include/mwcw/user.hpp | 15 + .../libs/mpl/preprocessed/include/no_ttp/user.hpp | 16 + .../libs/mpl/preprocessed/include/plain/user.hpp | 15 + .../mpl/preprocessed/include/typeof_based/user.hpp | 15 + src/boost/libs/mpl/preprocessed/list/list10.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list10_c.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list20.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list20_c.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list30.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list30_c.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list40.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list40_c.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list50.cpp | 16 + src/boost/libs/mpl/preprocessed/list/list50_c.cpp | 16 + src/boost/libs/mpl/preprocessed/map/map10.cpp | 16 + src/boost/libs/mpl/preprocessed/map/map20.cpp | 16 + src/boost/libs/mpl/preprocessed/map/map30.cpp | 16 + src/boost/libs/mpl/preprocessed/map/map40.cpp | 16 + src/boost/libs/mpl/preprocessed/map/map50.cpp | 16 + src/boost/libs/mpl/preprocessed/pp.py | 256 ++++++++++ src/boost/libs/mpl/preprocessed/preprocess.cmd | 1 + src/boost/libs/mpl/preprocessed/preprocess.py | 88 ++++ src/boost/libs/mpl/preprocessed/preprocess_list.py | 21 + src/boost/libs/mpl/preprocessed/preprocess_map.py | 21 + src/boost/libs/mpl/preprocessed/preprocess_set.py | 21 + .../libs/mpl/preprocessed/preprocess_vector.py | 21 + src/boost/libs/mpl/preprocessed/set/set10.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set10_c.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set20.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set20_c.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set30.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set30_c.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set40.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set40_c.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set50.cpp | 16 + src/boost/libs/mpl/preprocessed/set/set50_c.cpp | 16 + .../libs/mpl/preprocessed/src/advance_backward.cpp | 16 + .../libs/mpl/preprocessed/src/advance_forward.cpp | 16 + src/boost/libs/mpl/preprocessed/src/and.cpp | 16 + src/boost/libs/mpl/preprocessed/src/apply.cpp | 16 + src/boost/libs/mpl/preprocessed/src/apply_fwd.cpp | 16 + src/boost/libs/mpl/preprocessed/src/apply_wrap.cpp | 16 + src/boost/libs/mpl/preprocessed/src/arg.cpp | 16 + src/boost/libs/mpl/preprocessed/src/basic_bind.cpp | 16 + src/boost/libs/mpl/preprocessed/src/bind.cpp | 16 + src/boost/libs/mpl/preprocessed/src/bind_fwd.cpp | 16 + src/boost/libs/mpl/preprocessed/src/bitand.cpp | 16 + src/boost/libs/mpl/preprocessed/src/bitor.cpp | 16 + src/boost/libs/mpl/preprocessed/src/bitxor.cpp | 16 + src/boost/libs/mpl/preprocessed/src/deque.cpp | 16 + src/boost/libs/mpl/preprocessed/src/divides.cpp | 16 + src/boost/libs/mpl/preprocessed/src/equal_to.cpp | 16 + src/boost/libs/mpl/preprocessed/src/fold_impl.cpp | 16 + .../libs/mpl/preprocessed/src/full_lambda.cpp | 16 + src/boost/libs/mpl/preprocessed/src/greater.cpp | 16 + .../libs/mpl/preprocessed/src/greater_equal.cpp | 16 + src/boost/libs/mpl/preprocessed/src/inherit.cpp | 16 + .../mpl/preprocessed/src/iter_fold_if_impl.cpp | 16 + .../libs/mpl/preprocessed/src/iter_fold_impl.cpp | 16 + .../libs/mpl/preprocessed/src/lambda_no_ctps.cpp | 16 + src/boost/libs/mpl/preprocessed/src/less.cpp | 16 + src/boost/libs/mpl/preprocessed/src/less_equal.cpp | 16 + src/boost/libs/mpl/preprocessed/src/list.cpp | 16 + src/boost/libs/mpl/preprocessed/src/list_c.cpp | 16 + src/boost/libs/mpl/preprocessed/src/map.cpp | 16 + src/boost/libs/mpl/preprocessed/src/minus.cpp | 16 + src/boost/libs/mpl/preprocessed/src/modulus.cpp | 16 + .../libs/mpl/preprocessed/src/not_equal_to.cpp | 16 + src/boost/libs/mpl/preprocessed/src/or.cpp | 16 + .../libs/mpl/preprocessed/src/placeholders.cpp | 16 + src/boost/libs/mpl/preprocessed/src/plus.cpp | 16 + src/boost/libs/mpl/preprocessed/src/quote.cpp | 16 + .../mpl/preprocessed/src/reverse_fold_impl.cpp | 16 + .../preprocessed/src/reverse_iter_fold_impl.cpp | 16 + src/boost/libs/mpl/preprocessed/src/set.cpp | 16 + src/boost/libs/mpl/preprocessed/src/set_c.cpp | 16 + src/boost/libs/mpl/preprocessed/src/shift_left.cpp | 16 + .../libs/mpl/preprocessed/src/shift_right.cpp | 16 + .../libs/mpl/preprocessed/src/template_arity.cpp | 16 + src/boost/libs/mpl/preprocessed/src/times.cpp | 16 + .../libs/mpl/preprocessed/src/unpack_args.cpp | 16 + src/boost/libs/mpl/preprocessed/src/vector.cpp | 16 + src/boost/libs/mpl/preprocessed/src/vector_c.cpp | 16 + .../libs/mpl/preprocessed/vector/vector10.cpp | 16 + .../libs/mpl/preprocessed/vector/vector10_c.cpp | 16 + .../libs/mpl/preprocessed/vector/vector20.cpp | 16 + .../libs/mpl/preprocessed/vector/vector20_c.cpp | 16 + .../libs/mpl/preprocessed/vector/vector30.cpp | 16 + .../libs/mpl/preprocessed/vector/vector30_c.cpp | 16 + .../libs/mpl/preprocessed/vector/vector40.cpp | 16 + .../libs/mpl/preprocessed/vector/vector40_c.cpp | 16 + .../libs/mpl/preprocessed/vector/vector50.cpp | 16 + .../libs/mpl/preprocessed/vector/vector50_c.cpp | 16 + src/boost/libs/mpl/test/Jamfile.v2 | 98 ++++ src/boost/libs/mpl/test/advance.cpp | 51 ++ src/boost/libs/mpl/test/always.cpp | 48 ++ src/boost/libs/mpl/test/apply.cpp | 128 +++++ src/boost/libs/mpl/test/apply_wrap.cpp | 121 +++++ src/boost/libs/mpl/test/arithmetic.cpp | 50 ++ src/boost/libs/mpl/test/as_sequence.cpp | 23 + src/boost/libs/mpl/test/assert.cpp | 101 ++++ src/boost/libs/mpl/test/assert_vc8.hpp | 28 ++ src/boost/libs/mpl/test/assert_vc8_p1.cpp | 23 + src/boost/libs/mpl/test/assert_vc8_p2.cpp | 19 + src/boost/libs/mpl/test/at.cpp | 39 ++ src/boost/libs/mpl/test/aux_/increased_arity.cpp | 50 ++ src/boost/libs/mpl/test/aux_/largest_int.cpp | 25 + src/boost/libs/mpl/test/aux_/msvc_is_class.cpp | 46 ++ .../libs/mpl/test/aux_/preprocessor/is_seq.cpp | 33 ++ .../mpl/test/aux_/preprocessor/token_equal.cpp | 36 ++ src/boost/libs/mpl/test/aux_/template_arity.cpp | 31 ++ src/boost/libs/mpl/test/back.cpp | 29 ++ src/boost/libs/mpl/test/bind.cpp | 89 ++++ src/boost/libs/mpl/test/bitwise.cpp | 71 +++ src/boost/libs/mpl/test/bool.cpp | 38 ++ src/boost/libs/mpl/test/char.cpp | 24 + src/boost/libs/mpl/test/comparison.cpp | 64 +++ src/boost/libs/mpl/test/contains.cpp | 24 + src/boost/libs/mpl/test/copy.cpp | 211 +++++++++ src/boost/libs/mpl/test/copy_if.cpp | 54 +++ src/boost/libs/mpl/test/count.cpp | 41 ++ src/boost/libs/mpl/test/count_if.cpp | 36 ++ src/boost/libs/mpl/test/deque.cpp | 92 ++++ src/boost/libs/mpl/test/distance.cpp | 37 ++ src/boost/libs/mpl/test/empty.cpp | 23 + src/boost/libs/mpl/test/empty_sequence.cpp | 39 ++ src/boost/libs/mpl/test/equal.cpp | 31 ++ src/boost/libs/mpl/test/erase.cpp | 45 ++ src/boost/libs/mpl/test/erase_range.cpp | 34 ++ src/boost/libs/mpl/test/eval_if.cpp | 33 ++ src/boost/libs/mpl/test/filter_view.cpp | 42 ++ src/boost/libs/mpl/test/find.cpp | 37 ++ src/boost/libs/mpl/test/find_if.cpp | 46 ++ src/boost/libs/mpl/test/fold.cpp | 55 +++ src/boost/libs/mpl/test/for_each.cpp | 81 ++++ src/boost/libs/mpl/test/front.cpp | 29 ++ src/boost/libs/mpl/test/get_tag_def.cpp | 32 ++ src/boost/libs/mpl/test/has_xxx.cpp | 158 +++++++ src/boost/libs/mpl/test/identity.cpp | 32 ++ src/boost/libs/mpl/test/if.cpp | 29 ++ src/boost/libs/mpl/test/index_of.cpp | 34 ++ src/boost/libs/mpl/test/inherit.cpp | 40 ++ src/boost/libs/mpl/test/insert.cpp | 31 ++ src/boost/libs/mpl/test/insert_range.cpp | 73 +++ src/boost/libs/mpl/test/int.cpp | 24 + src/boost/libs/mpl/test/integral_c.cpp | 30 ++ src/boost/libs/mpl/test/integral_wrapper_test.hpp | 63 +++ src/boost/libs/mpl/test/is_placeholder.cpp | 42 ++ src/boost/libs/mpl/test/is_sequence.cpp | 39 ++ src/boost/libs/mpl/test/iterator_tags.cpp | 23 + src/boost/libs/mpl/test/joint_view.cpp | 56 +++ src/boost/libs/mpl/test/lambda.cpp | 78 ++++ src/boost/libs/mpl/test/lambda_args.cpp | 48 ++ src/boost/libs/mpl/test/list.cpp | 68 +++ src/boost/libs/mpl/test/list_c.cpp | 81 ++++ src/boost/libs/mpl/test/logical.cpp | 41 ++ src/boost/libs/mpl/test/lower_bound.cpp | 28 ++ src/boost/libs/mpl/test/map.cpp | 235 ++++++++++ src/boost/libs/mpl/test/max_element.cpp | 26 ++ src/boost/libs/mpl/test/min_max.cpp | 27 ++ src/boost/libs/mpl/test/multiset.cpp | 107 +++++ src/boost/libs/mpl/test/next.cpp | 29 ++ src/boost/libs/mpl/test/no_has_xxx.cpp | 30 ++ src/boost/libs/mpl/test/numeric_ops.cpp | 155 +++++++ src/boost/libs/mpl/test/pair_view.cpp | 45 ++ src/boost/libs/mpl/test/partition.cpp | 42 ++ src/boost/libs/mpl/test/pop_front.cpp | 36 ++ src/boost/libs/mpl/test/print.cpp | 22 + src/boost/libs/mpl/test/push_back.cpp | 52 +++ src/boost/libs/mpl/test/push_front.cpp | 50 ++ src/boost/libs/mpl/test/quote.cpp | 42 ++ src/boost/libs/mpl/test/range_c.cpp | 60 +++ src/boost/libs/mpl/test/remove.cpp | 28 ++ src/boost/libs/mpl/test/remove_if.cpp | 54 +++ src/boost/libs/mpl/test/replace.cpp | 27 ++ src/boost/libs/mpl/test/replace_if.cpp | 33 ++ src/boost/libs/mpl/test/reverse.cpp | 32 ++ src/boost/libs/mpl/test/same_as.cpp | 23 + src/boost/libs/mpl/test/set.cpp | 347 ++++++++++++++ src/boost/libs/mpl/test/set_c.cpp | 106 +++++ src/boost/libs/mpl/test/single_view.cpp | 43 ++ src/boost/libs/mpl/test/size.cpp | 26 ++ src/boost/libs/mpl/test/size_t.cpp | 29 ++ src/boost/libs/mpl/test/sizeof.cpp | 28 ++ src/boost/libs/mpl/test/sort.cpp | 27 ++ src/boost/libs/mpl/test/stable_partition.cpp | 47 ++ src/boost/libs/mpl/test/string.cpp | 516 +++++++++++++++++++++ src/boost/libs/mpl/test/transform.cpp | 51 ++ src/boost/libs/mpl/test/transform_view.cpp | 40 ++ src/boost/libs/mpl/test/unique.cpp | 29 ++ src/boost/libs/mpl/test/unpack_args.cpp | 26 ++ src/boost/libs/mpl/test/upper_bound.cpp | 29 ++ src/boost/libs/mpl/test/vector.cpp | 124 +++++ src/boost/libs/mpl/test/vector_c.cpp | 66 +++ src/boost/libs/mpl/test/zip_view.cpp | 45 ++ 225 files changed, 10070 insertions(+) create mode 100644 src/boost/libs/mpl/CMakeLists.txt create mode 100644 src/boost/libs/mpl/Jamfile create mode 100644 src/boost/libs/mpl/LICENSE create mode 100644 src/boost/libs/mpl/README.md create mode 100644 src/boost/libs/mpl/book/chapter1/binary.hpp create mode 100644 src/boost/libs/mpl/example/Jamfile.v2 create mode 100644 src/boost/libs/mpl/example/fsm/README.txt create mode 100644 src/boost/libs/mpl/example/fsm/aux_/STT_impl_gen.hpp create mode 100644 src/boost/libs/mpl/example/fsm/aux_/base_event.hpp create mode 100644 src/boost/libs/mpl/example/fsm/aux_/event.hpp create mode 100644 src/boost/libs/mpl/example/fsm/aux_/state.hpp create mode 100644 src/boost/libs/mpl/example/fsm/aux_/transition.hpp create mode 100644 src/boost/libs/mpl/example/fsm/player.cpp create mode 100644 src/boost/libs/mpl/example/fsm/player1.cpp create mode 100644 src/boost/libs/mpl/example/fsm/player2.cpp create mode 100644 src/boost/libs/mpl/example/fsm/state_machine.hpp create mode 100644 src/boost/libs/mpl/example/inherit_linearly.cpp create mode 100644 src/boost/libs/mpl/example/inherit_multiply.cpp create mode 100644 src/boost/libs/mpl/example/integer.cpp create mode 100644 src/boost/libs/mpl/example/tuple_from_list.cpp create mode 100644 src/boost/libs/mpl/index.html create mode 100644 src/boost/libs/mpl/meta/libraries.json create mode 100644 src/boost/libs/mpl/preprocessed/README.txt create mode 100755 src/boost/libs/mpl/preprocessed/boost_mpl_preprocess.py create mode 100755 src/boost/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py create mode 100644 src/boost/libs/mpl/preprocessed/include/bcc/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/bcc551/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/bcc_pre590/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/dmc/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/gcc/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/mwcw/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/no_ttp/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/plain/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/include/typeof_based/user.hpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list10.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list10_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list20.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list20_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list30.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list30_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list40.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list40_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list50.cpp create mode 100644 src/boost/libs/mpl/preprocessed/list/list50_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/map/map10.cpp create mode 100644 src/boost/libs/mpl/preprocessed/map/map20.cpp create mode 100644 src/boost/libs/mpl/preprocessed/map/map30.cpp create mode 100644 src/boost/libs/mpl/preprocessed/map/map40.cpp create mode 100644 src/boost/libs/mpl/preprocessed/map/map50.cpp create mode 100644 src/boost/libs/mpl/preprocessed/pp.py create mode 100644 src/boost/libs/mpl/preprocessed/preprocess.cmd create mode 100644 src/boost/libs/mpl/preprocessed/preprocess.py create mode 100644 src/boost/libs/mpl/preprocessed/preprocess_list.py create mode 100644 src/boost/libs/mpl/preprocessed/preprocess_map.py create mode 100644 src/boost/libs/mpl/preprocessed/preprocess_set.py create mode 100644 src/boost/libs/mpl/preprocessed/preprocess_vector.py create mode 100644 src/boost/libs/mpl/preprocessed/set/set10.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set10_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set20.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set20_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set30.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set30_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set40.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set40_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set50.cpp create mode 100644 src/boost/libs/mpl/preprocessed/set/set50_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/advance_backward.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/advance_forward.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/and.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/apply.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/apply_fwd.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/apply_wrap.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/arg.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/basic_bind.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/bind.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/bind_fwd.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/bitand.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/bitor.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/bitxor.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/deque.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/divides.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/equal_to.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/fold_impl.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/full_lambda.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/greater.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/greater_equal.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/inherit.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/iter_fold_if_impl.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/iter_fold_impl.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/lambda_no_ctps.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/less.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/less_equal.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/list.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/list_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/map.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/minus.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/modulus.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/not_equal_to.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/or.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/placeholders.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/plus.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/quote.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/reverse_fold_impl.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/reverse_iter_fold_impl.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/set.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/set_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/shift_left.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/shift_right.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/template_arity.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/times.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/unpack_args.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/vector.cpp create mode 100644 src/boost/libs/mpl/preprocessed/src/vector_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector10.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector10_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector20.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector20_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector30.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector30_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector40.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector40_c.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector50.cpp create mode 100644 src/boost/libs/mpl/preprocessed/vector/vector50_c.cpp create mode 100644 src/boost/libs/mpl/test/Jamfile.v2 create mode 100644 src/boost/libs/mpl/test/advance.cpp create mode 100644 src/boost/libs/mpl/test/always.cpp create mode 100644 src/boost/libs/mpl/test/apply.cpp create mode 100644 src/boost/libs/mpl/test/apply_wrap.cpp create mode 100644 src/boost/libs/mpl/test/arithmetic.cpp create mode 100644 src/boost/libs/mpl/test/as_sequence.cpp create mode 100644 src/boost/libs/mpl/test/assert.cpp create mode 100644 src/boost/libs/mpl/test/assert_vc8.hpp create mode 100644 src/boost/libs/mpl/test/assert_vc8_p1.cpp create mode 100644 src/boost/libs/mpl/test/assert_vc8_p2.cpp create mode 100644 src/boost/libs/mpl/test/at.cpp create mode 100644 src/boost/libs/mpl/test/aux_/increased_arity.cpp create mode 100644 src/boost/libs/mpl/test/aux_/largest_int.cpp create mode 100644 src/boost/libs/mpl/test/aux_/msvc_is_class.cpp create mode 100644 src/boost/libs/mpl/test/aux_/preprocessor/is_seq.cpp create mode 100644 src/boost/libs/mpl/test/aux_/preprocessor/token_equal.cpp create mode 100644 src/boost/libs/mpl/test/aux_/template_arity.cpp create mode 100644 src/boost/libs/mpl/test/back.cpp create mode 100644 src/boost/libs/mpl/test/bind.cpp create mode 100644 src/boost/libs/mpl/test/bitwise.cpp create mode 100644 src/boost/libs/mpl/test/bool.cpp create mode 100644 src/boost/libs/mpl/test/char.cpp create mode 100644 src/boost/libs/mpl/test/comparison.cpp create mode 100644 src/boost/libs/mpl/test/contains.cpp create mode 100644 src/boost/libs/mpl/test/copy.cpp create mode 100644 src/boost/libs/mpl/test/copy_if.cpp create mode 100644 src/boost/libs/mpl/test/count.cpp create mode 100644 src/boost/libs/mpl/test/count_if.cpp create mode 100644 src/boost/libs/mpl/test/deque.cpp create mode 100644 src/boost/libs/mpl/test/distance.cpp create mode 100644 src/boost/libs/mpl/test/empty.cpp create mode 100644 src/boost/libs/mpl/test/empty_sequence.cpp create mode 100644 src/boost/libs/mpl/test/equal.cpp create mode 100644 src/boost/libs/mpl/test/erase.cpp create mode 100644 src/boost/libs/mpl/test/erase_range.cpp create mode 100644 src/boost/libs/mpl/test/eval_if.cpp create mode 100644 src/boost/libs/mpl/test/filter_view.cpp create mode 100644 src/boost/libs/mpl/test/find.cpp create mode 100644 src/boost/libs/mpl/test/find_if.cpp create mode 100644 src/boost/libs/mpl/test/fold.cpp create mode 100644 src/boost/libs/mpl/test/for_each.cpp create mode 100644 src/boost/libs/mpl/test/front.cpp create mode 100644 src/boost/libs/mpl/test/get_tag_def.cpp create mode 100644 src/boost/libs/mpl/test/has_xxx.cpp create mode 100644 src/boost/libs/mpl/test/identity.cpp create mode 100644 src/boost/libs/mpl/test/if.cpp create mode 100644 src/boost/libs/mpl/test/index_of.cpp create mode 100644 src/boost/libs/mpl/test/inherit.cpp create mode 100644 src/boost/libs/mpl/test/insert.cpp create mode 100644 src/boost/libs/mpl/test/insert_range.cpp create mode 100644 src/boost/libs/mpl/test/int.cpp create mode 100644 src/boost/libs/mpl/test/integral_c.cpp create mode 100644 src/boost/libs/mpl/test/integral_wrapper_test.hpp create mode 100644 src/boost/libs/mpl/test/is_placeholder.cpp create mode 100644 src/boost/libs/mpl/test/is_sequence.cpp create mode 100644 src/boost/libs/mpl/test/iterator_tags.cpp create mode 100644 src/boost/libs/mpl/test/joint_view.cpp create mode 100644 src/boost/libs/mpl/test/lambda.cpp create mode 100644 src/boost/libs/mpl/test/lambda_args.cpp create mode 100644 src/boost/libs/mpl/test/list.cpp create mode 100644 src/boost/libs/mpl/test/list_c.cpp create mode 100644 src/boost/libs/mpl/test/logical.cpp create mode 100644 src/boost/libs/mpl/test/lower_bound.cpp create mode 100644 src/boost/libs/mpl/test/map.cpp create mode 100644 src/boost/libs/mpl/test/max_element.cpp create mode 100644 src/boost/libs/mpl/test/min_max.cpp create mode 100644 src/boost/libs/mpl/test/multiset.cpp create mode 100644 src/boost/libs/mpl/test/next.cpp create mode 100644 src/boost/libs/mpl/test/no_has_xxx.cpp create mode 100644 src/boost/libs/mpl/test/numeric_ops.cpp create mode 100644 src/boost/libs/mpl/test/pair_view.cpp create mode 100644 src/boost/libs/mpl/test/partition.cpp create mode 100644 src/boost/libs/mpl/test/pop_front.cpp create mode 100644 src/boost/libs/mpl/test/print.cpp create mode 100644 src/boost/libs/mpl/test/push_back.cpp create mode 100644 src/boost/libs/mpl/test/push_front.cpp create mode 100644 src/boost/libs/mpl/test/quote.cpp create mode 100644 src/boost/libs/mpl/test/range_c.cpp create mode 100644 src/boost/libs/mpl/test/remove.cpp create mode 100644 src/boost/libs/mpl/test/remove_if.cpp create mode 100644 src/boost/libs/mpl/test/replace.cpp create mode 100644 src/boost/libs/mpl/test/replace_if.cpp create mode 100644 src/boost/libs/mpl/test/reverse.cpp create mode 100644 src/boost/libs/mpl/test/same_as.cpp create mode 100644 src/boost/libs/mpl/test/set.cpp create mode 100644 src/boost/libs/mpl/test/set_c.cpp create mode 100644 src/boost/libs/mpl/test/single_view.cpp create mode 100644 src/boost/libs/mpl/test/size.cpp create mode 100644 src/boost/libs/mpl/test/size_t.cpp create mode 100644 src/boost/libs/mpl/test/sizeof.cpp create mode 100644 src/boost/libs/mpl/test/sort.cpp create mode 100644 src/boost/libs/mpl/test/stable_partition.cpp create mode 100644 src/boost/libs/mpl/test/string.cpp create mode 100644 src/boost/libs/mpl/test/transform.cpp create mode 100644 src/boost/libs/mpl/test/transform_view.cpp create mode 100644 src/boost/libs/mpl/test/unique.cpp create mode 100644 src/boost/libs/mpl/test/unpack_args.cpp create mode 100644 src/boost/libs/mpl/test/upper_bound.cpp create mode 100644 src/boost/libs/mpl/test/vector.cpp create mode 100644 src/boost/libs/mpl/test/vector_c.cpp create mode 100644 src/boost/libs/mpl/test/zip_view.cpp (limited to 'src/boost/libs/mpl') diff --git a/src/boost/libs/mpl/CMakeLists.txt b/src/boost/libs/mpl/CMakeLists.txt new file mode 100644 index 00000000..2d6020a3 --- /dev/null +++ b/src/boost/libs/mpl/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2018 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Mpl is currently experimental at best +# and the interface is likely to change in the future + +cmake_minimum_required( VERSION 3.5 ) +project( BoostMpl LANGUAGES CXX ) + +add_library( boost_mpl INTERFACE ) +add_library( Boost::mpl ALIAS boost_mpl ) + +target_include_directories( boost_mpl INTERFACE include ) + +target_link_libraries( boost_mpl + INTERFACE + Boost::config + Boost::core + Boost::predef + Boost::preprocessor + Boost::static_assert + Boost::type_traits + Boost::utility +) + diff --git a/src/boost/libs/mpl/Jamfile b/src/boost/libs/mpl/Jamfile new file mode 100644 index 00000000..ba92b48d --- /dev/null +++ b/src/boost/libs/mpl/Jamfile @@ -0,0 +1,11 @@ +# Boost.MPL Library Jamfile +# +# Copyright (c) 2018 James E. King III +# +# Use, modification, and distribution are subject to the +# Boost Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +# please order by name to ease maintenance +build-project example ; +build-project test ; diff --git a/src/boost/libs/mpl/LICENSE b/src/boost/libs/mpl/LICENSE new file mode 100644 index 00000000..36b7cd93 --- /dev/null +++ b/src/boost/libs/mpl/LICENSE @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/boost/libs/mpl/README.md b/src/boost/libs/mpl/README.md new file mode 100644 index 00000000..b8806d4c --- /dev/null +++ b/src/boost/libs/mpl/README.md @@ -0,0 +1,34 @@ +MPL, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. + +### License + +Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + +### Properties + +* C++03 +* Header Only + +### Build Status + +Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | +:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | +[`master`](https://github.com/boostorg/mpl/tree/master) | [![Build Status](https://travis-ci.org/boostorg/mpl.svg?branch=master)](https://travis-ci.org/boostorg/mpl) | [![Build status](https://ci.appveyor.com/api/projects/status/lx9pjj2ixqod6flb/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/mpl-nrhfm/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15866/badge.svg)](https://scan.coverity.com/projects/boostorg-mpl) | [![codecov](https://codecov.io/gh/boostorg/mpl/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/mpl/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/mpl.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/mpl.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/mpl.html) +[`develop`](https://github.com/boostorg/mpl/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/mpl.svg?branch=develop)](https://travis-ci.org/boostorg/mpl) | [![Build status](https://ci.appveyor.com/api/projects/status/lx9pjj2ixqod6flb/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/mpl-nrhfm/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15866/badge.svg)](https://scan.coverity.com/projects/boostorg-mpl) | [![codecov](https://codecov.io/gh/boostorg/mpl/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/mpl/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/mpl.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/mpl.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/mpl.html) + +### Directories + +| Name | Purpose | +| ----------- | ------------------------------ | +| `doc` | documentation | +| `example` | examples | +| `include` | headers | +| `test` | unit tests | + +### More information + +* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-mpl) +* [Report bugs](https://github.com/boostorg/mpl/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). +* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[mpl]` tag at the beginning of the subject line. + diff --git a/src/boost/libs/mpl/book/chapter1/binary.hpp b/src/boost/libs/mpl/book/chapter1/binary.hpp new file mode 100644 index 00000000..39213863 --- /dev/null +++ b/src/boost/libs/mpl/book/chapter1/binary.hpp @@ -0,0 +1,18 @@ +// +// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed +// under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +#include "boost/mpl/long.hpp" +#include "boost/mpl/alias.hpp" + +template< long n > struct binary + : mpl::long_< ( binary< n / 10 >::value << 1 ) + n % 10 > +{ +}; + +template<> struct binary<0> + : mpl::long_<0> +{ +}; diff --git a/src/boost/libs/mpl/example/Jamfile.v2 b/src/boost/libs/mpl/example/Jamfile.v2 new file mode 100644 index 00000000..ec2dc761 --- /dev/null +++ b/src/boost/libs/mpl/example/Jamfile.v2 @@ -0,0 +1,15 @@ +# Boost.MPL Library example Jamfile +# +# Copyright (c) 2008 James E. King III +# +# Distributed under the Boost Software License, Version 1.0. (See accompany- +# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +import testing ; + +test-suite "mpl-examples" + : [ run inherit_linearly.cpp ] + [ compile integer.cpp ] + [ run tuple_from_list.cpp ] + ; + diff --git a/src/boost/libs/mpl/example/fsm/README.txt b/src/boost/libs/mpl/example/fsm/README.txt new file mode 100644 index 00000000..0f4863fe --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/README.txt @@ -0,0 +1,28 @@ +What's In This Directory +======================== + +* player1.cpp - this is exactly what's covered in C++ Template + Metaprogramming (http://www.boost-consulting.com/mplbook); in fact, + it was auto-extracted from the examples as shown in the book. The + state machine framework and its use are together in one .cpp file; + normally they would be separated. You can think of the framework as + ending with the definition of the generate_dispatcher class + template. + + You can ignore the typedef called "dummy;" that was included in order to + test an intermediate example that appears in the book. + +* player2.cpp - this example demonstrates that the abstraction of the + framework is complete by replacing its implementation with one that + dispatches using O(1) table lookups, while still using the same code + to describe the particular FSM. Look at this one if you want to see + how to generate a static lookup table that's initialized at dynamic + initialization time. + +* player.cpp, state_machine.hpp - This example predates the book, and + is more sophisticated in some ways than what we cover in the other + examples. In particular, it supports state invariants, and it + maintains an internal event queue, which requires an additional + layer of runtime dispatching to sort out the next event to be + processed. + diff --git a/src/boost/libs/mpl/example/fsm/aux_/STT_impl_gen.hpp b/src/boost/libs/mpl/example/fsm/aux_/STT_impl_gen.hpp new file mode 100644 index 00000000..1fd0a5ff --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/aux_/STT_impl_gen.hpp @@ -0,0 +1,145 @@ + +#ifndef BOOST_FSM_HANDLER_INCLUDED +#define BOOST_FSM_HANDLER_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include +#include + +namespace fsm { namespace aux { + +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +template< typename Transition > +struct STT_void_row_impl +{ + typedef typename Transition::from_state_t state_t; + typedef typename Transition::fsm_t fsm_t; + typedef typename Transition::base_event_t base_event_t; + + static long do_process_event(fsm_t&, long state, base_event_t const&) + { + assert(false); + return state; + } + + static long do_transition(fsm_t&, long state, base_event_t const&) + { + assert(false); + return state; + } +}; + + +template< + typename PrevRowImpl + , typename Transition + > +struct STT_event_row_impl + : PrevRowImpl +{ + typedef typename Transition::from_state_t state_t; + typedef typename Transition::fsm_t fsm_t; + typedef typename Transition::base_event_t base_event_t; + + static long do_process_event(fsm_t& fsm, long state, base_event_t const& evt) + { + if (typeid(typename Transition::event_t) == typeid(evt)) + { + // typedefs are here to make GCC happy + typedef typename Transition::to_state_t to_state_; + typedef typename Transition::from_state_t from_state_; + + return Transition::do_transition(fsm, evt) + ? to_state_::do_check_invariant(fsm) + : from_state_::do_check_invariant(fsm) + ; + } + + return PrevRowImpl::do_process_event(fsm, state, evt); + } +}; + +template< + typename PrevRowImpl + , typename StateType + > +struct STT_state_row_impl + : PrevRowImpl +{ + typedef typename PrevRowImpl::fsm_t fsm_t; + typedef typename PrevRowImpl::base_event_t base_event_t; + + static long do_transition(fsm_t& fsm, long state, base_event_t const& evt) + { + return state == StateType::value + ? PrevRowImpl::do_process_event(fsm, state, evt) + : PrevRowImpl::do_transition(fsm, state, evt) + ; + } + + static long do_process_event(fsm_t&, long state, base_event_t const&) + { + assert(false); + return state; + } +}; + +template< + typename PrevRowImpl + , typename Transition + > +struct STT_row_impl +{ + typedef typename mpl::if_< + boost::is_same< + typename PrevRowImpl::state_t + , typename Transition::from_state_t + > + , STT_event_row_impl< PrevRowImpl,Transition > + , STT_event_row_impl< + STT_state_row_impl< PrevRowImpl,typename PrevRowImpl::state_t > + , Transition + > + >::type type; +}; + + +template< typename Transitions > +struct STT_impl_gen +{ + private: + typedef typename mpl::front::type first_; + typedef typename mpl::fold< + Transitions + , STT_void_row_impl + , STT_row_impl<_,_> + >::type STT_impl_; + + public: + typedef STT_state_row_impl< + STT_impl_ + , typename STT_impl_::state_t + > type; +}; + +}} + +#endif // BOOST_FSM_HANDLER_INCLUDED diff --git a/src/boost/libs/mpl/example/fsm/aux_/base_event.hpp b/src/boost/libs/mpl/example/fsm/aux_/base_event.hpp new file mode 100644 index 00000000..99df7d9d --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/aux_/base_event.hpp @@ -0,0 +1,59 @@ + +#ifndef BOOST_FSM_BASE_EVENT_INCLUDED +#define BOOST_FSM_BASE_EVENT_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +namespace fsm { namespace aux { + +// represent an abstract base for FSM events + +struct base_event +{ + public: + virtual ~base_event() {}; + +#if defined(BOOST_NO_CXX11_SMART_PTR) + + std::auto_ptr clone() const + +#else + + std::unique_ptr clone() const + +#endif + + { + return do_clone(); + } + + private: + +#if defined(BOOST_NO_CXX11_SMART_PTR) + + virtual std::auto_ptr do_clone() const = 0; + +#else + + virtual std::unique_ptr do_clone() const = 0; + +#endif + +}; + +}} + +#endif // BOOST_FSM_BASE_EVENT_INCLUDED diff --git a/src/boost/libs/mpl/example/fsm/aux_/event.hpp b/src/boost/libs/mpl/example/fsm/aux_/event.hpp new file mode 100644 index 00000000..895bd7a6 --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/aux_/event.hpp @@ -0,0 +1,54 @@ + +#ifndef BOOST_FSM_EVENT_INCLUDED +#define BOOST_FSM_EVENT_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include "base_event.hpp" + +namespace fsm { namespace aux { + +template< typename Derived > +struct event + : base_event +{ + public: + typedef base_event base_t; + + private: + +#if defined(BOOST_NO_CXX11_SMART_PTR) + + virtual std::auto_ptr do_clone() const + { + return std::auto_ptr( + new Derived(static_cast(*this)) + ); + } + +#else + + virtual std::unique_ptr do_clone() const + { + return std::unique_ptr( + new Derived(static_cast(*this)) + ); + } + +#endif + +}; + +}} + +#endif // BOOST_FSM_EVENT_INCLUDED diff --git a/src/boost/libs/mpl/example/fsm/aux_/state.hpp b/src/boost/libs/mpl/example/fsm/aux_/state.hpp new file mode 100644 index 00000000..bbe2bbf3 --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/aux_/state.hpp @@ -0,0 +1,42 @@ + +#ifndef BOOST_FSM_STATE_INCLUDED +#define BOOST_FSM_STATE_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +namespace fsm { namespace aux { + +namespace mpl = boost::mpl; + +// represent a FSM state + +template< + typename T + , long State + , void (T::* invariant_func)() const + > +struct state + : mpl::integral_c +{ + static long do_check_invariant(T const& x) + { + if (invariant_func) (x.*invariant_func)(); + return State; + } +}; + +}} + +#endif // BOOST_FSM_STATE_INCLUDED diff --git a/src/boost/libs/mpl/example/fsm/aux_/transition.hpp b/src/boost/libs/mpl/example/fsm/aux_/transition.hpp new file mode 100644 index 00000000..842e5e08 --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/aux_/transition.hpp @@ -0,0 +1,47 @@ + +#ifndef BOOST_FSM_TRANSITION_INCLUDED +#define BOOST_FSM_TRANSITION_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +namespace fsm { namespace aux { + +// represent a signle transition between states |From| and |To| + +template< + typename T + , typename From + , typename Event + , typename To + , bool (T::* transition_func)(Event const&) + > +struct transition +{ + typedef T fsm_t; + typedef From from_state_t; + typedef Event event_t; + typedef To to_state_t; + + typedef typename Event::base_t base_event_t; + static bool do_transition(T& x, base_event_t const& e) + { + assert(dynamic_cast(&e) == &e); + return (x.*transition_func)(static_cast(e)); + } +}; + +}} + +#endif // BOOST_FSM_TRANSITION_INCLUDED diff --git a/src/boost/libs/mpl/example/fsm/player.cpp b/src/boost/libs/mpl/example/fsm/player.cpp new file mode 100644 index 00000000..c3a5a124 --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/player.cpp @@ -0,0 +1,76 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include "state_machine.hpp" +#include + +#include + +namespace mpl = boost::mpl; + +class player + : public fsm::state_machine +{ + public: + player() {} + + // events + struct play_event : event {}; + struct stop_event : event {}; + struct pause_event : event {}; + +// MWCW 8.1 is too eager in inforcing access for non-type template parameters +// private: + typedef player self_t; + + // state invariants + void stopped_state_invariant() const {} + void playing_state_invariant() const {} + void paused_state_invariant() const {} + + // states (invariants are passed as non-type template arguments) + typedef state<0, &self_t::stopped_state_invariant> stopped; + typedef state<1, &self_t::playing_state_invariant> playing; + typedef state<2, &self_t::paused_state_invariant> paused; + +// private: + + // transition functions + bool do_play(play_event const&) { std::cout << "player::do_play\n"; return true; } + bool do_stop(stop_event const&) { std::cout << "player::do_stop\n"; return true; } + bool do_pause(pause_event const&) { std::cout << "player::do_pause\n"; return true; } + bool do_resume(play_event const&) { std::cout << "player::do_resume\n"; return true; } + + // transitions, in the following format: + // | current state | event | next state | transition function | + friend class fsm::state_machine; + typedef mpl::list< + transition + , transition + , transition + , transition + , transition + >::type transition_table; + + typedef stopped initial_state; +}; + +int main() +{ + player p; + p.process_event(player::play_event()); + p.process_event(player::pause_event()); + p.process_event(player::play_event()); + p.process_event(player::stop_event()); + return 0; +} diff --git a/src/boost/libs/mpl/example/fsm/player1.cpp b/src/boost/libs/mpl/example/fsm/player1.cpp new file mode 100644 index 00000000..a5a1a2cb --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/player1.cpp @@ -0,0 +1,287 @@ +/* + + Copyright David Abrahams 2003-2004 + Copyright Aleksey Gurtovoy 2003-2004 + + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) + + This file was automatically extracted from the source of + "C++ Template Metaprogramming", by David Abrahams and + Aleksey Gurtovoy. + + It was built successfully with GCC 3.4.2 on Windows using + the following command: + + g++ -I..\..\boost_1_32_0 -o%TEMP%\metaprogram-chapter11-example16.exe example16.cpp + + +*/ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +#include + +template< + class Transition + , class Next +> +struct event_dispatcher +{ + typedef typename Transition::fsm_t fsm_t; + typedef typename Transition::event event; + + static int dispatch( + fsm_t& fsm, int state, event const& e) + { + if (state == Transition::current_state) + { + Transition::execute(fsm, e); + return Transition::next_state; + } + else // move on to the next node in the chain. + { + return Next::dispatch(fsm, state, e); + } + } +}; + + + +template class state_machine; + +struct default_event_dispatcher +{ + template + static int dispatch( + state_machine& m, int state, Event const& e) + { + return m.call_no_transition(state, e); + } +}; + + + template + struct generate_dispatcher; + +template +class state_machine +{ + // ... + protected: + template< + int CurrentState + , class Event + , int NextState + , void (Derived::*action)(Event const&) + > + struct row + { + // for later use by our metaprogram + static int const current_state = CurrentState; + static int const next_state = NextState; + typedef Event event; + typedef Derived fsm_t; + + // do the transition action. + static void execute(Derived& fsm, Event const& e) + { + (fsm.*action)(e); + } + }; + + + friend class default_event_dispatcher; + + template + int call_no_transition(int state, Event const& e) + { + return static_cast(this) // CRTP downcast + ->no_transition(state, e); + } + // +public: + +template +int process_event(Event const& evt) +{ + // generate the dispatcher type. + typedef typename generate_dispatcher< + typename Derived::transition_table, Event + >::type dispatcher; + + // dispatch the event. + this->state = dispatcher::dispatch( + *static_cast(this) // CRTP downcast + , this->state + , evt + ); + + // return the new state + return this->state; +} + +// ... + protected: + state_machine() + : state(Derived::initial_state) + { + } + + private: + int state; +// ... + +// ... + public: + template + int no_transition(int state, Event const& e) + { + assert(false); + return state; + } +// ... +//// + }; + + +// get the Event associated with a transition. +template +struct transition_event +{ + typedef typename Transition::event type; +}; + +template +struct generate_dispatcher + : mpl::fold< + mpl::filter_view< // select rows triggered by Event + Table + , boost::is_same > + > + , default_event_dispatcher + , event_dispatcher<_2,_1> + > +{}; + + + + struct play {}; + struct open_close {}; + struct cd_detected { + cd_detected(char const*, std::vector const&) {} + }; + #ifdef __GNUC__ // in which pause seems to have a predefined meaning + # define pause pause_ + #endif + struct pause {}; + struct stop {}; + + +// concrete FSM implementation +class player : public state_machine +{ + private: + // the list of FSM states + enum states { + Empty, Open, Stopped, Playing, Paused + , initial_state = Empty + }; + + + #ifdef __MWERKS__ + public: // Codewarrior bug workaround. Tested at 0x3202 + #endif + + void start_playback(play const&); + void open_drawer(open_close const&); + void close_drawer(open_close const&); + void store_cd_info(cd_detected const&); + void stop_playback(stop const&); + void pause_playback(pause const&); + void resume_playback(play const&); + void stop_and_open(open_close const&); + + + #ifdef __MWERKS__ + private: + #endif + friend class state_machine; + typedef player p; // makes transition table cleaner + + // transition table + struct transition_table : mpl::vector11< + + // Start Event Next Action + // +---------+-------------+---------+---------------------+ + row < Stopped , play , Playing , &p::start_playback >, + row < Stopped , open_close , Open , &p::open_drawer >, + // +---------+-------------+---------+---------------------+ + row < Open , open_close , Empty , &p::close_drawer >, + // +---------+-------------+---------+---------------------+ + row < Empty , open_close , Open , &p::open_drawer >, + row < Empty , cd_detected , Stopped , &p::store_cd_info >, + // +---------+-------------+---------+---------------------+ + row < Playing , stop , Stopped , &p::stop_playback >, + row < Playing , pause , Paused , &p::pause_playback >, + row < Playing , open_close , Open , &p::stop_and_open >, + // +---------+-------------+---------+---------------------+ + row < Paused , play , Playing , &p::resume_playback >, + row < Paused , stop , Stopped , &p::stop_playback >, + row < Paused , open_close , Open , &p::stop_and_open > + // +---------+-------------+---------+---------------------+ + + > {}; +typedef + +event_dispatcher< + row + , event_dispatcher< + row + , default_event_dispatcher + > +> + dummy; +}; + + void player::start_playback(play const&){} + void player::open_drawer(open_close const&){} + void player::close_drawer(open_close const&){} + void player::store_cd_info(cd_detected const&){} + void player::stop_playback(stop const&){} + void player::pause_playback(pause const&){} + void player::resume_playback(play const&){} + void player::stop_and_open(open_close const&){} + + + + +int main() +{ + player p; // An instance of the FSM + + p.process_event(open_close()); // user opens CD player + p.process_event(open_close()); // inserts CD and closes + p.process_event( // CD is detected + cd_detected( + "louie, louie" + , std::vector( /* track lengths */ ) + ) + ); + p.process_event(play()); // etc. + p.process_event(pause()); + p.process_event(play()); + p.process_event(stop()); + return 0; +} diff --git a/src/boost/libs/mpl/example/fsm/player2.cpp b/src/boost/libs/mpl/example/fsm/player2.cpp new file mode 100644 index 00000000..8704ef5d --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/player2.cpp @@ -0,0 +1,326 @@ +// +// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed +// under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +#include "boost/mpl/int.hpp" +#include "boost/mpl/fold.hpp" +#include "boost/mpl/prior.hpp" +#include "boost/mpl/count.hpp" +#include "boost/mpl/insert.hpp" +#include +#include +#include +#include "boost/mpl/vector/vector20.hpp" +#include "boost/assert.hpp" +#include + +#include +#include +#include + +#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 310 +namespace std { using ::clock_t; } +#endif + +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +// A metafunction that returns the Event associated with a transition. +template +struct transition_event +{ + typedef typename Transition::event type; +}; + +// A metafunction computing the maximum of a transition's source and +// end states. +template +struct transition_max_state +{ + typedef typename mpl::int_< + (Transition::current_state > Transition::next_state) + ? Transition::current_state + : Transition::next_state + > type; +}; + +template +class state_machine; + +// Generates a singleton runtime lookup table that maps current state +// to a function that makes the FSM take its transition on the given +// Event type. +template +struct dispatch_table +{ + private: + // This is a table of these function pointers. + typedef int (*cell)(Fsm&, int, Event const&); + + // Compute the maximum state value in the Fsm so we know how big + // to make the table + BOOST_STATIC_CONSTANT( + int, max_state = ( + mpl::fold + , mpl::if_< + mpl::greater,_1> + , transition_max_state<_2> + , _1 + > + >::type::value + ) + ); + + // A function object for use with mpl::for_each that stuffs + // transitions into cells. + struct init_cell + { + init_cell(dispatch_table* self_) + : self(self_) + {} + + // Cell initializer function object, used with mpl::for_each + template + void operator()(Transition const&) const + { + self->entries[Transition::current_state] = &Transition::execute; + } + + dispatch_table* self; + }; + + public: + // initialize the dispatch table for a given Event and Fsm + dispatch_table() + { + // Initialize cells for no transition + for (int i = 0; i <= max_state; ++i) + { + // VC7.1 seems to need the two-phase assignment. + cell call_no_transition = &state_machine::call_no_transition; + entries[i] = call_no_transition; + } + + // Go back and fill in cells for matching transitions. + mpl::for_each< + mpl::filter_view< + Stt + , boost::is_same, Event> + > + >(init_cell(this)); + } + + // The singleton instance. + static const dispatch_table instance; + + public: // data members + cell entries[max_state + 1]; +}; + +// This declares the statically-initialized dispatch_table instance. +template +const dispatch_table +dispatch_table::instance; + +// CRTP base class for state machines. Pass the actual FSM class as +// the Derived parameter. +template +class state_machine +{ + public: // Member functions + + // Main function used by clients of the derived FSM to make + // transitions. + template + int process_event(Event const& evt) + { + typedef typename Derived::transition_table stt; + typedef dispatch_table table; + + // Call the action + return this->m_state + = table::instance.entries[this->m_state]( + *static_cast(this), this->m_state, evt); + } + + // Getter that returns the current state of the FSM + int current_state() const + { + return this->m_state; + } + + private: + template + friend class dispatch_table; + + template + static int call_no_transition(Derived& fsm, int state, Event const& e) + { + return fsm.no_transition(state, e); + } + + // Default no-transition handler. Can be replaced in the Derived + // FSM class. + template + int no_transition(int state, Event const& e) + { + BOOST_ASSERT(false); + return state; + } + + protected: // interface for the derived class + + template + state_machine(State state) // Construct with an initial state + : m_state(state) + { + } + + state_machine() + : m_state(Derived::initial_state) // Construct with the default initial_state + { + } + + // Template used to form rows in the transition table + template< + int CurrentState + , class Event + , int NextState + , void (Derived::*action)(Event const&) + > + struct row + { + BOOST_STATIC_CONSTANT(int, current_state = CurrentState); + BOOST_STATIC_CONSTANT(int, next_state = NextState); + typedef Event event; + + // Take the transition action and return the next state. + static int execute(Derived& fsm, int state, Event const& evt) + { + BOOST_ASSERT(state == current_state); + (fsm.*action)(evt); + return next_state; + } + }; + + private: // data members + int m_state; +}; + +namespace // Concrete FSM implementation +{ + // events + struct play {}; + struct stop {}; + struct pause {}; + struct open_close {}; + + // A "complicated" event type that carries some data. + struct cd_detected + { + cd_detected(std::string name, std::vector durations) + : name(name) + , track_durations(durations) + {} + + std::string name; + std::vector track_durations; + }; + + // Concrete FSM implementation + class player : public state_machine + { + // The list of FSM states + enum states { + Empty, Open, Stopped, Playing, Paused + , initial_state = Empty + }; + +#ifdef __MWERKS__ + public: // Codewarrior bug workaround. Tested at 0x3202 +#endif + // transition actions + void start_playback(play const&) { std::cout << "player::start_playback\n"; } + void open_drawer(open_close const&) { std::cout << "player::open_drawer\n"; } + void close_drawer(open_close const&) { std::cout << "player::close_drawer\n"; } + void store_cd_info(cd_detected const&) { std::cout << "player::store_cd_info\n"; } + void stop_playback(stop const&) { std::cout << "player::stop_playback\n"; } + void pause_playback(pause const&) { std::cout << "player::pause_playback\n"; } + void resume_playback(play const&) { std::cout << "player::resume_playback\n"; } + void stop_and_open(open_close const&) { std::cout << "player::stop_and_open\n"; } +#ifdef __MWERKS__ + private: +#endif + friend class state_machine; + typedef player p; // makes transition table cleaner + + // Transition table + struct transition_table : mpl::vector11< + // Start Event Next Action + // +---------+-------------+---------+---------------------+ + row < Stopped , play , Playing , &p::start_playback >, + row < Stopped , open_close , Open , &p::open_drawer >, + // +---------+-------------+---------+---------------------+ + row < Open , open_close , Empty , &p::close_drawer >, + // +---------+-------------+---------+---------------------+ + row < Empty , open_close , Open , &p::open_drawer >, + row < Empty , cd_detected , Stopped , &p::store_cd_info >, + // +---------+-------------+---------+---------------------+ + row < Playing , stop , Stopped , &p::stop_playback >, + row < Playing , pause , Paused , &p::pause_playback >, + row < Playing , open_close , Open , &p::stop_and_open >, + // +---------+-------------+---------+---------------------+ + row < Paused , play , Playing , &p::resume_playback >, + row < Paused , stop , Stopped , &p::stop_playback >, + row < Paused , open_close , Open , &p::stop_and_open > + // +---------+-------------+---------+---------------------+ + > {}; + + // Replaces the default no-transition response. + template + int no_transition(int state, Event const& e) + { + std::cout << "no transition from state " << state + << " on event " << typeid(e).name() << std::endl; + return state; + } + }; + + // + // Testing utilities. + // + static char const* const state_names[] = { "Empty", "Open", "Stopped", "Playing", "Paused" }; + + void pstate(player const& p) + { + std::cout << " -> " << state_names[p.current_state()] << std::endl; + } + + void test() + { + player p; + p.process_event(open_close()); pstate(p); + p.process_event(open_close()); pstate(p); + p.process_event( + cd_detected( + "louie, louie" + , std::vector( /* track lengths */ ) + ) + ); + pstate(p); + + p.process_event(play()); pstate(p); + p.process_event(pause()); pstate(p); + p.process_event(play()); pstate(p); + p.process_event(stop()); pstate(p); + } +} + +int main() +{ + test(); + return 0; +} diff --git a/src/boost/libs/mpl/example/fsm/state_machine.hpp b/src/boost/libs/mpl/example/fsm/state_machine.hpp new file mode 100644 index 00000000..4bfd0169 --- /dev/null +++ b/src/boost/libs/mpl/example/fsm/state_machine.hpp @@ -0,0 +1,145 @@ + +#ifndef BOOST_FSM_STATE_MACHINE_INCLUDED +#define BOOST_FSM_STATE_MACHINE_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include "aux_/event.hpp" +#include "aux_/state.hpp" +#include "aux_/transition.hpp" +#include "aux_/STT_impl_gen.hpp" +#include + +#include +#include +#include + +namespace fsm { + +template< typename Derived > +class state_machine +{ + private: + typedef state_machine self_t; + typedef aux::base_event base_event_t; + typedef boost::shared_ptr base_event_ptr_t; + + public: + typedef long state_t; + typedef void (Derived::* invariant_func_t)() const; + + template< typename DerivedEvent > + struct event + : aux::event + { + }; + + void process_event(base_event_t const& evt) + { + // all internal events should be handled at this point + assert(!m_events_queue.size()); + + // process the external event passed + do_transition(evt); + + // if the previous transition generated any internal events, + // process those + while (m_events_queue.size()) + { + do_transition(*m_events_queue.front()); + m_events_queue.pop(); + } + } + + state_t current_state() const + { + return m_state; + } + + protected: + // interface for the derived class + + state_machine(state_t const& initial_state) + : m_state(initial_state) + { + } + + state_machine() + : m_state(typename Derived::initial_state()) + { + } + + virtual ~state_machine() + { + } + + +#if defined(BOOST_NO_CXX11_SMART_PTR) + + void post_event(std::auto_ptr evt) + +#else + + void post_event(std::unique_ptr evt) + +#endif + + { + m_events_queue.push(base_event_ptr_t(evt.release())); + } + + template< + long State +#if !defined(BOOST_INTEL_CXX_VERSION) && (!defined(__GNUC__) || __GNUC__ >= 3) + , invariant_func_t f = static_cast(0) +#else + , invariant_func_t f = 0 +#endif + > + struct state + : fsm::aux::state + { + }; + + template< + typename From + , typename Event + , typename To + , bool (Derived::* transition_func)(Event const&) + > + struct transition + : aux::transition< Derived,From,Event,To,transition_func > + { + }; + + private: + + void do_transition(base_event_t const& evt) + { + typedef typename Derived::transition_table STT_; + typedef typename aux::STT_impl_gen< STT_ >::type STT_impl_; + + m_state = STT_impl_::do_transition( + static_cast(*this) + , m_state + , evt + ); + } + + state_t m_state; + std::queue< base_event_ptr_t > m_events_queue; +}; + +} // namespace fsm + +#endif // BOOST_FSM_STATE_MACHINE_INCLUDED diff --git a/src/boost/libs/mpl/example/inherit_linearly.cpp b/src/boost/libs/mpl/example/inherit_linearly.cpp new file mode 100644 index 00000000..368be77c --- /dev/null +++ b/src/boost/libs/mpl/example/inherit_linearly.cpp @@ -0,0 +1,62 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +template< typename Base, typename T > +struct tuple_part + : Base +{ + typedef tuple_part type; // note the typedef + typedef typename Base::index::next index; + + friend T& field(tuple_part& t, index) { return t.field_; } + T field_; +}; + +struct empty_tuple +{ + typedef mpl::int_<-1> index; +}; + + +typedef mpl::inherit_linearly< + mpl::list + , tuple_part<_,_> + , empty_tuple + >::type my_tuple; + + +int main() +{ + my_tuple t; + + field(t, mpl::int_<0>()) = -1; + field(t, mpl::int_<1>()) = "text"; + field(t, mpl::int_<2>()) = false; + + std::cout + << field(t, mpl::int_<0>()) << '\n' + << field(t, mpl::int_<1>()) << '\n' + << field(t, mpl::int_<2>()) << '\n' + ; + + return 0; +} diff --git a/src/boost/libs/mpl/example/inherit_multiply.cpp b/src/boost/libs/mpl/example/inherit_multiply.cpp new file mode 100644 index 00000000..e8a6fde2 --- /dev/null +++ b/src/boost/libs/mpl/example/inherit_multiply.cpp @@ -0,0 +1,58 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +template< typename T > +struct tuple_field +{ + typedef tuple_field type; // note the typedef + T field_; +}; + +template< typename T > +inline +T& field(tuple_field& t) +{ + return t.field_; +} + +typedef mpl::inherit_linearly< + mpl::list + , mpl::inherit< _1, tuple_field<_2> > + >::type my_tuple; + + +int main() +{ + my_tuple t; + + field(t) = -1; + field(t) = "text"; + field(t) = false; + + std::cout + << field(t) << '\n' + << field(t) << '\n' + << field(t) << '\n' + ; + + return 0; +} diff --git a/src/boost/libs/mpl/example/integer.cpp b/src/boost/libs/mpl/example/integer.cpp new file mode 100644 index 00000000..879c4134 --- /dev/null +++ b/src/boost/libs/mpl/example/integer.cpp @@ -0,0 +1,67 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace mpl = boost::mpl; +using namespace mpl::placeholders; + +template< int bit_size > +class big_int +{ + // ... +}; + +template< int bit_size > +struct integer +{ + typedef mpl::list builtins_; + typedef typename mpl::base< typename mpl::lower_bound< + mpl::transform_view< builtins_ + , mpl::multiplies< mpl::sizeof_<_1>, mpl::int_<8> > + > + , mpl::int_ + >::type >::type iter_; + + typedef typename mpl::end::type last_; + typedef typename mpl::eval_if< + boost::is_same + , mpl::identity< big_int > + , mpl::deref + >::type type; +}; + +typedef integer<1>::type int1; +typedef integer<5>::type int5; +typedef integer<15>::type int15; +typedef integer<32>::type int32; +typedef integer<100>::type int100; + +BOOST_MPL_ASSERT(( boost::is_same< int1, char > )); +BOOST_MPL_ASSERT(( boost::is_same< int5, char > )); +BOOST_MPL_ASSERT(( boost::is_same< int15, short > )); +BOOST_MPL_ASSERT(( boost::is_same< int32, int > )); +BOOST_MPL_ASSERT(( boost::is_same< int100, big_int<100> > )); diff --git a/src/boost/libs/mpl/example/tuple_from_list.cpp b/src/boost/libs/mpl/example/tuple_from_list.cpp new file mode 100644 index 00000000..bf5c6a9e --- /dev/null +++ b/src/boost/libs/mpl/example/tuple_from_list.cpp @@ -0,0 +1,46 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +using namespace boost::mpl; + +template< typename Types > struct tuple_gen + : reverse_fold< + Types + , boost::tuples::null_type + , boost::tuples::cons<_2,_1> + > +{ +}; + +int main() +{ + tuple_gen< list >::type t; + + boost::get<0>(t) = -1; + boost::get<1>(t) = "text"; + boost::get<2>(t) = false; + + std::cout + << boost::get<0>(t) << '\n' + << boost::get<1>(t) << '\n' + << boost::get<2>(t) << '\n' + ; + + return 0; +} diff --git a/src/boost/libs/mpl/index.html b/src/boost/libs/mpl/index.html new file mode 100644 index 00000000..4540421a --- /dev/null +++ b/src/boost/libs/mpl/index.html @@ -0,0 +1,13 @@ + + + + + +Automatic redirection failed, please go to +doc/index.html
+

© Copyright Beman Dawes, 2001

+

Distributed under the Boost Software License, Version 1.0. (See accompanying +file LICENSE_1_0.txt or copy +at www.boost.org/LICENSE_1_0.txt)

+ + \ No newline at end of file diff --git a/src/boost/libs/mpl/meta/libraries.json b/src/boost/libs/mpl/meta/libraries.json new file mode 100644 index 00000000..6f7bd4c7 --- /dev/null +++ b/src/boost/libs/mpl/meta/libraries.json @@ -0,0 +1,14 @@ +{ + "key": "mpl", + "name": "MPL", + "authors": [ + "Aleksey Gurtovoy" + ], + "description": "The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explict metaprogramming in C++ as easy and enjoyable as possible within the current language.", + "category": [ + "Metaprogramming" + ], + "maintainers": [ + "Aleksey Gurtovoy " + ] +} diff --git a/src/boost/libs/mpl/preprocessed/README.txt b/src/boost/libs/mpl/preprocessed/README.txt new file mode 100644 index 00000000..75ae37f0 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/README.txt @@ -0,0 +1,70 @@ +Pre-processing of MPL-containers +-------------------------------- + +Pre-processing of MPL-containers can be accomplished using the script +"boost_mpl_preprocess.py". In the simple case call it with a single +argument which is the path to the source-directory of Boost. + + python boost_mpl_preprocess.py + +If the Boost source-directory is the one this script resides in, you +can just call it without any arguments. + + python boost_mpl_preprocess.py + +Either way, this will pre-process all four MPL-container types (vector, +list, set, map) and makes them able to hold up to 100 elements. They can +be used either in their 'numbered' or their 'variadic' form. + +Additionally, the script also allows more fine-grained pre-processing. +The maximal number of elements an MPL-container type is able to hold can +be different from the one of other MPL-container types and it can also +differ between its 'numbered' and 'variadic' form. +To see all options, call the script like this: + + python boost_mpl_preprocess.py --help + + +Fixing pre-processing of MPL-containers +--------------------------------------- + +Sadly, pre-processing of MPL-containers might fail, if the source-files +used as input are missing some header-comments required during the pre- +processing step. +However, the script "boost_mpl_preprocess.py" makes sure to patch these +input source-files prior to pre-processing (by implicitly calling script +"fix_boost_mpl_preprocess.py" with the chosen settings). It only patches +the source-files needed for pre-processing the selected MPL-container +types and their selected form ('numbered' or 'variadic'). +If calling it with a single (or no) argument (as in the former section) +all input source-files will be patched automatically. + +Instead of fixing the input-files implicitly during pre-processing one +can also fix them explicitly by calling "fix_boost_mpl_preprocess.py" +directly. +If you just want to test if any fixing is needed call it like this: + + python fix_boost_mpl_preprocess.py --check-only + +This will tell you if any fixing is needed. In such a case call the script +"fix_boost_mpl_preprocess.py" like this: + + python fix_boost_mpl_preprocess.py + +This will fix the header-comments of all the source-files needed during +pre-processing. Calling "boost_mpl_preprocess.py" afterwards should then +successfully pre-process the MPL-containers (without the need of implicitly +fixing any files again). + +Note: +Failure of pre-processing can be checked by examining at least one of the +following directories in which automatically generated files will be put +during pre-processing. If at least one file in these directories (or sub- +directories therein) has a size of zero bytes, fixing is needed. + + /boost/mpl/vector/aux_/preprocessed/ + /boost/mpl/list/aux_/preprocessed/ + /boost/mpl/set/aux_/preprocessed/ + /boost/mpl/map/aux_/preprocessed/ + /boost/mpl/aux_/preprocessed/ + diff --git a/src/boost/libs/mpl/preprocessed/boost_mpl_preprocess.py b/src/boost/libs/mpl/preprocessed/boost_mpl_preprocess.py new file mode 100755 index 00000000..b4973910 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/boost_mpl_preprocess.py @@ -0,0 +1,250 @@ +# Copyright Deniz Bahadir 2015 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. +# See http://stackoverflow.com/a/20660264/3115457 for further information. +# See http://stackoverflow.com/a/29627158/3115457 for further information. + +import fix_boost_mpl_preprocess as fixmpl +import argparse +import sys +import os +import os.path +import re +import fileinput +import shutil + + +def create_more_container_files(sourceDir, suffix, maxElements, containers, containers2): + """Creates additional files for the individual MPL-containers.""" + + # Create files for each MPL-container with 20 to 'maxElements' elements + # which will be used during generation. + for container in containers: + for i in range(20, maxElements, 10): + # Create copy of "template"-file. + newFile = os.path.join( sourceDir, container, container + str(i+10) + suffix ) + shutil.copyfile( os.path.join( sourceDir, container, container + "20" + suffix ), newFile ) + # Adjust copy of "template"-file accordingly. + for line in fileinput.input( newFile, inplace=1, mode="rU" ): + line = re.sub(r'20', '%TWENTY%', line.rstrip()) + line = re.sub(r'11', '%ELEVEN%', line.rstrip()) + line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip()) + line = re.sub(r'%TWENTY%', re.escape(str(i+10)), line.rstrip()) + line = re.sub(r'%ELEVEN%', re.escape(str(i + 1)), line.rstrip()) + line = re.sub(r'%TEN%', re.escape(str(i)), line.rstrip()) + print(line) + for container in containers2: + for i in range(20, maxElements, 10): + # Create copy of "template"-file. + newFile = os.path.join( sourceDir, container, container + str(i+10) + "_c" + suffix ) + shutil.copyfile( os.path.join( sourceDir, container, container + "20_c" + suffix ), newFile ) + # Adjust copy of "template"-file accordingly. + for line in fileinput.input( newFile, inplace=1, mode="rU" ): + line = re.sub(r'20', '%TWENTY%', line.rstrip()) + line = re.sub(r'11', '%ELEVEN%', line.rstrip()) + line = re.sub(r'10(?![0-9])', '%TEN%', line.rstrip()) + line = re.sub(r'%TWENTY%', re.escape(str(i+10)), line.rstrip()) + line = re.sub(r'%ELEVEN%', re.escape(str(i + 1)), line.rstrip()) + line = re.sub(r'%TEN%', re.escape(str(i)), line.rstrip()) + print(line) + + +def create_input_for_numbered_sequences(headerDir, sourceDir, containers, maxElements): + """Creates additional source- and header-files for the numbered sequence MPL-containers.""" + # Create additional container-list without "map". + containersWithoutMap = containers[:] + try: + containersWithoutMap.remove('map') + except ValueError: + # We can safely ignore if "map" is not contained in 'containers'! + pass + # Create header/source-files. + create_more_container_files(headerDir, ".hpp", maxElements, containers, containersWithoutMap) + create_more_container_files(sourceDir, ".cpp", maxElements, containers, containersWithoutMap) + + +def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxElements): + """Adjusts the limits of variadic sequence MPL-containers.""" + for container in containers: + headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) + regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + container.upper() + r'_SIZE\s+)[0-9]+' + regexReplace = r'\g<1>' + re.escape( str(maxElements) ) + for line in fileinput.input( headerFile, inplace=1, mode="rU" ): + line = re.sub(regexMatch, regexReplace, line.rstrip()) + print(line) + + +def current_boost_dir(): + """Returns the (relative) path to the Boost source-directory this file is located in (if any).""" + # Path to directory containing this script. + path = os.path.dirname( os.path.realpath(__file__) ) + # Making sure it is located in "${boost-dir}/libs/mpl/preprocessed". + for directory in reversed( ["libs", "mpl", "preprocessed"] ): + (head, tail) = os.path.split(path) + if tail == directory: + path = head + else: + return None + return os.path.relpath( path ) + + + +def to_positive_multiple_of_10(string): + """Converts a string into its encoded positive integer (greater zero) or throws an exception.""" + try: + value = int(string) + except ValueError: + msg = '"%r" is not a positive multiple of 10 (greater zero).' % string + raise argparse.ArgumentTypeError(msg) + if value <= 0 or value % 10 != 0: + msg = '"%r" is not a positive multiple of 10 (greater zero).' % string + raise argparse.ArgumentTypeError(msg) + return value + + +def to_existing_absolute_path(string): + """Converts a path into its absolute path and verifies that it exists or throws an exception.""" + value = os.path.abspath(string) + if not os.path.exists( value ) or not os.path.isdir( value ): + msg = '"%r" is not a valid path to a directory.' % string + raise argparse.ArgumentTypeError(msg) + return value + + +def main(): + """The main function.""" + + # Find the current Boost source-directory in which this script is located. + sourceDir = current_boost_dir() + if sourceDir == None: + sourceDir = "" + + # Prepare and run cmdline-parser. + cmdlineParser = argparse.ArgumentParser(description="A generator-script for pre-processed Boost.MPL headers.") + cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true', + help="Be a little bit more verbose.") + cmdlineParser.add_argument("-s", "--sequence-type", dest='seqType', choices=['variadic', 'numbered', 'both'], + default='both', + help="Only update pre-processed headers for the selected sequence types, " + "either 'numbered' sequences, 'variadic' sequences or 'both' sequence " + "types. (Default=both)") + cmdlineParser.add_argument("--no-vector", dest='want_vector', action='store_false', + help="Do not update pre-processed headers for Boost.MPL Vector.") + cmdlineParser.add_argument("--no-list", dest='want_list', action='store_false', + help="Do not update pre-processed headers for Boost.MPL List.") + cmdlineParser.add_argument("--no-set", dest='want_set', action='store_false', + help="Do not update pre-processed headers for Boost.MPL Set.") + cmdlineParser.add_argument("--no-map", dest='want_map', action='store_false', + help="Do not update pre-processed headers for Boost.MPL Map.") + cmdlineParser.add_argument("--num-elements", dest='numElements', metavar="", + type=to_positive_multiple_of_10, default=100, + help="The maximal number of elements per container sequence. (Default=100)") + cmdlineParser.add_argument(dest='sourceDir', metavar="", default=current_boost_dir(), nargs='?', + type=to_existing_absolute_path, + help="The source-directory of Boost. (Default=\"" + sourceDir + "\")") + args = cmdlineParser.parse_args() + + # Some verbose debug output. + if args.verbose: + print "Arguments extracted from command-line:" + print " verbose = ", args.verbose + print " source directory = ", args.sourceDir + print " num elements = ", args.numElements + print " sequence type = ", args.seqType + print " want: vector = ", args.want_vector + print " want: list = ", args.want_list + print " want: set = ", args.want_set + print " want: map = ", args.want_map + + # Verify that we received any source-directory. + if args.sourceDir == None: + print "You should specify a valid path to the Boost source-directory." + sys.exit(0) + + # The directories for header- and source files of Boost.MPL. + # NOTE: Assuming 'args.sourceDir' is the source-directory of the entire boost project. + headerDir = os.path.join( args.sourceDir, "boost", "mpl" ) + sourceDir = os.path.join( args.sourceDir, "libs", "mpl", "preprocessed" ) + # Check that the header/source-directories exist. + if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ): + # Maybe 'args.sourceDir' is not the source-directory of the entire boost project + # but instead of the Boost.MPL git-directory, only? + headerDir = os.path.join( args.sourceDir, "include", "boost", "mpl" ) + sourceDir = os.path.join( args.sourceDir, "preprocessed" ) + if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ): + cmdlineParser.print_usage() + print "error: Cannot find Boost.MPL header/source files in given Boost source-directory!" + sys.exit(0) + + # Some verbose debug output. + if args.verbose: + print "Chosen header-directory: ", headerDir + print "Chosen source-directory: ", sourceDir + + # Create list of containers for which files shall be pre-processed. + containers = [] + if args.want_vector: + containers.append('vector') + if args.want_list: + containers.append('list') + if args.want_set: + containers.append('set') + if args.want_map: + containers.append('map') + if containers == []: + print "Nothing to do." + print "(Why did you prevent generating pre-processed headers for all Boost.MPL container types?)" + sys.exit(0) + + # Possibly fix the header-comments of input-files needed for pre-processing. + if args.verbose: + print "Checking if prior to pre-processing some input-files need fixing." + needFixing = fixmpl.check_input_files(headerDir, sourceDir, containers, args.seqType, args.verbose) + if needFixing: + if args.verbose: + print "Fixing of some input-files prior to pre-processing is needed." + print "Will fix them now!" + fixmpl.fix_input_files(headerDir, sourceDir, containers, args.seqType, args.verbose) + + # Some verbose debug output. + if args.verbose: + print "Containers for which to pre-process headers: ", containers + + # Create (additional) input files for generating pre-processed headers of numbered sequence MPL containers. + if args.seqType == "both" or args.seqType == "numbered": + create_input_for_numbered_sequences(headerDir, sourceDir, containers, args.numElements) + # Modify settings for generating pre-processed headers of variadic sequence MPL containers. + if args.seqType == "both" or args.seqType == "variadic": + adjust_container_limits_for_variadic_sequences(headerDir, containers, args.numElements) + + # Generate MPL-preprocessed files. + os.chdir( sourceDir ) + if args.seqType == "both" or args.seqType == "numbered": + if args.want_vector: + if args.verbose: + print "Pre-process headers for Boost.MPL numbered vectors." + os.system( "python " + os.path.join( sourceDir, "preprocess_vector.py" ) + " all " + args.sourceDir ) + if args.want_list: + if args.verbose: + print "Pre-process headers for Boost.MPL numbered lists." + os.system( "python " + os.path.join( sourceDir, "preprocess_list.py" ) + " all " + args.sourceDir ) + if args.want_set: + if args.verbose: + print "Pre-process headers for Boost.MPL numbered sets." + os.system( "python " + os.path.join( sourceDir, "preprocess_set.py" ) + " all " + args.sourceDir ) + if args.want_map: + if args.verbose: + print "Pre-process headers for Boost.MPL numbered maps." + os.system( "python " + os.path.join( sourceDir, "preprocess_map.py" ) + " all " + args.sourceDir ) + if args.seqType == "both" or args.seqType == "variadic": + if args.verbose: + print "Pre-process headers for Boost.MPL variadic containers." + os.system( "python " + os.path.join( sourceDir, "preprocess.py" ) + " all " + args.sourceDir ) + + +if __name__ == '__main__': + main() diff --git a/src/boost/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py b/src/boost/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py new file mode 100755 index 00000000..3b92d25d --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py @@ -0,0 +1,205 @@ +# Copyright Deniz Bahadir 2015 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. +# See http://stackoverflow.com/a/29627158/3115457 for further information. + +import argparse +import sys +import os.path +import re +import fileinput +import datetime +import glob + + +def check_header_comment(filename): + """Checks if the header-comment of the given file needs fixing.""" + # Check input file. + name = os.path.basename( filename ) + # Read content of input file. + sourcefile = open( filename, "rU" ) + content = sourcefile.read() + sourcefile.close() + # Search content for '$Id$'. + match = re.search(r'\$Id\$', content) + if match == None: + # Make sure that the correct value for '$Id$' was already set. + match = re.search(r'\$Id: ' + name + r'\s+[^$]+\$', content) + if match != None: + # The given file needs no fixing. + return False + # The given file needs fixing. + return True + + +def check_input_files_for_variadic_seq(headerDir, sourceDir): + """Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing.""" + # Check input files in include/source-directories. + files = glob.glob( os.path.join( headerDir, "*.hpp" ) ) + files += glob.glob( os.path.join( headerDir, "aux_", "*.hpp" ) ) + files += glob.glob( os.path.join( sourceDir, "src", "*" ) ) + for currentFile in sorted( files ): + if check_header_comment( currentFile ): + return True + return False + + +def check_input_files_for_numbered_seq(sourceDir, suffix, containers): + """Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing.""" + # Check input files for each MPL-container type. + for container in containers: + files = glob.glob( os.path.join( sourceDir, container, container + '*' + suffix ) ) + for currentFile in sorted( files ): + if check_header_comment( currentFile ): + return True + return False + + +def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'], + seqType='both', verbose=False): + """Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing.""" + # Check the input files for containers in their variadic form. + result1 = False + if seqType == "both" or seqType == "variadic": + if verbose: + print "Check if input files for pre-processing Boost.MPL variadic containers need fixing." + result1 = check_input_files_for_variadic_seq(headerDir, sourceDir) + if verbose: + if result1: + print " At least one input file needs fixing!" + else: + print " No input file needs fixing!" + # Check the input files for containers in their numbered form. + result2 = False + result3 = False + if seqType == "both" or seqType == "numbered": + if verbose: + print "Check input files for pre-processing Boost.MPL numbered containers." + result2 = check_input_files_for_numbered_seq(headerDir, ".hpp", containers) + result3 = check_input_files_for_numbered_seq(sourceDir, ".cpp", containers) + if verbose: + if result2 or result3: + print " At least one input file needs fixing!" + else: + print " No input file needs fixing!" + # Return result. + return result1 or result2 or result3 + +def fix_header_comment(filename, timestamp): + """Fixes the header-comment of the given file.""" + # Fix input file. + name = os.path.basename( filename ) + for line in fileinput.input( filename, inplace=1, mode="rU" ): + # If header-comment already contains anything for '$Id$', remove it. + line = re.sub(r'\$Id:[^$]+\$', r'$Id$', line.rstrip()) + # Replace '$Id$' by a string containing the file's name (and a timestamp)! + line = re.sub(re.escape(r'$Id$'), r'$Id: ' + name + r' ' + timestamp.isoformat() + r' $', line.rstrip()) + print(line) + + +def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp): + """Fixes files used as input when pre-processing MPL-containers in their variadic form.""" + # Fix files in include/source-directories. + files = glob.glob( os.path.join( headerDir, "*.hpp" ) ) + files += glob.glob( os.path.join( headerDir, "aux_", "*.hpp" ) ) + files += glob.glob( os.path.join( sourceDir, "src", "*" ) ) + for currentFile in sorted( files ): + fix_header_comment( currentFile, timestamp ) + + +def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers): + """Fixes files used as input when pre-processing MPL-containers in their numbered form.""" + # Fix input files for each MPL-container type. + for container in containers: + files = glob.glob( os.path.join( sourceDir, container, container + '*' + suffix ) ) + for currentFile in sorted( files ): + fix_header_comment( currentFile, timestamp ) + + +def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'], + seqType='both', verbose=False): + """Fixes source- and header-files used as input when pre-processing MPL-containers.""" + # The new modification time. + timestamp = datetime.datetime.now(); + # Fix the input files for containers in their variadic form. + if seqType == "both" or seqType == "variadic": + if verbose: + print "Fix input files for pre-processing Boost.MPL variadic containers." + fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp) + # Fix the input files for containers in their numbered form. + if seqType == "both" or seqType == "numbered": + if verbose: + print "Fix input files for pre-processing Boost.MPL numbered containers." + fix_input_files_for_numbered_seq(headerDir, ".hpp", timestamp, containers) + fix_input_files_for_numbered_seq(sourceDir, ".cpp", timestamp, containers) + + +def to_existing_absolute_path(string): + """Converts a path into its absolute path and verifies that it exists or throws an exception.""" + value = os.path.abspath(string) + if not os.path.exists( value ) or not os.path.isdir( value ): + msg = '"%r" is not a valid path to a directory.' % string + raise argparse.ArgumentTypeError(msg) + return value + + +def main(): + """The main function.""" + + # Prepare and run cmdline-parser. + cmdlineParser = argparse.ArgumentParser( + description="Fixes the input files used for pre-processing of Boost.MPL headers.") + cmdlineParser.add_argument("-v", "--verbose", dest='verbose', action='store_true', + help="Be a little bit more verbose.") + cmdlineParser.add_argument("--check-only", dest='checkonly', action='store_true', + help="Only checks if fixing is required.") + cmdlineParser.add_argument(dest='sourceDir', metavar="", + type=to_existing_absolute_path, + help="The source-directory of Boost.") + args = cmdlineParser.parse_args() + + # Some verbose debug output. + if args.verbose: + print "Arguments extracted from command-line:" + print " verbose = ", args.verbose + print " check-only = ", args.checkonly + print " source directory = ", args.sourceDir + + # The directories for header- and source files of Boost.MPL. + # NOTE: Assuming 'args.sourceDir' is the source-directory of the entire boost project. + headerDir = os.path.join( args.sourceDir, "boost", "mpl" ) + sourceDir = os.path.join( args.sourceDir, "libs", "mpl", "preprocessed" ) + # Check that the header/source-directories exist. + if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ): + # Maybe 'args.sourceDir' is not the source-directory of the entire boost project + # but instead of the Boost.MPL git-directory, only? + headerDir = os.path.join( args.sourceDir, "include", "boost", "mpl" ) + sourceDir = os.path.join( args.sourceDir, "preprocessed" ) + if not os.path.exists( headerDir ) or not os.path.exists( sourceDir ): + cmdlineParser.print_usage() + print "error: Cannot find Boost.MPL header/source files in given Boost source-directory!" + sys.exit(0) + + # Some verbose debug output. + if args.verbose: + print "Chosen header-directory: ", headerDir + print "Chosen source-directory: ", sourceDir + + if args.checkonly: + # Check input files for generating pre-processed headers. + result = check_input_files(headerDir, sourceDir, verbose = args.verbose) + if result: + print "Fixing the input-files used for pre-processing of Boost.MPL headers IS required." + else: + print "Fixing the input-files used for pre-processing of Boost.MPL headers is NOT required." + else: + # Fix input files for generating pre-processed headers. + fix_input_files(headerDir, sourceDir, verbose = args.verbose) + + +if __name__ == '__main__': + main() diff --git a/src/boost/libs/mpl/preprocessed/include/bcc/user.hpp b/src/boost/libs/mpl/preprocessed/include/bcc/user.hpp new file mode 100644 index 00000000..97340b28 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/bcc/user.hpp @@ -0,0 +1,27 @@ + +// Copyright Aleksey Gurtovoy 2003-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG + +#include + +#define BOOST_NO_TEMPLATE_TEMPLATES +#define BOOST_MPL_CFG_BCC590_WORKAROUNDS +#define BOOST_MPL_CFG_NO_BIND_TEMPLATE +#define BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC +#define BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES +#define BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES +#define BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION +#define BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING +#define BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS +#define BOOST_MPL_CFG_NO_NESTED_FORWARDING diff --git a/src/boost/libs/mpl/preprocessed/include/bcc551/user.hpp b/src/boost/libs/mpl/preprocessed/include/bcc551/user.hpp new file mode 100644 index 00000000..eaa6fd9e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/bcc551/user.hpp @@ -0,0 +1,25 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG + +#include + +#define BOOST_NO_TEMPLATE_TEMPLATES +#define BOOST_MPL_CFG_NO_BIND_TEMPLATE +#define BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC +#define BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES +#define BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION +#define BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING +#define BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS +#define BOOST_MPL_CFG_NO_NESTED_FORWARDING diff --git a/src/boost/libs/mpl/preprocessed/include/bcc_pre590/user.hpp b/src/boost/libs/mpl/preprocessed/include/bcc_pre590/user.hpp new file mode 100644 index 00000000..7cd1076d --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/bcc_pre590/user.hpp @@ -0,0 +1,26 @@ + +// Copyright Aleksey Gurtovoy 2003-2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date: 2004-09-14 07:39:55 -0500 (Tue, 14 Sep 2004) $ +// $Revision: 25084 $ + +#define BOOST_NO_CONFIG + +#include + +#define BOOST_NO_TEMPLATE_TEMPLATES +#define BOOST_MPL_CFG_NO_BIND_TEMPLATE +#define BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC +#define BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES +#define BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES +#define BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION +#define BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING +#define BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS +#define BOOST_MPL_CFG_NO_NESTED_FORWARDING diff --git a/src/boost/libs/mpl/preprocessed/include/dmc/user.hpp b/src/boost/libs/mpl/preprocessed/include/dmc/user.hpp new file mode 100644 index 00000000..c0d92b14 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/dmc/user.hpp @@ -0,0 +1,15 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS diff --git a/src/boost/libs/mpl/preprocessed/include/gcc/user.hpp b/src/boost/libs/mpl/preprocessed/include/gcc/user.hpp new file mode 100644 index 00000000..6059dc3e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/gcc/user.hpp @@ -0,0 +1,15 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING diff --git a/src/boost/libs/mpl/preprocessed/include/mwcw/user.hpp b/src/boost/libs/mpl/preprocessed/include/mwcw/user.hpp new file mode 100644 index 00000000..0b74799e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/mwcw/user.hpp @@ -0,0 +1,15 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES diff --git a/src/boost/libs/mpl/preprocessed/include/no_ttp/user.hpp b/src/boost/libs/mpl/preprocessed/include/no_ttp/user.hpp new file mode 100644 index 00000000..d354bdf9 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/no_ttp/user.hpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_NO_TEMPLATE_TEMPLATES +#define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC diff --git a/src/boost/libs/mpl/preprocessed/include/plain/user.hpp b/src/boost/libs/mpl/preprocessed/include/plain/user.hpp new file mode 100644 index 00000000..a6ecf157 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/plain/user.hpp @@ -0,0 +1,15 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_MPL_AUX_LAMBDA_SUPPORT(unused1, unused2, unused3) diff --git a/src/boost/libs/mpl/preprocessed/include/typeof_based/user.hpp b/src/boost/libs/mpl/preprocessed/include/typeof_based/user.hpp new file mode 100644 index 00000000..36005bbd --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/include/typeof_based/user.hpp @@ -0,0 +1,15 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_NO_CONFIG +#define BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES diff --git a/src/boost/libs/mpl/preprocessed/list/list10.cpp b/src/boost/libs/mpl/preprocessed/list/list10.cpp new file mode 100644 index 00000000..1081c24f --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list10.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list10_c.cpp b/src/boost/libs/mpl/preprocessed/list/list10_c.cpp new file mode 100644 index 00000000..d61940a7 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list10_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list20.cpp b/src/boost/libs/mpl/preprocessed/list/list20.cpp new file mode 100644 index 00000000..ad11b3e8 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list20.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list20_c.cpp b/src/boost/libs/mpl/preprocessed/list/list20_c.cpp new file mode 100644 index 00000000..a9c93ae7 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list20_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list30.cpp b/src/boost/libs/mpl/preprocessed/list/list30.cpp new file mode 100644 index 00000000..8c16a647 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list30.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list30_c.cpp b/src/boost/libs/mpl/preprocessed/list/list30_c.cpp new file mode 100644 index 00000000..9d7539d3 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list30_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list40.cpp b/src/boost/libs/mpl/preprocessed/list/list40.cpp new file mode 100644 index 00000000..364fda28 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list40.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list40_c.cpp b/src/boost/libs/mpl/preprocessed/list/list40_c.cpp new file mode 100644 index 00000000..ceabeb98 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list40_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list50.cpp b/src/boost/libs/mpl/preprocessed/list/list50.cpp new file mode 100644 index 00000000..da35a615 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list50.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/list/list50_c.cpp b/src/boost/libs/mpl/preprocessed/list/list50_c.cpp new file mode 100644 index 00000000..f8d54ece --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/list/list50_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/map/map10.cpp b/src/boost/libs/mpl/preprocessed/map/map10.cpp new file mode 100644 index 00000000..4636ccd9 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/map/map10.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/map/map20.cpp b/src/boost/libs/mpl/preprocessed/map/map20.cpp new file mode 100644 index 00000000..d95a8b07 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/map/map20.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/map/map30.cpp b/src/boost/libs/mpl/preprocessed/map/map30.cpp new file mode 100644 index 00000000..487b9e0d --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/map/map30.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/map/map40.cpp b/src/boost/libs/mpl/preprocessed/map/map40.cpp new file mode 100644 index 00000000..748e5ad4 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/map/map40.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/map/map50.cpp b/src/boost/libs/mpl/preprocessed/map/map50.cpp new file mode 100644 index 00000000..261502ce --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/map/map50.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/pp.py b/src/boost/libs/mpl/preprocessed/pp.py new file mode 100644 index 00000000..24bfd27e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/pp.py @@ -0,0 +1,256 @@ + +# Copyright Aleksey Gurtovoy 2001-2004 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import fileinput +import os +import re +import string +import sys + +if_else = lambda a,b,c:(a and [b] or [c])[0] +max_len = 79 +ident = 4 + +def nearest_ident_pos(text): + return (len(text)/ident) * ident + +def block_format(limits, text, first_sep=' ', sep=',', need_last_ident=1 ): + if sep == ',' and string.find( text, '<' ) != -1: + sep = '%s ' % sep + + words = string.split( + string.join( string.split( text ), ' ' ) + , sep + ) + + s = ' ' * limits[0] + max_len = limits[1] + return '%s\n%s' \ + % ( + reduce( + lambda t,w,max_len=max_len,s=s,sep=sep: + if_else(t[1] + len(w) < max_len + , ('%s%s%s'% (t[0],t[2],w), t[1]+len(w)+len(t[2]), sep) + , ('%s\n%s%s%s'% (t[0],s,sep,w), len(s)+len(w)+len(sep), sep) + ) + , words + , (s,len(s)+len(first_sep),first_sep) + )[0] + , if_else(need_last_ident,s,'') + ) + +def handle_args( match ): + if re.compile('^\s*(typedef|struct|static)\s+.*?$').match(match.group(0)): + return match.group(0) + + return '%s'\ + % block_format( + (nearest_ident_pos(match.group(1)),max_len) + , match.group(3) + , match.group(2) + , ',' + , 0 + ) + + +def handle_inline_args(match): + if len(match.group(0)) < max_len: + return match.group(0) + + if match.group(9) == None: + return '%s%s<\n%s>\n'\ + % ( + match.group(1) + , match.group(3) + , block_format( + (nearest_ident_pos(match.group(1))+ident,max_len) + , match.group(4) + ) + ) + + return '%s%s<\n%s>\n%s%s'\ + % ( + match.group(1) + , match.group(3) + , block_format( + (nearest_ident_pos(match.group(1))+ident,max_len-len(match.group(9))) + , match.group(4) + ) + , string.replace(match.group(1),',',' ') + , match.group(9) + ) + +def handle_simple_list(match): + if match.group(1) == 'template': + return match.group(0) + + single_arg = re.compile('^\s*(\w|\d)+\s*$').match(match.group(2)) + return if_else(single_arg,'%s<%s>','%s< %s >') %\ + ( + match.group(1) + , string.join(string.split(match.group(2)), '') + ) + +def handle_static(match): + if len(match.group(0)) < max_len: + return match.group(0) + + (first_sep,sep) = if_else(string.find(match.group(0),'+') == -1, (' ',' '),(' ','+')) + return '%s%s\n%s%s' %\ + ( + match.group(1) + , string.join(string.split(match.group(2)), ' ') + , block_format( + (nearest_ident_pos(match.group(1))+ident,max_len) + , match.group(4) + , first_sep + , sep + ) + , match.group(5) + ) + +def handle_typedefs(match): + if string.count(match.group(2), ';') == 1: + return match.group(0) + + join_sep = ';\n%s' % match.group(1) + + return '%s%s\n' \ + % ( + match.group(1) + , string.join(map(string.strip, string.split(match.group(2), ';')), join_sep) + ) + +def fix_angle_brackets( match ): + return ' '.join( ''.join( match.group(1).split( ' ' ) ) ) + match.group(3) + + +class pretty: + def __init__(self, name): + self.output = open(name, "w") + self.prev_line = '' + + self.re_copyright_start = re.compile( r'^// Copyright .*$' ) + self.re_copyright_end = re.compile( r'^// See .* for documentation.$' ) + self.reading_copyright = 0 + self.copyright = None + + self.re_header_name_comment = re.compile( + r'^\s*//\s+\$[I]d:\s+(.*?%s\.hpp)\s+[^$]+[$]$' + % os.path.splitext( name )[0] + ) + + self.header_was_written = 0 + + self.re_junk = re.compile(r'^\s*(#|//[^/]|////).*$') + self.re_c_comment_start = re.compile(r'^\s*/\*.*') + self.re_c_comment_end = re.compile(r'^.*\*/\s*$') + self.inside_c_comment = 0 + + self.re_empty_line = re.compile(r'^\s*$') + self.re_comma = re.compile(r'(\S+)\s*,\s*') + self.re_assign = re.compile(r'(\S+[^<|^!|^>])\s*(=+)\s*(\S+)') + self.re_marked_empty_comment = re.compile(r'^\s*//\s*$') + self.re_typedef = re.compile(r'^\s+typedef\s+.*?;$') + self.re_nsl = re.compile(r'^(\s+typedef\s+.*?;|\s*(private|public):\s*|\s*{\s*|\s*(\w|\d|,)+\s*)$') + self.re_templ_decl = re.compile(r'^(\s*template\s*<\s*.*?|\s*(private|public):\s*)$') + self.re_type_const = re.compile(r'(const)\s+((unsigned|signed)?(bool|char|short|int|long))') + #self.re_templ_args = re.compile(r'^(\s*)(, | {2})((.*::.*?,?)+)\s*$') + self.re_templ_args = re.compile(r'^(\s*)(, | {2})((\s*(\w+)(\s+|::)\w+\s*.*?,?)+)\s*$') + self.re_inline_templ_args = re.compile( + r'^(\s+(,|:\s+)?|struct\s+)(\w+)\s*<((\s*(typename\s+)?\w+\s*(=\s*.*|<(\s*\w+\s*,?)+>\s*)?,?)+)\s*>\s+((struct|class).*?)?$' + ) + + self.re_simple_list = re.compile(r'(\w+)\s*<((\w|,| |-)+)>') + self.re_static_const = re.compile(r'(\s*)((BOOST_STATIC_CONSTANT\(\s*\w+,\s*|enum\s*\w*\s*{\s*)value\s*=)(.*?)([}|\)];)$') + self.re_typedefs = re.compile(r'(\s*)((\s*typedef\s*.*?;)+)\s*$') + self.re_fix_angle_brackets = re.compile( r'(>(\s*>)+)(,|\n$)' ) + self.re_closing_curly_brace = re.compile(r'^(}|struct\s+\w+);\s*$') + self.re_namespace_scope_templ = re.compile(r'^template\s*<\s*$') + self.re_namespace = re.compile(r'^\n?namespace\s+\w+\s*{\s*\n?$') + + def process(self, line): + if self.reading_copyright: + if not self.re_copyright_end.match( line ): + self.copyright += line + return + + self.reading_copyright = 0 + + if not self.header_was_written and self.re_copyright_start.match( line ): + self.copyright = line + self.reading_copyright = 1 + return + + # searching for header line + if not self.header_was_written: + if self.re_header_name_comment.match( line ): + self.header_was_written = 1 + match = self.re_header_name_comment.match( line ) + self.output.write( \ + '\n%s\n' \ + '// *Preprocessed* version of the main "%s" header\n' \ + '// -- DO NOT modify by hand!\n\n' \ + % ( self.copyright, match.group(1) ) + ) + return + + # skipping preprocessor directives, comments, etc. + if self.re_junk.match(line): + return + + if self.inside_c_comment or self.re_c_comment_start.match(line): + self.inside_c_comment = not self.re_c_comment_end.match(line) + return + + # restoring some empty lines + if self.re_templ_decl.match(line) and self.re_typedef.match(self.prev_line) \ + or not self.re_empty_line.match(line) and self.re_closing_curly_brace.match(self.prev_line) \ + or not self.re_empty_line.match(self.prev_line) \ + and ( self.re_namespace_scope_templ.match(line) \ + or self.re_namespace.match(line) and not self.re_namespace.match(self.prev_line) \ + ): + line = '\n%s' % line + + # removing excessive empty lines + if self.re_empty_line.match(line): + if self.re_empty_line.match(self.prev_line) or not self.header_was_written: + return + + # skip empty line after typedef + if self.re_nsl.match(self.prev_line): + return + + # formatting + line = self.re_comma.sub( r'\1, ', line ) + line = self.re_assign.sub( r'\1 \2 \3', line ) + line = self.re_marked_empty_comment.sub( r'\n', line ) + line = self.re_type_const.sub( r'\2 \1', line ) + line = self.re_templ_args.sub( handle_args, line ) + line = self.re_inline_templ_args.sub( handle_inline_args, line ) + line = self.re_simple_list.sub( handle_simple_list, line) + line = self.re_static_const.sub( handle_static, line ) + line = self.re_typedefs.sub( handle_typedefs, line ) + line = self.re_fix_angle_brackets.sub( fix_angle_brackets, line ) + + # write the output + self.output.write(line) + self.prev_line = line + +def main( src, dest ): + p = pretty( os.path.basename( dest ) ) + for line in fileinput.input( src ): + p.process(line) + +if __name__ == '__main__': + main( sys.argv[1], sys.argv[2] ) diff --git a/src/boost/libs/mpl/preprocessed/preprocess.cmd b/src/boost/libs/mpl/preprocessed/preprocess.cmd new file mode 100644 index 00000000..7fb92f37 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess.cmd @@ -0,0 +1 @@ +gcc -E -C -P "-I%(boost_root)s" "-D BOOST_USER_CONFIG=\"%(boost_root)s/libs/mpl/preprocessed/include/%(mode)s/user.hpp\"" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES %(file)s >"%(file_path)s" diff --git a/src/boost/libs/mpl/preprocessed/preprocess.py b/src/boost/libs/mpl/preprocessed/preprocess.py new file mode 100644 index 00000000..0c38eb06 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess.py @@ -0,0 +1,88 @@ + +# Copyright Aleksey Gurtovoy 2001-2004 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import pp +import shutil +import os.path +import os +import string +import sys + +preprocess_cmd = open( "preprocess.cmd" ).readlines()[0] + +def process( file, boost_root, dst_dir, mode ): + file_path = "%s.hpp" % os.path.splitext( file )[0] + os.system( preprocess_cmd % { + 'boost_root': boost_root + , 'mode': mode + , 'file': file + , 'file_path': file_path + } ) + + os.rename( file_path, "%s.tmp" % file_path ) + pp.main( "%s.tmp" % file_path, file_path ) + os.remove( "%s.tmp" % file_path ) + + filename = os.path.basename(file_path) + dst_dir = os.path.join( dst_dir, mode ) + dst_file = os.path.join( dst_dir, filename ) + + if os.path.exists( dst_file ): + shutil.copymode( filename, dst_file ) + + shutil.copy( filename, dst_dir ) + os.remove( filename ) + + +def process_all( root, boost_root, dst_dir, mode ): + files = os.listdir( root ) + for file in files: + path = os.path.join( root, file ) + if os.path.splitext( file )[1] == ".cpp": + process( path, boost_root, dst_dir, mode ) + else: + if os.path.isdir( path ): + process_all( path, boost_root, dst_dir, mode ) + + +def main( all_modes, src_dir, dst_dir ): + if len( sys.argv ) < 2: + print "\nUsage:\n\t %s []" % os.path.basename( sys.argv[0] ) + print "\nPurpose:\n\t updates preprocessed version(s) of the header(s) in \"%s\" directory" % dst_dir + print "\nExample:\n\t the following command will re-generate and update all 'apply.hpp' headers:" + print "\n\t\t %s all f:\\cvs\\boost apply.cpp" % os.path.basename( sys.argv[0] ) + sys.exit( -1 ) + + if sys.argv[1] == "all": + modes = all_modes + else: + modes = [sys.argv[1]] + + boost_root = sys.argv[2] + dst_dir = os.path.join( boost_root, dst_dir ) + + for mode in modes: + if len( sys.argv ) > 3: + file = os.path.join( os.path.join( os.getcwd(), src_dir ), sys.argv[3] ) + process( file, boost_root, dst_dir, mode ) + else: + process_all( os.path.join( os.getcwd(), src_dir ), boost_root, dst_dir, mode ) + + +if __name__ == '__main__': + + main( + ["bcc", "bcc551", "gcc", "mwcw", "dmc", "no_ttp", "plain"] + , "src" + , os.path.join( "boost", "mpl", "aux_", "preprocessed" ) + ) diff --git a/src/boost/libs/mpl/preprocessed/preprocess_list.py b/src/boost/libs/mpl/preprocessed/preprocess_list.py new file mode 100644 index 00000000..ae172c26 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess_list.py @@ -0,0 +1,21 @@ + +# Copyright Aleksey Gurtovoy 2001-2006 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import preprocess +import os.path + +preprocess.main( + [ "plain" ] + , "list" + , os.path.join( "boost", "mpl", "list", "aux_", "preprocessed" ) + ) diff --git a/src/boost/libs/mpl/preprocessed/preprocess_map.py b/src/boost/libs/mpl/preprocessed/preprocess_map.py new file mode 100644 index 00000000..9f4fa9cc --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess_map.py @@ -0,0 +1,21 @@ + +# Copyright Aleksey Gurtovoy 2001-2006 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import preprocess +import os.path + +preprocess.main( + [ "plain", "typeof_based" ] + , "map" + , os.path.join( "boost", "mpl", "map", "aux_", "preprocessed" ) + ) diff --git a/src/boost/libs/mpl/preprocessed/preprocess_set.py b/src/boost/libs/mpl/preprocessed/preprocess_set.py new file mode 100644 index 00000000..9220a9b3 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess_set.py @@ -0,0 +1,21 @@ + +# Copyright Aleksey Gurtovoy 2001-2006 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import preprocess +import os.path + +preprocess.main( + [ "plain" ] + , "set" + , os.path.join( "boost", "mpl", "set", "aux_", "preprocessed" ) + ) diff --git a/src/boost/libs/mpl/preprocessed/preprocess_vector.py b/src/boost/libs/mpl/preprocessed/preprocess_vector.py new file mode 100644 index 00000000..26c65b6e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/preprocess_vector.py @@ -0,0 +1,21 @@ + +# Copyright Aleksey Gurtovoy 2001-2006 +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# See http://www.boost.org/libs/mpl for documentation. + +# $Id$ +# $Date$ +# $Revision$ + +import preprocess +import os.path + +preprocess.main( + [ "plain", "typeof_based" ] + , "vector" + , os.path.join( "boost", "mpl", "vector", "aux_", "preprocessed" ) + ) diff --git a/src/boost/libs/mpl/preprocessed/set/set10.cpp b/src/boost/libs/mpl/preprocessed/set/set10.cpp new file mode 100644 index 00000000..20431d54 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set10.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set10_c.cpp b/src/boost/libs/mpl/preprocessed/set/set10_c.cpp new file mode 100644 index 00000000..1e862e0f --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set10_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set20.cpp b/src/boost/libs/mpl/preprocessed/set/set20.cpp new file mode 100644 index 00000000..49d9ff02 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set20.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set20_c.cpp b/src/boost/libs/mpl/preprocessed/set/set20_c.cpp new file mode 100644 index 00000000..056405f2 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set20_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set30.cpp b/src/boost/libs/mpl/preprocessed/set/set30.cpp new file mode 100644 index 00000000..c8b26659 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set30.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set30_c.cpp b/src/boost/libs/mpl/preprocessed/set/set30_c.cpp new file mode 100644 index 00000000..3134c232 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set30_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set40.cpp b/src/boost/libs/mpl/preprocessed/set/set40.cpp new file mode 100644 index 00000000..62bb1ef4 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set40.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set40_c.cpp b/src/boost/libs/mpl/preprocessed/set/set40_c.cpp new file mode 100644 index 00000000..081d8563 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set40_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set50.cpp b/src/boost/libs/mpl/preprocessed/set/set50.cpp new file mode 100644 index 00000000..6866664b --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set50.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/set/set50_c.cpp b/src/boost/libs/mpl/preprocessed/set/set50_c.cpp new file mode 100644 index 00000000..0ce79819 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/set/set50_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/advance_backward.cpp b/src/boost/libs/mpl/preprocessed/src/advance_backward.cpp new file mode 100644 index 00000000..d75aee74 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/advance_backward.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/advance_forward.cpp b/src/boost/libs/mpl/preprocessed/src/advance_forward.cpp new file mode 100644 index 00000000..0a8324ae --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/advance_forward.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/and.cpp b/src/boost/libs/mpl/preprocessed/src/and.cpp new file mode 100644 index 00000000..d44a8fd9 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/and.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/apply.cpp b/src/boost/libs/mpl/preprocessed/src/apply.cpp new file mode 100644 index 00000000..10d4aa7a --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/apply.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/apply_fwd.cpp b/src/boost/libs/mpl/preprocessed/src/apply_fwd.cpp new file mode 100644 index 00000000..dca11749 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/apply_fwd.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/apply_wrap.cpp b/src/boost/libs/mpl/preprocessed/src/apply_wrap.cpp new file mode 100644 index 00000000..41b737d6 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/apply_wrap.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/arg.cpp b/src/boost/libs/mpl/preprocessed/src/arg.cpp new file mode 100644 index 00000000..d63b3ced --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/arg.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/basic_bind.cpp b/src/boost/libs/mpl/preprocessed/src/basic_bind.cpp new file mode 100644 index 00000000..ebf063f2 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/basic_bind.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/bind.cpp b/src/boost/libs/mpl/preprocessed/src/bind.cpp new file mode 100644 index 00000000..8fb1537f --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/bind.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/bind_fwd.cpp b/src/boost/libs/mpl/preprocessed/src/bind_fwd.cpp new file mode 100644 index 00000000..8ed1be13 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/bind_fwd.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/bitand.cpp b/src/boost/libs/mpl/preprocessed/src/bitand.cpp new file mode 100644 index 00000000..25f1a725 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/bitand.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/bitor.cpp b/src/boost/libs/mpl/preprocessed/src/bitor.cpp new file mode 100644 index 00000000..09ec8160 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/bitor.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/bitxor.cpp b/src/boost/libs/mpl/preprocessed/src/bitxor.cpp new file mode 100644 index 00000000..1656c9f6 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/bitxor.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/deque.cpp b/src/boost/libs/mpl/preprocessed/src/deque.cpp new file mode 100644 index 00000000..f0715193 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/deque.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/divides.cpp b/src/boost/libs/mpl/preprocessed/src/divides.cpp new file mode 100644 index 00000000..cb59f281 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/divides.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/equal_to.cpp b/src/boost/libs/mpl/preprocessed/src/equal_to.cpp new file mode 100644 index 00000000..5158e741 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/equal_to.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/fold_impl.cpp b/src/boost/libs/mpl/preprocessed/src/fold_impl.cpp new file mode 100644 index 00000000..81cdcdda --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/fold_impl.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/full_lambda.cpp b/src/boost/libs/mpl/preprocessed/src/full_lambda.cpp new file mode 100644 index 00000000..e323cc6a --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/full_lambda.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/greater.cpp b/src/boost/libs/mpl/preprocessed/src/greater.cpp new file mode 100644 index 00000000..e344dac6 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/greater.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/greater_equal.cpp b/src/boost/libs/mpl/preprocessed/src/greater_equal.cpp new file mode 100644 index 00000000..faf43704 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/greater_equal.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/inherit.cpp b/src/boost/libs/mpl/preprocessed/src/inherit.cpp new file mode 100644 index 00000000..b00c83f3 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/inherit.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/iter_fold_if_impl.cpp b/src/boost/libs/mpl/preprocessed/src/iter_fold_if_impl.cpp new file mode 100644 index 00000000..386f59f0 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/iter_fold_if_impl.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/iter_fold_impl.cpp b/src/boost/libs/mpl/preprocessed/src/iter_fold_impl.cpp new file mode 100644 index 00000000..13cc36cd --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/iter_fold_impl.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/lambda_no_ctps.cpp b/src/boost/libs/mpl/preprocessed/src/lambda_no_ctps.cpp new file mode 100644 index 00000000..9afc341a --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/lambda_no_ctps.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/less.cpp b/src/boost/libs/mpl/preprocessed/src/less.cpp new file mode 100644 index 00000000..b5eba3c1 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/less.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/less_equal.cpp b/src/boost/libs/mpl/preprocessed/src/less_equal.cpp new file mode 100644 index 00000000..a052119d --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/less_equal.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/list.cpp b/src/boost/libs/mpl/preprocessed/src/list.cpp new file mode 100644 index 00000000..15908394 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/list.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/list_c.cpp b/src/boost/libs/mpl/preprocessed/src/list_c.cpp new file mode 100644 index 00000000..1fd93f2d --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/list_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/map.cpp b/src/boost/libs/mpl/preprocessed/src/map.cpp new file mode 100644 index 00000000..58872678 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/map.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/minus.cpp b/src/boost/libs/mpl/preprocessed/src/minus.cpp new file mode 100644 index 00000000..cdd65ef9 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/minus.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/modulus.cpp b/src/boost/libs/mpl/preprocessed/src/modulus.cpp new file mode 100644 index 00000000..0eb0adf4 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/modulus.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/not_equal_to.cpp b/src/boost/libs/mpl/preprocessed/src/not_equal_to.cpp new file mode 100644 index 00000000..dffa86c7 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/not_equal_to.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/or.cpp b/src/boost/libs/mpl/preprocessed/src/or.cpp new file mode 100644 index 00000000..d58ed510 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/or.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/placeholders.cpp b/src/boost/libs/mpl/preprocessed/src/placeholders.cpp new file mode 100644 index 00000000..4acd7f76 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/placeholders.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/plus.cpp b/src/boost/libs/mpl/preprocessed/src/plus.cpp new file mode 100644 index 00000000..4b4b450e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/plus.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/quote.cpp b/src/boost/libs/mpl/preprocessed/src/quote.cpp new file mode 100644 index 00000000..9cec2efa --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/quote.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/reverse_fold_impl.cpp b/src/boost/libs/mpl/preprocessed/src/reverse_fold_impl.cpp new file mode 100644 index 00000000..cdd6b9f6 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/reverse_fold_impl.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/reverse_iter_fold_impl.cpp b/src/boost/libs/mpl/preprocessed/src/reverse_iter_fold_impl.cpp new file mode 100644 index 00000000..b3859d7e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/reverse_iter_fold_impl.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/set.cpp b/src/boost/libs/mpl/preprocessed/src/set.cpp new file mode 100644 index 00000000..0984cc9a --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/set.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/set_c.cpp b/src/boost/libs/mpl/preprocessed/src/set_c.cpp new file mode 100644 index 00000000..3c1f6dbb --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/set_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/shift_left.cpp b/src/boost/libs/mpl/preprocessed/src/shift_left.cpp new file mode 100644 index 00000000..c0c3d0f8 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/shift_left.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/shift_right.cpp b/src/boost/libs/mpl/preprocessed/src/shift_right.cpp new file mode 100644 index 00000000..16f3dbf2 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/shift_right.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/template_arity.cpp b/src/boost/libs/mpl/preprocessed/src/template_arity.cpp new file mode 100644 index 00000000..eee7ba8b --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/template_arity.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/times.cpp b/src/boost/libs/mpl/preprocessed/src/times.cpp new file mode 100644 index 00000000..122cfb0c --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/times.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/unpack_args.cpp b/src/boost/libs/mpl/preprocessed/src/unpack_args.cpp new file mode 100644 index 00000000..c3a62905 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/unpack_args.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/vector.cpp b/src/boost/libs/mpl/preprocessed/src/vector.cpp new file mode 100644 index 00000000..ab1104bf --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/vector.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/src/vector_c.cpp b/src/boost/libs/mpl/preprocessed/src/vector_c.cpp new file mode 100644 index 00000000..1b3891cb --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/src/vector_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector10.cpp b/src/boost/libs/mpl/preprocessed/vector/vector10.cpp new file mode 100644 index 00000000..6276669e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector10.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector10_c.cpp b/src/boost/libs/mpl/preprocessed/vector/vector10_c.cpp new file mode 100644 index 00000000..f2c7a05a --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector10_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector20.cpp b/src/boost/libs/mpl/preprocessed/vector/vector20.cpp new file mode 100644 index 00000000..d8254087 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector20.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector20_c.cpp b/src/boost/libs/mpl/preprocessed/vector/vector20_c.cpp new file mode 100644 index 00000000..9c1c5314 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector20_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector30.cpp b/src/boost/libs/mpl/preprocessed/vector/vector30.cpp new file mode 100644 index 00000000..ccddd343 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector30.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector30_c.cpp b/src/boost/libs/mpl/preprocessed/vector/vector30_c.cpp new file mode 100644 index 00000000..7c43f8a7 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector30_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector40.cpp b/src/boost/libs/mpl/preprocessed/vector/vector40.cpp new file mode 100644 index 00000000..2584309e --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector40.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector40_c.cpp b/src/boost/libs/mpl/preprocessed/vector/vector40_c.cpp new file mode 100644 index 00000000..15a8608c --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector40_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector50.cpp b/src/boost/libs/mpl/preprocessed/vector/vector50.cpp new file mode 100644 index 00000000..dd577c9f --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector50.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/preprocessed/vector/vector50_c.cpp b/src/boost/libs/mpl/preprocessed/vector/vector50_c.cpp new file mode 100644 index 00000000..2acdbcc4 --- /dev/null +++ b/src/boost/libs/mpl/preprocessed/vector/vector50_c.cpp @@ -0,0 +1,16 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_PREPROCESSING_MODE +#include +#include diff --git a/src/boost/libs/mpl/test/Jamfile.v2 b/src/boost/libs/mpl/test/Jamfile.v2 new file mode 100644 index 00000000..1c8f393d --- /dev/null +++ b/src/boost/libs/mpl/test/Jamfile.v2 @@ -0,0 +1,98 @@ + +compile aux_/increased_arity.cpp ; +compile aux_/largest_int.cpp ; +compile aux_/msvc_is_class.cpp ; +compile aux_/template_arity.cpp ; +compile aux_/preprocessor/is_seq.cpp ; +compile aux_/preprocessor/token_equal.cpp ; + +compile advance.cpp ; +compile always.cpp ; +compile apply.cpp ; +compile apply_wrap.cpp ; +compile arithmetic.cpp ; +compile as_sequence.cpp ; +compile assert.cpp ; +# link assert_vc8_p1.cpp assert_vc8_p2.cpp ; +compile at.cpp ; +compile back.cpp ; +compile bind.cpp ; +compile bitwise.cpp ; +run bool.cpp ; +compile comparison.cpp ; +compile contains.cpp ; +compile copy.cpp ; +compile copy_if.cpp ; +compile count.cpp ; +compile count_if.cpp ; +compile deque.cpp ; +compile distance.cpp ; +compile empty.cpp ; +compile equal.cpp ; +compile erase.cpp ; +compile erase_range.cpp ; +compile eval_if.cpp ; +compile filter_view.cpp ; +compile find.cpp ; +compile find_if.cpp ; +compile fold.cpp ; +run for_each.cpp ; +compile front.cpp ; +compile get_tag_def.cpp ; +compile has_xxx.cpp ; +compile identity.cpp ; +compile if.cpp ; +compile index_of.cpp ; +compile inherit.cpp ; +compile insert.cpp ; +compile insert_range.cpp ; +run int.cpp ; +run char.cpp ; +run integral_c.cpp : : : vacpp:-qchars=signed ; +compile is_placeholder.cpp ; +compile is_sequence.cpp ; +compile iterator_tags.cpp ; +compile joint_view.cpp ; +compile lambda.cpp ; +compile lambda_args.cpp ; +compile list.cpp ; +compile list_c.cpp ; +compile logical.cpp ; +compile lower_bound.cpp ; +compile map.cpp ; +compile max_element.cpp ; +compile min_max.cpp ; +compile multiset.cpp ; +compile next.cpp ; +compile no_has_xxx.cpp ; +compile numeric_ops.cpp ; +compile pair_view.cpp ; +compile partition.cpp ; +compile pop_front.cpp ; +compile push_back.cpp ; +compile push_front.cpp ; +compile quote.cpp ; +compile range_c.cpp ; +compile remove.cpp ; +compile remove_if.cpp ; +compile replace.cpp ; +compile replace_if.cpp ; +compile reverse.cpp ; +compile same_as.cpp ; +compile set.cpp ; +compile set_c.cpp ; +compile single_view.cpp ; +compile size.cpp ; +run size_t.cpp ; +compile sizeof.cpp ; +compile sort.cpp ; +compile stable_partition.cpp ; +compile transform.cpp ; +compile transform_view.cpp ; +compile unique.cpp ; +compile unpack_args.cpp ; +compile upper_bound.cpp ; +compile vector.cpp ; +compile vector_c.cpp ; +compile zip_view.cpp ; +run string.cpp ; diff --git a/src/boost/libs/mpl/test/advance.cpp b/src/boost/libs/mpl/test/advance.cpp new file mode 100644 index 00000000..e174ae4c --- /dev/null +++ b/src/boost/libs/mpl/test/advance.cpp @@ -0,0 +1,51 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +template< int pos > struct iter +{ + typedef mpl::bidirectional_iterator_tag category; + typedef iter<(pos + 1)> next; + typedef iter<(pos - 1)> prior; + typedef int_ type; +}; + +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) +namespace boost { namespace mpl { +template< int pos, typename Default > struct tag< iter,Default > : void_ {}; +}} +#endif + +typedef iter<0> first; +typedef iter<10> last; + +MPL_TEST_CASE() +{ + typedef mpl::advance >::type iter1; + typedef advance_c::type iter2; + + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); +} + +MPL_TEST_CASE() +{ + typedef mpl::advance >::type iter1; + typedef advance_c::type iter2; + + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); +} diff --git a/src/boost/libs/mpl/test/always.cpp b/src/boost/libs/mpl/test/always.cpp new file mode 100644 index 00000000..c879b973 --- /dev/null +++ b/src/boost/libs/mpl/test/always.cpp @@ -0,0 +1,48 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef always always_true; + + MPL_ASSERT(( apply< always_true > )); + MPL_ASSERT(( apply0< always_true > )); + MPL_ASSERT(( apply1< always_true,false_ > )); + MPL_ASSERT(( apply2< always_true,false_,false_ > )); + MPL_ASSERT(( apply3< always_true,false_,false_,false_ > )); +} + + +MPL_TEST_CASE() +{ + typedef always< int_<10> > always_10; + + typedef apply< always_10 >::type res; + typedef apply0< always_10 >::type res0; + typedef apply1< always_10,int_<0> >::type res1; + typedef apply2< always_10,int_<0>,int_<0> >::type res2; + typedef apply3< always_10,int_<0>,int_<0>,int_<0> >::type res3; + + MPL_ASSERT_RELATION( res::value, ==, 10 ); + MPL_ASSERT_RELATION( res0::value, ==, 10 ); + MPL_ASSERT_RELATION( res1::value, ==, 10 ); + MPL_ASSERT_RELATION( res2::value, ==, 10 ); + MPL_ASSERT_RELATION( res3::value, ==, 10 ); +} diff --git a/src/boost/libs/mpl/test/apply.cpp b/src/boost/libs/mpl/test/apply.cpp new file mode 100644 index 00000000..71bcbf9e --- /dev/null +++ b/src/boost/libs/mpl/test/apply.cpp @@ -0,0 +1,128 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + + +template< typename T > struct std_vector +{ +#if defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) + typedef std_vector type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, std_vector, (T)) +#endif +}; + + +MPL_TEST_CASE() +{ + typedef plus,int_<3> > plus1; + typedef lambda::type plus2; + MPL_ASSERT(( is_same< plus1,plus2 > )); + + typedef lambda >::type v; + MPL_ASSERT(( is_same< v,std_vector > )); + + typedef lambda >::type make_vector; + typedef apply_wrap1::type v_int; + MPL_ASSERT(( is_same< v_int,std_vector > )); +} + +MPL_TEST_CASE() +{ + typedef plus<_1,_2> plus_fun; + typedef apply2,int_<3> >::type res; + + MPL_ASSERT_RELATION( res::value, ==, 5 ); +} + +MPL_TEST_CASE() +{ + typedef apply1<_1, plus<_1,_2> >::type plus_fun; + MPL_ASSERT(( is_same< plus_fun,plus<_1,_2> > )); + + typedef apply2,int_<3> >::type res; + MPL_ASSERT_RELATION( res::value, ==, 5 ); +} + +MPL_TEST_CASE() +{ + typedef lambda< lambda<_1> >::type make_lambda; + typedef apply_wrap1< make_lambda,std_vector >::type v; + MPL_ASSERT(( is_same< v,std_vector > )); + + typedef apply_wrap1< make_lambda,std_vector<_1> >::type make_vector; + typedef apply_wrap1< make_vector,int >::type v_int; + MPL_ASSERT(( is_same< v_int,std_vector > )); +} + +MPL_TEST_CASE() +{ + typedef apply1< _1, std_vector >::type v; + MPL_ASSERT(( is_same< v,std_vector > )); + + typedef apply1< _1, std_vector<_1> >::type v_lambda; + typedef apply1::type v_int; + MPL_ASSERT(( is_same< v_int,std_vector > )); +} + +MPL_TEST_CASE() +{ + typedef apply1< lambda<_1>, std_vector >::type v; + MPL_ASSERT(( is_same< v,std_vector > )); + + typedef apply1< lambda<_1>, std_vector<_1> >::type make_vector; + typedef apply_wrap1< make_vector,int >::type v_int; + MPL_ASSERT(( is_same< v_int,std_vector > )); +} + +MPL_TEST_CASE() +{ + typedef apply1< lambda<_1>, plus<_1,_2> >::type plus_fun; + typedef apply_wrap2< plus_fun,int_<2>,int_<3> >::type res; + + MPL_ASSERT_RELATION( res::value, ==, 5 ); +} + +MPL_TEST_CASE() +{ + typedef bind2,_1,_1> b1; + typedef lambda::type b2; + MPL_ASSERT(( is_same< b1,b2 > )); +} + +MPL_TEST_CASE() +{ +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef lambda< lambda< bind2,_1,_1> > >::type make_lambda; + typedef apply_wrap1< make_lambda::type, int_<5> >::type res; + MPL_ASSERT_RELATION( res::value, ==, 10 ); +#endif +} + +MPL_TEST_CASE() +{ + typedef apply1< bind2,_1,_1>, int_<5> >::type res; + MPL_ASSERT_RELATION( res::value, ==, 10 ); +} + +MPL_TEST_CASE() +{ + typedef apply1<_1, lambda > >::type plus_fun; + typedef apply_wrap2< plus_fun::type, int_<2>,int_<3> >::type res; + + MPL_ASSERT_RELATION( res::value, ==, 5 ); +} diff --git a/src/boost/libs/mpl/test/apply_wrap.cpp b/src/boost/libs/mpl/test/apply_wrap.cpp new file mode 100644 index 00000000..9c45f2e1 --- /dev/null +++ b/src/boost/libs/mpl/test/apply_wrap.cpp @@ -0,0 +1,121 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) +# define APPLY_0_FUNC_DEF(i) \ + struct f0 \ + { \ + template< typename T = int > struct apply { typedef char type; }; \ + }; \ +/**/ +#else +# define APPLY_0_FUNC_DEF(i) \ + struct f0 \ + { \ + template< typename T > struct apply { typedef char type; }; \ + }; \ +/**/ +#endif + +#define APPLY_N_FUNC_DEF(i) \ + struct first##i \ + { \ + template< BOOST_MPL_PP_PARAMS(i, typename U) > \ + struct apply { typedef U1 type; }; \ + }; \ + \ + struct last##i \ + { \ + template< BOOST_MPL_PP_PARAMS(i, typename U) > \ + struct apply { typedef BOOST_PP_CAT(U,i) type; }; \ + }; \ +/**/ + +#define APPLY_FUNC_DEF(z, i, unused) \ + BOOST_PP_IF( \ + i \ + , APPLY_N_FUNC_DEF \ + , APPLY_0_FUNC_DEF \ + )(i) \ +/**/ + +namespace { namespace test { + +BOOST_PP_REPEAT( + BOOST_MPL_LIMIT_METAFUNCTION_ARITY + , APPLY_FUNC_DEF + , unused + ) + +struct g0 { struct apply { typedef char type; }; }; + +}} + +#define APPLY_0_TEST(i, apply_) \ + typedef apply_::type t; \ + { MPL_ASSERT(( boost::is_same )); } \ +/**/ + +#define APPLY_N_TEST(i, apply_) \ + typedef apply_< \ + test::first##i \ + , char \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(i)) \ + BOOST_MPL_PP_ENUM(BOOST_PP_DEC(i), int) \ + >::type t1##i; \ + \ + typedef apply_< \ + test::last##i \ + , BOOST_MPL_PP_ENUM(BOOST_PP_DEC(i), int) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(i)) char \ + >::type t2##i; \ + { MPL_ASSERT(( boost::is_same )); } \ + { MPL_ASSERT(( boost::is_same )); } \ +/**/ + +#define APPLY_TEST(z, i, unused) \ + BOOST_PP_IF( \ + i \ + , APPLY_N_TEST \ + , APPLY_0_TEST \ + )(i, BOOST_PP_CAT(apply_wrap,i)) \ +/**/ + + +MPL_TEST_CASE() +{ + BOOST_PP_REPEAT( + BOOST_MPL_LIMIT_METAFUNCTION_ARITY + , APPLY_TEST + , unused + ) + +#if !defined(BOOST_MPL_CFG_NO_HAS_APPLY) + { + typedef apply_wrap0::type t; + MPL_ASSERT(( boost::is_same )); + } +#endif +} diff --git a/src/boost/libs/mpl/test/arithmetic.cpp b/src/boost/libs/mpl/test/arithmetic.cpp new file mode 100644 index 00000000..81a615f1 --- /dev/null +++ b/src/boost/libs/mpl/test/arithmetic.cpp @@ -0,0 +1,50 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef int_<0> _0; + typedef int_<1> _1; + typedef int_<3> _3; + typedef int_<10> _10; + + MPL_ASSERT_RELATION( (plus<_0,_10>::value), ==, 10 ); + MPL_ASSERT_RELATION( (plus<_10,_0>::value), ==, 10 ); + + MPL_ASSERT_RELATION( (minus<_0,_10>::value), ==, -10 ); + MPL_ASSERT_RELATION( (minus<_10,_0>::value), ==, 10 ); + + MPL_ASSERT_RELATION( (times<_1,_10>::value), ==, 10 ); + MPL_ASSERT_RELATION( (times<_10,_1>::value), ==, 10 ); + MPL_ASSERT_RELATION( (multiplies<_1,_10>::value), ==, 10 ); + MPL_ASSERT_RELATION( (multiplies<_10,_1>::value), ==, 10 ); + + MPL_ASSERT_RELATION( (divides<_10,_1>::value), ==, 10 ); + MPL_ASSERT_RELATION( (divides<_10,_1>::value), ==, 10 ); + + MPL_ASSERT_RELATION( (modulus<_10,_1>::value), ==, 0 ); + MPL_ASSERT_RELATION( (modulus<_10,_3>::value), ==, 1 ); + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + MPL_ASSERT_RELATION( (minus<_10,_1,_10>::value), ==, -1 ); + MPL_ASSERT_RELATION( (plus<_10,_1,_10>::value), ==, 21 ); + MPL_ASSERT_RELATION( (divides<_10,_1,_10>::value), ==, 1 ); + MPL_ASSERT_RELATION( (divides<_10,_1,_10>::value), ==, 1 ); +#endif + + MPL_ASSERT_RELATION( negate<_10>::value, ==, -10 ); +} diff --git a/src/boost/libs/mpl/test/as_sequence.cpp b/src/boost/libs/mpl/test/as_sequence.cpp new file mode 100644 index 00000000..65edb5d1 --- /dev/null +++ b/src/boost/libs/mpl/test/as_sequence.cpp @@ -0,0 +1,23 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +MPL_TEST_CASE() +{ + MPL_ASSERT(( is_sequence< as_sequence::type > )); + MPL_ASSERT(( is_sequence< as_sequence::type > )); + MPL_ASSERT(( is_sequence< as_sequence< vector<> >::type > )); +} diff --git a/src/boost/libs/mpl/test/assert.cpp b/src/boost/libs/mpl/test/assert.cpp new file mode 100644 index 00000000..b20f699d --- /dev/null +++ b/src/boost/libs/mpl/test/assert.cpp @@ -0,0 +1,101 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + + +BOOST_MPL_ASSERT(( boost::is_same )); +BOOST_MPL_ASSERT(( boost::is_pointer )); +BOOST_MPL_ASSERT_NOT(( boost::is_same )); +BOOST_MPL_ASSERT_NOT(( boost::is_pointer )); +BOOST_MPL_ASSERT_RELATION( 5, >, 1 ); +BOOST_MPL_ASSERT_RELATION( 1, <, 5 ); +BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); +BOOST_MPL_ASSERT_MSG( true, ANOTHER_GLOBAL_SCOPE_ERROR, () ); + +namespace my { +BOOST_MPL_ASSERT(( boost::is_same )); +BOOST_MPL_ASSERT(( boost::is_pointer )); +BOOST_MPL_ASSERT_NOT(( boost::is_same )); +BOOST_MPL_ASSERT_NOT(( boost::is_pointer )); +BOOST_MPL_ASSERT_RELATION( 5, >, 1 ); +BOOST_MPL_ASSERT_RELATION( 1, <, 5 ); +BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); +BOOST_MPL_ASSERT_MSG( true, NAMESPACE_SCOPE_ERROR, () ); +BOOST_MPL_ASSERT_MSG( true, ANOTHER_NAMESPACE_SCOPE_ERROR, () ); +} + +template< typename T > +struct her +{ + BOOST_MPL_ASSERT(( boost::is_same )); + BOOST_MPL_ASSERT(( boost::is_pointer )); + BOOST_MPL_ASSERT_NOT(( boost::is_same )); + BOOST_MPL_ASSERT_NOT(( boost::is_pointer )); + BOOST_MPL_ASSERT_RELATION( sizeof(T*), >, 1 ); + BOOST_MPL_ASSERT_RELATION( 1, <, sizeof(T*) ); + BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); + BOOST_MPL_ASSERT_MSG( true, CLASS_SCOPE_ERROR, () ); +#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) + BOOST_MPL_ASSERT_MSG( true, ANOTHER_CLASS_SCOPE_ERROR, (types) ); +#endif + + void f() + { + BOOST_MPL_ASSERT(( boost::is_same )); + BOOST_MPL_ASSERT(( boost::is_pointer )); + BOOST_MPL_ASSERT_NOT(( boost::is_same )); + BOOST_MPL_ASSERT_NOT(( boost::is_pointer )); + BOOST_MPL_ASSERT_RELATION( sizeof(T*), >, 1 ); + BOOST_MPL_ASSERT_RELATION( 1, <, sizeof(T*) ); +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) + BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); +#endif + BOOST_MPL_ASSERT_MSG( true, MEMBER_FUNCTION_SCOPE_ERROR, () ); +#if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) + BOOST_MPL_ASSERT_MSG( true, ANOTHER_MEMBER_FUNCTION_SCOPE_ERROR, (types) ); +#endif + } +}; + +template +struct nested : boost::mpl::true_ { + BOOST_MPL_ASSERT(( boost::is_pointer )); + BOOST_MPL_ASSERT_NOT(( boost::is_same )); + BOOST_MPL_ASSERT_RELATION( sizeof(T*), >, 1 ); + BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); +}; + +BOOST_MPL_ASSERT(( nested )); +BOOST_MPL_ASSERT_NOT(( boost::mpl::not_ > )); + +int main() +{ + her h; + h.f(); + + BOOST_MPL_ASSERT(( boost::is_same )); + BOOST_MPL_ASSERT(( boost::is_pointer )); + BOOST_MPL_ASSERT_NOT(( boost::is_same )); + BOOST_MPL_ASSERT_NOT(( boost::is_pointer )); + BOOST_MPL_ASSERT_RELATION( 5, >, 1 ); + BOOST_MPL_ASSERT_RELATION( 1, <, 5 ); + BOOST_MPL_ASSERT_MSG( true, GLOBAL_SCOPE_ERROR, (int,long) ); + BOOST_MPL_ASSERT_MSG( true, FUNCTION_SCOPE_ERROR, () ); + BOOST_MPL_ASSERT_MSG( true, ANOTHER_FUNCTION_SCOPE_ERROR, () ); + + return 0; +} diff --git a/src/boost/libs/mpl/test/assert_vc8.hpp b/src/boost/libs/mpl/test/assert_vc8.hpp new file mode 100644 index 00000000..f54df0e1 --- /dev/null +++ b/src/boost/libs/mpl/test/assert_vc8.hpp @@ -0,0 +1,28 @@ + +// Copyright Robin Linden 2018 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +// Part of a test to demonstrate a linking error with +// BOOST_MPL_ASSERT_MSG inside of functions under VC++8. + +#include + +template +bool func() +{ + BOOST_MPL_ASSERT_MSG( + true, + ALWAYS_TRUE, + (T)); + + return true; +} diff --git a/src/boost/libs/mpl/test/assert_vc8_p1.cpp b/src/boost/libs/mpl/test/assert_vc8_p1.cpp new file mode 100644 index 00000000..2883135a --- /dev/null +++ b/src/boost/libs/mpl/test/assert_vc8_p1.cpp @@ -0,0 +1,23 @@ + +// Copyright Robin Linden 2018 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +// Part of a test to demonstrate a linking error with +// BOOST_MPL_ASSERT_MSG inside of functions under VC++8. + +#include "assert_vc8.hpp" + +static bool a = func(); + +int main() +{ +} diff --git a/src/boost/libs/mpl/test/assert_vc8_p2.cpp b/src/boost/libs/mpl/test/assert_vc8_p2.cpp new file mode 100644 index 00000000..6b535734 --- /dev/null +++ b/src/boost/libs/mpl/test/assert_vc8_p2.cpp @@ -0,0 +1,19 @@ + +// Copyright Robin Linden 2018 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +// Part of a test to demonstrate a linking error with +// BOOST_MPL_ASSERT_MSG inside of functions under VC++8. + +#include "assert_vc8.hpp" + +static bool a = func(); diff --git a/src/boost/libs/mpl/test/at.cpp b/src/boost/libs/mpl/test/at.cpp new file mode 100644 index 00000000..4b30edab --- /dev/null +++ b/src/boost/libs/mpl/test/at.cpp @@ -0,0 +1,39 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +template< typename Seq, int n > struct at_test +{ + typedef typename at_c::type t; + MPL_ASSERT(( is_same< t, integral_c > )); + MPL_ASSERT_RELATION( t::value, ==, 9 - n ); +}; + +MPL_TEST_CASE() +{ + typedef vector10_c numbers; + + at_test< numbers, 0 >(); + at_test< numbers, 1 >(); + at_test< numbers, 2 >(); + at_test< numbers, 3 >(); + at_test< numbers, 4 >(); + at_test< numbers, 5 >(); + at_test< numbers, 6 >(); + at_test< numbers, 7 >(); + at_test< numbers, 8 >(); + at_test< numbers, 9 >(); +} diff --git a/src/boost/libs/mpl/test/aux_/increased_arity.cpp b/src/boost/libs/mpl/test/aux_/increased_arity.cpp new file mode 100644 index 00000000..47a433d6 --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/increased_arity.cpp @@ -0,0 +1,50 @@ + +// Copyright Bruno Dutra 2015 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 15 +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#define TEST_N_ARY(unused1, N, unused2) \ + static_assert_< \ + apply< \ + and_, \ + BOOST_PP_ENUM_PARAMS(N, true_ BOOST_PP_INTERCEPT) \ + > \ + >(); \ +/**/ + +template +void static_assert_(){ + MPL_ASSERT((typename assertion::type)); +} + +MPL_TEST_CASE() +{ + BOOST_PP_REPEAT_FROM_TO( + 2, + BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY), + TEST_N_ARY, + _ + ) +} diff --git a/src/boost/libs/mpl/test/aux_/largest_int.cpp b/src/boost/libs/mpl/test/aux_/largest_int.cpp new file mode 100644 index 00000000..d9a6fd34 --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/largest_int.cpp @@ -0,0 +1,25 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + + +MPL_TEST_CASE() +{ + MPL_ASSERT(( is_same< mpl::aux::largest_int::type, bool > )); + MPL_ASSERT(( is_same< mpl::aux::largest_int::type, char > )); + MPL_ASSERT(( is_same< mpl::aux::largest_int::type, char > )); + MPL_ASSERT(( is_same< mpl::aux::largest_int::type, unsigned > )); + MPL_ASSERT(( is_same< mpl::aux::largest_int::type, long > )); +} diff --git a/src/boost/libs/mpl/test/aux_/msvc_is_class.cpp b/src/boost/libs/mpl/test/aux_/msvc_is_class.cpp new file mode 100644 index 00000000..6e5d49ea --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/msvc_is_class.cpp @@ -0,0 +1,46 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + +#include +#include + +template< typename T > struct A { T x[0]; }; + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( aux::msvc_is_class< int > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< char > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< enum_ > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< char* > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< UDT* > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< UDT& > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< incomplete* > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< incomplete& > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< int[5] > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< void (*)() > )); + MPL_ASSERT_NOT(( aux::msvc_is_class< int (*)(int, char) > )); + + MPL_ASSERT(( aux::msvc_is_class< UDT > )); + MPL_ASSERT(( aux::msvc_is_class< incomplete > )); + MPL_ASSERT(( aux::msvc_is_class< abstract > )); + MPL_ASSERT(( aux::msvc_is_class< noncopyable > )); + MPL_ASSERT(( aux::msvc_is_class< A > )); + MPL_ASSERT(( aux::msvc_is_class< A > )); +} + +#endif diff --git a/src/boost/libs/mpl/test/aux_/preprocessor/is_seq.cpp b/src/boost/libs/mpl/test/aux_/preprocessor/is_seq.cpp new file mode 100644 index 00000000..c860efc9 --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/preprocessor/is_seq.cpp @@ -0,0 +1,33 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +#define AUX_ASSERT_IS_SEQ( seq ) \ + BOOST_PP_ASSERT( BOOST_MPL_PP_IS_SEQ(seq) ) \ +/**/ + +#define AUX_ASSERT_IS_NOT_SEQ( seq ) \ + BOOST_PP_ASSERT( BOOST_PP_NOT( BOOST_MPL_PP_IS_SEQ(seq) ) ) \ +/**/ + +#define SEQ (a)(b)(c) + +AUX_ASSERT_IS_NOT_SEQ( a ) +AUX_ASSERT_IS_SEQ( (a) ) +AUX_ASSERT_IS_SEQ( (a)(b) ) +AUX_ASSERT_IS_SEQ( (a)(b)(c) ) +AUX_ASSERT_IS_SEQ( SEQ ) diff --git a/src/boost/libs/mpl/test/aux_/preprocessor/token_equal.cpp b/src/boost/libs/mpl/test/aux_/preprocessor/token_equal.cpp new file mode 100644 index 00000000..442199a0 --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/preprocessor/token_equal.cpp @@ -0,0 +1,36 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +#define AUX_ASSERT_EQUAL(x, y) \ + BOOST_PP_ASSERT( BOOST_MPL_PP_TOKEN_EQUAL(x, y) ) \ +/**/ + +#define AUX_ASSERT_NOT_EQUAL(x, y) \ + BOOST_PP_ASSERT( BOOST_PP_NOT( BOOST_MPL_PP_TOKEN_EQUAL(x, y) ) ) \ +/**/ + +#define BOOST_MPL_PP_TOKEN_EQUAL_apple(x) x +#define BOOST_MPL_PP_TOKEN_EQUAL_orange(x) x + +AUX_ASSERT_NOT_EQUAL( apple, abc ) +AUX_ASSERT_NOT_EQUAL( abc, apple ) +AUX_ASSERT_NOT_EQUAL( apple, orange ) +AUX_ASSERT_NOT_EQUAL( orange, apple ) + +AUX_ASSERT_EQUAL( apple, apple ) +AUX_ASSERT_EQUAL( orange, orange ) diff --git a/src/boost/libs/mpl/test/aux_/template_arity.cpp b/src/boost/libs/mpl/test/aux_/template_arity.cpp new file mode 100644 index 00000000..22370d7c --- /dev/null +++ b/src/boost/libs/mpl/test/aux_/template_arity.cpp @@ -0,0 +1,31 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#if defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) + +struct my {}; +template< typename T1 > struct my1 {}; +template< typename T1, typename T2 = void > struct my2 {}; + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (aux::template_arity::value), ==, -1 ); + MPL_ASSERT_RELATION( (aux::template_arity< my1 >::value), ==, 1 ); + MPL_ASSERT_RELATION( (aux::template_arity< my2 >::value), ==, 2 ); + MPL_ASSERT_RELATION( (aux::template_arity< my2 >::value), ==, 2 ); +} + +#endif diff --git a/src/boost/libs/mpl/test/back.cpp b/src/boost/libs/mpl/test/back.cpp new file mode 100644 index 00000000..84ae1e88 --- /dev/null +++ b/src/boost/libs/mpl/test/back.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +template< typename Seq, int value > struct back_test +{ + typedef typename back::type t; + MPL_ASSERT_RELATION( t::value, ==, value ); +}; + +MPL_TEST_CASE() +{ + back_test< range_c, 0 >(); + back_test< range_c, 9 >(); + back_test< range_c, -1 >(); +} diff --git a/src/boost/libs/mpl/test/bind.cpp b/src/boost/libs/mpl/test/bind.cpp new file mode 100644 index 00000000..2a2de62c --- /dev/null +++ b/src/boost/libs/mpl/test/bind.cpp @@ -0,0 +1,89 @@ + +// Copyright Peter Dimov 2001-2002 +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace { + +struct f1 +{ + template< typename T1 > struct apply + { + typedef T1 type; + }; +}; + +struct f5 +{ + template< typename T1, typename T2, typename T3, typename T4, typename T5 > + struct apply + { + typedef T5 type; + }; +}; + +} // namespace + +MPL_TEST_CASE() // basic argument binding +{ + typedef apply_wrap1< bind1, int >::type r11; + typedef apply_wrap5< bind1, void,void,void,void,int >::type r12; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); + + typedef apply_wrap5< bind5, void,void,void,void,int >::type r51; + typedef apply_wrap5< bind5, int,void,void,void,void >::type r52; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + + +MPL_TEST_CASE() // fully bound metafunction classes +{ + typedef apply_wrap0< bind1 >::type r11; + typedef apply_wrap0< bind5 >::type r51; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + + +MPL_TEST_CASE() // metafunction class composition +{ + typedef apply_wrap5< bind5 >, int,void,void,void,void >::type r51; + typedef apply_wrap5< bind5 >, void,void,void,void,int >::type r52; + MPL_ASSERT(( boost::is_same )); + MPL_ASSERT(( boost::is_same )); +} + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \ + && !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) +MPL_TEST_CASE() // if_ evaluation +{ + typedef bind3< quote3, _1, bind1< quote1, _2>, _3 > f; + typedef apply_wrap3< f,true_,int_<0>,int >::type r1; + typedef apply_wrap3< f,false_,int,int_<0> >::type r2; + + MPL_ASSERT(( boost::is_same > )); + MPL_ASSERT(( boost::is_same > )); +} +#endif diff --git a/src/boost/libs/mpl/test/bitwise.cpp b/src/boost/libs/mpl/test/bitwise.cpp new file mode 100644 index 00000000..8e6e32bf --- /dev/null +++ b/src/boost/libs/mpl/test/bitwise.cpp @@ -0,0 +1,71 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Jaap Suter 2003 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +typedef integral_c _0; +typedef integral_c _1; +typedef integral_c _2; +typedef integral_c _8; +typedef integral_c _ffffffff; + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (bitand_<_0,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitand_<_1,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitand_<_0,_1>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitand_<_0,_ffffffff>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitand_<_1,_ffffffff>::value), ==, 1 ); + MPL_ASSERT_RELATION( (bitand_<_8,_ffffffff>::value), ==, 8 ); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (bitor_<_0,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitor_<_1,_0>::value), ==, 1 ); + MPL_ASSERT_RELATION( (bitor_<_0,_1>::value), ==, 1 ); + MPL_ASSERT_RELATION( static_cast(bitor_<_0,_ffffffff>::value), ==, static_cast(0xffffffff) ); + MPL_ASSERT_RELATION( static_cast(bitor_<_1,_ffffffff>::value), ==, static_cast(0xffffffff) ); + MPL_ASSERT_RELATION( static_cast(bitor_<_8,_ffffffff>::value), ==, static_cast(0xffffffff) ); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (bitxor_<_0,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (bitxor_<_1,_0>::value), ==, 1 ); + MPL_ASSERT_RELATION( (bitxor_<_0,_1>::value), ==, 1 ); + MPL_ASSERT_RELATION( static_cast(bitxor_<_0,_ffffffff>::value), ==, static_cast(0xffffffff ^ 0) ); + MPL_ASSERT_RELATION( static_cast(bitxor_<_1,_ffffffff>::value), ==, static_cast(0xffffffff ^ 1) ); + MPL_ASSERT_RELATION( static_cast(bitxor_<_8,_ffffffff>::value), ==, static_cast(0xffffffff ^ 8) ); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (shift_right<_0,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (shift_right<_1,_0>::value), ==, 1 ); + MPL_ASSERT_RELATION( (shift_right<_1,_1>::value), ==, 0 ); + MPL_ASSERT_RELATION( (shift_right<_2,_1>::value), ==, 1 ); + MPL_ASSERT_RELATION( (shift_right<_8,_1>::value), ==, 4 ); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( (shift_left<_0,_0>::value), ==, 0 ); + MPL_ASSERT_RELATION( (shift_left<_1,_0>::value), ==, 1 ); + MPL_ASSERT_RELATION( (shift_left<_1,_1>::value), ==, 2 ); + MPL_ASSERT_RELATION( (shift_left<_2,_1>::value), ==, 4 ); + MPL_ASSERT_RELATION( (shift_left<_8,_1>::value), ==, 16 ); +} diff --git a/src/boost/libs/mpl/test/bool.cpp b/src/boost/libs/mpl/test/bool.cpp new file mode 100644 index 00000000..e023c0ca --- /dev/null +++ b/src/boost/libs/mpl/test/bool.cpp @@ -0,0 +1,38 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#include + +#if defined(BOOST_NO_CXX11_CONSTEXPR) +#define CONSTEXPR_BOOL_TEST(c) +#else +#define CONSTEXPR_BOOL_TEST(c) { static_assert(bool_() == c, "Constexpr for bool_ failed"); } +#endif + +#define BOOL_TEST(c) \ + { MPL_ASSERT(( is_same< bool_::value_type, bool > )); } \ + { MPL_ASSERT(( is_same< bool_, c##_ > )); } \ + { MPL_ASSERT(( is_same< bool_::type, bool_ > )); } \ + { MPL_ASSERT_RELATION( bool_::value, ==, c ); } \ + CONSTEXPR_BOOL_TEST(c) \ + BOOST_TEST( bool_() == c ); \ +/**/ + +MPL_TEST_CASE() +{ + BOOL_TEST(true) + BOOL_TEST(false) +} diff --git a/src/boost/libs/mpl/test/char.cpp b/src/boost/libs/mpl/test/char.cpp new file mode 100644 index 00000000..39f61e73 --- /dev/null +++ b/src/boost/libs/mpl/test/char.cpp @@ -0,0 +1,24 @@ + +// Copyright Eric Niebler 2008 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: char.cpp 49240 2009-04-01 09:21:07Z eric_niebler $ +// $Date: 2009-04-01 02:21:07 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49240 $ + +#include +#include + +#include "integral_wrapper_test.hpp" + + +MPL_TEST_CASE() +{ +# define WRAPPER(T, i) char_ + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, char) +} diff --git a/src/boost/libs/mpl/test/comparison.cpp b/src/boost/libs/mpl/test/comparison.cpp new file mode 100644 index 00000000..a59a1046 --- /dev/null +++ b/src/boost/libs/mpl/test/comparison.cpp @@ -0,0 +1,64 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +// make sure MSVC behaves nicely in presence of the following template +template< typename T > struct value {}; + +typedef int_<0> _0; +typedef int_<10> _10; + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( equal_to<_0, _10> )); + MPL_ASSERT_NOT(( equal_to<_10, _0> )); + MPL_ASSERT(( equal_to<_10, _10> )); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT(( not_equal_to<_0, _10> )); + MPL_ASSERT(( not_equal_to<_10, _0> )); + MPL_ASSERT_NOT(( not_equal_to<_10, _10> )); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT(( less<_0, _10> )); + MPL_ASSERT_NOT(( less<_10, _0> )); + MPL_ASSERT_NOT(( less<_10, _10> )); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT(( less_equal<_0, _10> )); + MPL_ASSERT_NOT(( less_equal<_10, _0> )); + MPL_ASSERT(( less_equal<_10, _10> )); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT(( greater<_10, _0> )); + MPL_ASSERT_NOT(( greater<_0, _10> )); + MPL_ASSERT_NOT(( greater<_10, _10> )); +} + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( greater_equal<_0, _10> )); + MPL_ASSERT(( greater_equal<_10, _0> )); + MPL_ASSERT(( greater_equal<_10, _10> )); +} diff --git a/src/boost/libs/mpl/test/contains.cpp b/src/boost/libs/mpl/test/contains.cpp new file mode 100644 index 00000000..1452a387 --- /dev/null +++ b/src/boost/libs/mpl/test/contains.cpp @@ -0,0 +1,24 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef vector::type types; + + MPL_ASSERT(( contains< types,short > )); + MPL_ASSERT_NOT(( contains< types,unsigned > )); +} diff --git a/src/boost/libs/mpl/test/copy.cpp b/src/boost/libs/mpl/test/copy.cpp new file mode 100644 index 00000000..a776f55c --- /dev/null +++ b/src/boost/libs/mpl/test/copy.cpp @@ -0,0 +1,211 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef vector10_c answer; + typedef copy< + range_c + , mpl::front_inserter< vector0<> > + >::type result; + + MPL_ASSERT_RELATION( size::value, ==, 10 ); + MPL_ASSERT(( equal< result,answer > )); +} + +MPL_TEST_CASE() +{ + typedef vector10_c numbers; + typedef reverse_copy< + range_c + , mpl::front_inserter + >::type result; + + MPL_ASSERT_RELATION( size::value, ==, 20 ); + MPL_ASSERT(( equal< result,range_c > )); +} + +struct push_back_only_tag {}; + +template< typename Seq > +struct push_back_only +{ + typedef push_back_only_tag tag; + typedef Seq seq; +}; + +namespace boost { namespace mpl { + +template<> +struct begin_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : begin< typename Seq::seq > + { + }; +}; + +template<> +struct end_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : end< typename Seq::seq > + { + }; +}; + +template<> +struct size_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : size< typename Seq::seq > + { + }; +}; + +template<> +struct empty_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : empty< typename Seq::seq > + { + }; +}; + +template<> +struct front_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : front< typename Seq::seq > + { + }; +}; + +template<> +struct insert_impl< ::push_back_only_tag > +{ + template< typename Seq, typename Pos, typename X > struct apply + { + typedef ::push_back_only< + typename insert< typename Seq::seq, Pos, X >::type + > type; + }; +}; + +template<> +struct insert_range_impl< ::push_back_only_tag > +{ + template< typename Seq, typename Pos, typename X > struct apply + { + typedef ::push_back_only< + typename insert_range< typename Seq::seq, Pos, X >::type + > type; + }; +}; + +template<> +struct erase_impl< ::push_back_only_tag > +{ + template< typename Seq, typename Iter1, typename Iter2 > struct apply + { + typedef ::push_back_only< + typename erase< typename Seq::seq, Iter1, Iter2 >::type + > type; + }; +}; + +template<> +struct clear_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + { + typedef ::push_back_only< + typename clear< typename Seq::seq >::type + > type; + }; +}; + +template<> +struct push_back_impl< ::push_back_only_tag > +{ + template< typename Seq, typename X > struct apply + { + typedef ::push_back_only< + typename push_back< typename Seq::seq, X >::type + > type; + }; +}; + +template<> +struct pop_back_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + { + typedef ::push_back_only< + typename pop_back< typename Seq::seq >::type + > type; + }; +}; + +template<> +struct back_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : back< typename Seq::seq > + { + }; +}; + +template<> +struct has_push_back_impl< ::push_back_only_tag > +{ + template< typename Seq > struct apply + : less< size,int_<10> > + { + }; +}; + +}} + +MPL_TEST_CASE() +{ + typedef vector10_c numbers; + typedef copy< push_back_only< numbers > >::type result; + + MPL_ASSERT((equal< numbers, result >)); +} diff --git a/src/boost/libs/mpl/test/copy_if.cpp b/src/boost/libs/mpl/test/copy_if.cpp new file mode 100644 index 00000000..698b4d7a --- /dev/null +++ b/src/boost/libs/mpl/test/copy_if.cpp @@ -0,0 +1,54 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list10_c::type numbers; + typedef list5_c::type answer; + typedef copy_if< + numbers + , less<_,int_<5> > + , mpl::front_inserter< list0_c > + >::type result; + + MPL_ASSERT_RELATION(size::value, ==, 5); + MPL_ASSERT(( equal )); +} + + +MPL_TEST_CASE() +{ + typedef list8::type types; + typedef list4::type float_types; + typedef reverse_copy_if< + types + , is_float<_> + , mpl::front_inserter< list0<> > + >::type result; + + MPL_ASSERT_RELATION(mpl::size::value, ==, 4); + MPL_ASSERT(( equal )); +} diff --git a/src/boost/libs/mpl/test/count.cpp b/src/boost/libs/mpl/test/count.cpp new file mode 100644 index 00000000..7d96fee3 --- /dev/null +++ b/src/boost/libs/mpl/test/count.cpp @@ -0,0 +1,41 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef vector types; + + MPL_ASSERT_RELATION( (count::value), ==, 1 ); + MPL_ASSERT_RELATION( (count::value), ==, 1 ); + MPL_ASSERT_RELATION( (count::value), ==, 2 ); + MPL_ASSERT_RELATION( (count::value), ==, 3 ); + MPL_ASSERT_RELATION( (count::value), ==, 0 ); +} + +MPL_TEST_CASE() +{ + typedef vector_c values; + + MPL_ASSERT_RELATION( (count< values, integral_c >::value), ==, 2 ); + MPL_ASSERT_RELATION( (count< values, integral_c >::value), ==, 2 ); + MPL_ASSERT_RELATION( (count< values, integral_c >::value), ==, 3 ); + MPL_ASSERT_RELATION( (count< values, integral_c >::value), ==, 1 ); + MPL_ASSERT_RELATION( (count< values, integral_c >::value), ==, 0 ); +} diff --git a/src/boost/libs/mpl/test/count_if.cpp b/src/boost/libs/mpl/test/count_if.cpp new file mode 100644 index 00000000..598ffeeb --- /dev/null +++ b/src/boost/libs/mpl/test/count_if.cpp @@ -0,0 +1,36 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef vector types; + typedef vector_c values; + + MPL_ASSERT_RELATION( (count_if< types, boost::is_float<_> >::value), ==, 1 ); + MPL_ASSERT_RELATION( (count_if< types, boost::is_same<_,char&> >::value), ==, 2 ); + MPL_ASSERT_RELATION( (count_if< types, boost::is_same<_,void*> >::value), ==, 0 ); + + MPL_ASSERT_RELATION( (count_if< values, less<_,int_<5> > >::value), ==, 4 ); + MPL_ASSERT_RELATION( (count_if< values, equal_to,_> >::value), ==, 2 ); + MPL_ASSERT_RELATION( (count_if< values, equal_to,_> >::value), ==, 0 ); +} diff --git a/src/boost/libs/mpl/test/deque.cpp b/src/boost/libs/mpl/test/deque.cpp new file mode 100644 index 00000000..4ac747cd --- /dev/null +++ b/src/boost/libs/mpl/test/deque.cpp @@ -0,0 +1,92 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef deque<> d0; + typedef deque d1; + typedef deque d2; + typedef deque d9; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 9 ); + + MPL_ASSERT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,char > )); + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,long > )); + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,int > )); +} + + +MPL_TEST_CASE() +{ + typedef deque d2; + + typedef begin::type i1; + typedef next::type i2; + typedef next::type i3; + + MPL_ASSERT(( is_same::type,char> )); + MPL_ASSERT(( is_same::type,long> )); + MPL_ASSERT(( is_same< i3, end::type > )); +} + +MPL_TEST_CASE() +{ + typedef deque<> d0; + + typedef push_back::type d1; + MPL_ASSERT(( is_same< back::type,int > )); + + typedef push_front::type d2; + MPL_ASSERT(( is_same< back::type,int > )); + MPL_ASSERT(( is_same< front::type,char > )); + + typedef push_back::type d3; + MPL_ASSERT(( is_same< back::type,long > )); +} + +MPL_TEST_CASE() +{ + typedef deque<> d0; + typedef deque d1; + typedef deque d2; + typedef deque d9; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 9 ); +} diff --git a/src/boost/libs/mpl/test/distance.cpp b/src/boost/libs/mpl/test/distance.cpp new file mode 100644 index 00000000..879dd53e --- /dev/null +++ b/src/boost/libs/mpl/test/distance.cpp @@ -0,0 +1,37 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef list::type list; + typedef begin::type first; + typedef end::type last; + + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 4 ); +} + +MPL_TEST_CASE() +{ + typedef range_c::type range; + typedef begin::type first; + typedef end::type last; + + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 10 ); +} diff --git a/src/boost/libs/mpl/test/empty.cpp b/src/boost/libs/mpl/test/empty.cpp new file mode 100644 index 00000000..7e73b361 --- /dev/null +++ b/src/boost/libs/mpl/test/empty.cpp @@ -0,0 +1,23 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + MPL_ASSERT(( empty< list0<> > )); + MPL_ASSERT_NOT(( empty< list1 > )); +} diff --git a/src/boost/libs/mpl/test/empty_sequence.cpp b/src/boost/libs/mpl/test/empty_sequence.cpp new file mode 100644 index 00000000..2fa989fa --- /dev/null +++ b/src/boost/libs/mpl/test/empty_sequence.cpp @@ -0,0 +1,39 @@ + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Alexander Nasonov 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef begin::type begin; + typedef end::type end; + + MPL_ASSERT(( is_same )); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 0 ); + + typedef advance_c::type advanced; + MPL_ASSERT(( is_same )); + + MPL_ASSERT(( equal< empty_sequence, empty_sequence::type > )); +} diff --git a/src/boost/libs/mpl/test/equal.cpp b/src/boost/libs/mpl/test/equal.cpp new file mode 100644 index 00000000..19390efe --- /dev/null +++ b/src/boost/libs/mpl/test/equal.cpp @@ -0,0 +1,31 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef list list1; + typedef list list2; + typedef list list3; + typedef list list4; + + MPL_ASSERT(( equal )); + MPL_ASSERT(( equal )); + MPL_ASSERT_NOT(( equal )); + MPL_ASSERT_NOT(( equal )); + MPL_ASSERT_NOT(( equal )); +} diff --git a/src/boost/libs/mpl/test/erase.cpp b/src/boost/libs/mpl/test/erase.cpp new file mode 100644 index 00000000..ca5b411b --- /dev/null +++ b/src/boost/libs/mpl/test/erase.cpp @@ -0,0 +1,45 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list types; + typedef find::type iter; + + typedef erase::type result; + MPL_ASSERT_RELATION( size::value, ==, 7 ); + + typedef find::type result_iter; + MPL_ASSERT(( is_same< result_iter, end::type > )); +} + +MPL_TEST_CASE() +{ + typedef list_c values; + typedef find< values, integral_c >::type iter; + + typedef erase::type result; + MPL_ASSERT_RELATION( size::value, ==, 7 ); + + typedef find >::type result_iter; + MPL_ASSERT(( is_same< result_iter, end::type > )); +} diff --git a/src/boost/libs/mpl/test/erase_range.cpp b/src/boost/libs/mpl/test/erase_range.cpp new file mode 100644 index 00000000..5e14c819 --- /dev/null +++ b/src/boost/libs/mpl/test/erase_range.cpp @@ -0,0 +1,34 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list types; + + typedef find::type iter1; + typedef find::type iter2; + + typedef erase::type result; + + MPL_ASSERT_RELATION( size::value, ==, 5 ); + + typedef find::type iter; + MPL_ASSERT(( is_same< iter, end::type > )); +} diff --git a/src/boost/libs/mpl/test/eval_if.cpp b/src/boost/libs/mpl/test/eval_if.cpp new file mode 100644 index 00000000..e2b4332c --- /dev/null +++ b/src/boost/libs/mpl/test/eval_if.cpp @@ -0,0 +1,33 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +#include + +MPL_TEST_CASE() +{ + typedef eval_if< true_, identity, identity >::type t1; + typedef eval_if_c< true, identity, identity >::type t2; + typedef eval_if< false_, identity, identity >::type t3; + typedef eval_if_c< false, identity, identity >::type t4; + + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); +} diff --git a/src/boost/libs/mpl/test/filter_view.cpp b/src/boost/libs/mpl/test/filter_view.cpp new file mode 100644 index 00000000..2ae57540 --- /dev/null +++ b/src/boost/libs/mpl/test/filter_view.cpp @@ -0,0 +1,42 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef mpl::list types; + typedef mpl::list floats; + + MPL_ASSERT(( equal< mpl::filter_view< types,boost::is_float<_> >::type,floats > )); + + typedef mpl::max_element< + mpl::transform_view< + mpl::filter_view< types,boost::is_float<_> > + , mpl::sizeof_<_> + > + >::type iter; + + MPL_ASSERT((is_same::type, long double>)); +} diff --git a/src/boost/libs/mpl/test/find.cpp b/src/boost/libs/mpl/test/find.cpp new file mode 100644 index 00000000..a45d5216 --- /dev/null +++ b/src/boost/libs/mpl/test/find.cpp @@ -0,0 +1,37 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list::type types; + typedef list_c values; + + typedef find::type types_iter; + typedef find< values, integral_c >::type values_iter; + + MPL_ASSERT(( is_same< deref::type, short> )); + MPL_ASSERT_RELATION( deref::type::value, ==, 7 ); + + typedef begin::type types_first; + typedef begin::type values_first; + MPL_ASSERT_RELATION( (mpl::distance< types_first,types_iter >::value), ==, 3 ); + MPL_ASSERT_RELATION( (mpl::distance< values_first,values_iter >::value), ==, 4 ); +} diff --git a/src/boost/libs/mpl/test/find_if.cpp b/src/boost/libs/mpl/test/find_if.cpp new file mode 100644 index 00000000..0d0ce89e --- /dev/null +++ b/src/boost/libs/mpl/test/find_if.cpp @@ -0,0 +1,46 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include + +#include +#include + +typedef vector::type types; +typedef begin::type first_; + +MPL_TEST_CASE() +{ + typedef find_if< types, boost::is_float<_> >::type iter; + MPL_ASSERT(( is_same< iter::type, double > )); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 6 ); +} + +MPL_TEST_CASE() +{ + typedef find_if< types, boost::is_same<_,long> >::type iter; + MPL_ASSERT(( is_same< iter::type, long > )); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 2 ); +} + +MPL_TEST_CASE() +{ + typedef find_if< types, boost::is_same<_,void> >::type iter; + MPL_ASSERT(( is_same< iter, end::type > )); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, size::value ); +} diff --git a/src/boost/libs/mpl/test/fold.cpp b/src/boost/libs/mpl/test/fold.cpp new file mode 100644 index 00000000..48f47587 --- /dev/null +++ b/src/boost/libs/mpl/test/fold.cpp @@ -0,0 +1,55 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list types; + typedef fold< + types + , int_<0> + , if_< boost::is_float<_2>,next<_1>,_1 > + >::type number_of_floats; + + MPL_ASSERT_RELATION( number_of_floats::value, ==, 4 ); +} + +MPL_TEST_CASE() +{ + typedef list_c numbers; + typedef list_c negatives; + typedef reverse_fold< + numbers + , list_c + , if_< less< _2,int_<0> >, push_front<_1,_2>, _1 > + >::type result; + + MPL_ASSERT(( equal< result,negatives,equal_to<_1,_2> > )); +} diff --git a/src/boost/libs/mpl/test/for_each.cpp b/src/boost/libs/mpl/test/for_each.cpp new file mode 100644 index 00000000..ec7a3d50 --- /dev/null +++ b/src/boost/libs/mpl/test/for_each.cpp @@ -0,0 +1,81 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace mpl = boost::mpl; + +struct type_printer +{ + type_printer(std::ostream& s) : f_stream(&s) {} + template< typename U > void operator()(mpl::identity) + { + *f_stream << typeid(U).name() << '\n'; + } + + private: + std::ostream* f_stream; +}; + +struct value_printer +{ + value_printer(std::ostream& s) : f_stream(&s) {} + template< typename U > void operator()(U x) + { + *f_stream << x << '\n'; + } + + private: + std::ostream* f_stream; +}; + +#ifdef __ICL +# pragma warning(disable:985) +#endif + +void push_back(std::vector* c, int i) +{ + c->push_back(i); +} + +int main() +{ + typedef mpl::list types; + mpl::for_each< types,mpl::make_identity >(type_printer(std::cout)); + + typedef mpl::range_c numbers; + std::vector v; + + mpl::for_each( + boost::bind(&push_back, &v, _1) + ); + + mpl::for_each< numbers >(value_printer(std::cout)); + + for (unsigned i = 0; i < v.size(); ++i) + assert(v[i] == (int)i); + + return 0; +} diff --git a/src/boost/libs/mpl/test/front.cpp b/src/boost/libs/mpl/test/front.cpp new file mode 100644 index 00000000..b28dffed --- /dev/null +++ b/src/boost/libs/mpl/test/front.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +template< typename Seq, int value > struct front_test +{ + typedef typename front::type t; + MPL_ASSERT_RELATION( t::value, ==, value ); +}; + +MPL_TEST_CASE() +{ + front_test< range_c, 1 >(); + front_test< range_c, 2 >(); + front_test< range_c, -1 >(); +} diff --git a/src/boost/libs/mpl/test/get_tag_def.cpp b/src/boost/libs/mpl/test/get_tag_def.cpp new file mode 100644 index 00000000..eb160dd8 --- /dev/null +++ b/src/boost/libs/mpl/test/get_tag_def.cpp @@ -0,0 +1,32 @@ + +// Copyright Sergey Krivonos 2017 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + + +#include +#include +#include +#include + + +struct test_type_get_tag_def +{ + typedef int a_tag; +}; + +BOOST_MPL_GET_TAG_DEF(a_tag); + +MPL_TEST_CASE() +{ + MPL_ASSERT(( is_same::type> )); + MPL_ASSERT(( is_same::type> )); +} diff --git a/src/boost/libs/mpl/test/has_xxx.cpp b/src/boost/libs/mpl/test/has_xxx.cpp new file mode 100644 index 00000000..c466db27 --- /dev/null +++ b/src/boost/libs/mpl/test/has_xxx.cpp @@ -0,0 +1,158 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Daniel Walker 2007 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +BOOST_MPL_HAS_XXX_TRAIT_DEF(xxx) +BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(has_xxx_template, xxx, false) +BOOST_MPL_HAS_XXX_TEMPLATE_DEF(yyy) + +struct a1 {}; +struct a2 { void xxx(); }; +struct a3 { int xxx; }; +struct a4 { static int xxx(); }; +struct a5 { template< typename T > struct xxx {}; }; + +struct b1 { typedef int xxx; }; +struct b2 { struct xxx; }; +struct b3 { typedef int& xxx; }; +struct b4 { typedef int* xxx; }; +struct b5 { typedef int xxx[10]; }; +struct b6 { typedef void (*xxx)(); }; +struct b7 { typedef void (xxx)(); }; + +struct c1 { template< typename T > struct xxx {}; }; +struct c2 { template< typename T1, typename T2 > struct xxx {}; }; +struct c3 { template< typename T1, typename T2, typename T3 > struct xxx {}; }; +struct c4 { template< typename T1, typename T2, typename T3, typename T4 > struct xxx {}; }; +struct c5 { template< typename T1, typename T2, typename T3, typename T4, typename T5 > struct xxx {}; }; +struct c6 { template< typename T > struct yyy {}; }; +struct c7 { template< typename T1, typename T2 > struct yyy {}; }; + +template< typename T > struct outer; +template< typename T > struct inner { typedef typename T::type type; }; + +// agurt, 15/aug/04: make sure MWCW passes the test in presence of the following +// template +template< typename T > struct xxx; + + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT(( has_xxx_template )); +#endif + MPL_ASSERT_NOT(( has_xxx< enum_ > )); + MPL_ASSERT_NOT(( has_xxx_template< enum_ > )); +#endif + + MPL_ASSERT_NOT(( has_xxx )); + MPL_ASSERT_NOT(( has_xxx_template )); + + MPL_ASSERT_NOT(( has_xxx< outer< inner > > )); + MPL_ASSERT_NOT(( has_xxx_template< outer< inner > > )); + + MPL_ASSERT_NOT(( has_xxx< incomplete > )); + MPL_ASSERT_NOT(( has_xxx_template< incomplete > )); + + MPL_ASSERT_NOT(( has_xxx< abstract > )); + MPL_ASSERT_NOT(( has_xxx_template< abstract > )); + + MPL_ASSERT_NOT(( has_xxx< noncopyable > )); + MPL_ASSERT_NOT(( has_xxx_template< noncopyable > )); + +#if !BOOST_WORKAROUND(__COMO_VERSION__, BOOST_TESTED_AT(4308)) + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); +#endif + + // Same name, different args. + MPL_ASSERT(( has_xxx_template )); + MPL_ASSERT(( has_xxx_template )); + MPL_ASSERT(( has_xxx_template )); + MPL_ASSERT(( has_xxx_template )); + MPL_ASSERT(( has_xxx_template )); + MPL_ASSERT(( has_yyy )); + MPL_ASSERT(( has_yyy )); + + // Different name, different args. + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_xxx_template )); + MPL_ASSERT_NOT(( has_yyy )); + MPL_ASSERT_NOT(( has_yyy )); + MPL_ASSERT_NOT(( has_yyy )); + MPL_ASSERT_NOT(( has_yyy )); + MPL_ASSERT_NOT(( has_yyy )); + + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + MPL_ASSERT(( has_xxx )); + + MPL_ASSERT(( has_xxx_template )); + +#if !defined(HAS_XXX_ASSERT) +# define HAS_XXX_ASSERT(x) MPL_ASSERT(x) +#endif + + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + HAS_XXX_ASSERT(( has_xxx )); + +#if !defined(HAS_XXX_TEMPLATE_ASSERT) +# define HAS_XXX_TEMPLATE_ASSERT(x) MPL_ASSERT(x) +#endif + + HAS_XXX_TEMPLATE_ASSERT(( has_xxx_template )); +} diff --git a/src/boost/libs/mpl/test/identity.cpp b/src/boost/libs/mpl/test/identity.cpp new file mode 100644 index 00000000..db147358 --- /dev/null +++ b/src/boost/libs/mpl/test/identity.cpp @@ -0,0 +1,32 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef apply1< identity<>, char >::type t1; + typedef apply1< identity<_1>, int >::type t2; + MPL_ASSERT(( is_same< t1, char > )); + MPL_ASSERT(( is_same< t2, int > )); +} + +MPL_TEST_CASE() +{ + typedef apply1< make_identity<>, char >::type t1; + typedef apply1< make_identity<_1>, int >::type t2; + MPL_ASSERT(( is_same< t1, identity > )); + MPL_ASSERT(( is_same< t2, identity > )); +} diff --git a/src/boost/libs/mpl/test/if.cpp b/src/boost/libs/mpl/test/if.cpp new file mode 100644 index 00000000..df32b6a5 --- /dev/null +++ b/src/boost/libs/mpl/test/if.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef if_::type t1; + typedef if_c::type t2; + typedef if_::type t3; + typedef if_c::type t4; + + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); +} diff --git a/src/boost/libs/mpl/test/index_of.cpp b/src/boost/libs/mpl/test/index_of.cpp new file mode 100644 index 00000000..bffd3218 --- /dev/null +++ b/src/boost/libs/mpl/test/index_of.cpp @@ -0,0 +1,34 @@ + +// Copyright Eric Friedman 2003 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + + +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list< int, double, float >::type types; + + typedef index_of< types, int >::type index_of_int; + typedef index_of< types, double >::type index_of_double; + typedef index_of< types, float >::type index_of_float; + typedef index_of< types, char >::type index_of_char; + + MPL_ASSERT_RELATION( index_of_int::value, ==, 0 ); + MPL_ASSERT_RELATION( index_of_double::value, ==, 1 ); + MPL_ASSERT_RELATION( index_of_float::value, ==, 2 ); + + MPL_ASSERT(( is_void_< index_of_char > )); +} diff --git a/src/boost/libs/mpl/test/inherit.cpp b/src/boost/libs/mpl/test/inherit.cpp new file mode 100644 index 00000000..4b16adc5 --- /dev/null +++ b/src/boost/libs/mpl/test/inherit.cpp @@ -0,0 +1,40 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +struct her { typedef her herself; }; +struct my { typedef my myself; }; + +MPL_TEST_CASE() +{ + MPL_ASSERT(( is_same::type, her> )); + + typedef inherit::type her_my1; + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + + typedef inherit::type her1; + MPL_ASSERT(( is_same )); + + typedef inherit::type her2; + MPL_ASSERT(( is_same )); + + typedef inherit::type her_my2; + MPL_ASSERT(( is_same )); + MPL_ASSERT(( is_same )); + + typedef inherit::type empty; + MPL_ASSERT(( is_same )); +} diff --git a/src/boost/libs/mpl/test/insert.cpp b/src/boost/libs/mpl/test/insert.cpp new file mode 100644 index 00000000..f293cbba --- /dev/null +++ b/src/boost/libs/mpl/test/insert.cpp @@ -0,0 +1,31 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef vector_c numbers; + typedef find< numbers,integral_c >::type pos; + typedef insert< numbers,pos,integral_c >::type range; + + MPL_ASSERT_RELATION( size::value, ==, 10 ); + MPL_ASSERT(( equal< range,range_c > )); +} diff --git a/src/boost/libs/mpl/test/insert_range.cpp b/src/boost/libs/mpl/test/insert_range.cpp new file mode 100644 index 00000000..865017b7 --- /dev/null +++ b/src/boost/libs/mpl/test/insert_range.cpp @@ -0,0 +1,73 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef vector_c numbers; + typedef find< numbers,integral_c >::type pos; + typedef insert_range< numbers,pos,range_c >::type range; + + MPL_ASSERT_RELATION( size::value, ==, 10 ); + MPL_ASSERT(( equal< range,range_c > )); + + typedef insert_range< list0<>,end< list0<> >::type,list1 >::type result2; + MPL_ASSERT_RELATION( size::value, ==, 1 ); +} + +template +void test_associative() +{ + typedef typename insert_range< A,typename end< A >::type,B >::type C; + + MPL_ASSERT_RELATION( size::value, <=, (size::value + size::value) ); + MPL_ASSERT(( fold< joint_view< A,B >,true_,and_< _1,contains< C,_2 > > > )); +} + +MPL_TEST_CASE() +{ + typedef set3< short,int,long > signed_integers; + typedef set3< unsigned short,unsigned int,unsigned long > unsigned_integers; + test_associative(); + + typedef set_c< int,1,3,5,7,9 > odds; + typedef set_c< int,0,2,4,6,8 > evens; + test_associative(); + + typedef map2< + pair< void,void* > + , pair< int,int* > + > pointers; + typedef map2< + pair< void const,void const* > + , pair< int const,int const* > + > pointers_to_const; + test_associative(); +} diff --git a/src/boost/libs/mpl/test/int.cpp b/src/boost/libs/mpl/test/int.cpp new file mode 100644 index 00000000..6c1e24b2 --- /dev/null +++ b/src/boost/libs/mpl/test/int.cpp @@ -0,0 +1,24 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#include "integral_wrapper_test.hpp" + + +MPL_TEST_CASE() +{ +# define WRAPPER(T, i) int_ + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, int) +} diff --git a/src/boost/libs/mpl/test/integral_c.cpp b/src/boost/libs/mpl/test/integral_c.cpp new file mode 100644 index 00000000..a9f9b0c2 --- /dev/null +++ b/src/boost/libs/mpl/test/integral_c.cpp @@ -0,0 +1,30 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#include "integral_wrapper_test.hpp" + + +MPL_TEST_CASE() +{ +# define WRAPPER(T, i) integral_c + +#if !(defined(__APPLE_CC__) && defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 3)) + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, char) +#endif + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, short) + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, int) + BOOST_PP_REPEAT(10, INTEGRAL_WRAPPER_TEST, long) +} diff --git a/src/boost/libs/mpl/test/integral_wrapper_test.hpp b/src/boost/libs/mpl/test/integral_wrapper_test.hpp new file mode 100644 index 00000000..be31d505 --- /dev/null +++ b/src/boost/libs/mpl/test/integral_wrapper_test.hpp @@ -0,0 +1,63 @@ + +// Copyright Aleksey Gurtovoy 2001-2006 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ + BOOST_TEST(( WRAPPER(T,i)() == i )); \ + BOOST_TEST(( WRAPPER(T,i)::value == i )); \ + /**/ +#else +# define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ + BOOST_TEST(( WRAPPER(T,i)::value == i )); \ + /**/ +#endif + +#if defined(BOOST_NO_CXX11_CONSTEXPR) +#define CONSTEXPR_INTEGRAL_TEST(T, i) +#else +#define CONSTEXPR_INTEGRAL_TEST(T, i) { static_assert(T() == i, "Constexpr for integral constant failed"); } +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +// agurt 20/nov/06: see http://article.gmane.org/gmane.comp.lib.boost.devel/151065 +#define INTEGRAL_WRAPPER_TEST(unused1, i, T) \ + { \ + typedef WRAPPER(T,i) borland_tested_type; \ + { typedef is_same< borland_tested_type::value_type, T > borland_test_type; \ + MPL_ASSERT(( borland_test_type )); } \ + { MPL_ASSERT(( is_same< borland_tested_type::type, WRAPPER(T,i) > )); } \ + { MPL_ASSERT(( is_same< next< borland_tested_type >::type, WRAPPER(T,i+1) > )); } \ + { MPL_ASSERT(( is_same< prior< borland_tested_type >::type, WRAPPER(T,i-1) > )); } \ + { MPL_ASSERT_RELATION( (borland_tested_type::value), ==, i ); } \ + CONSTEXPR_INTEGRAL_TEST(borland_tested_type, i) \ + INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ + } \ +/**/ +#else +#define INTEGRAL_WRAPPER_TEST(unused1, i, T) \ + { MPL_ASSERT(( is_same< WRAPPER(T,i)::value_type, T > )); } \ + { MPL_ASSERT(( is_same< WRAPPER(T,i)::type, WRAPPER(T,i) > )); } \ + { MPL_ASSERT(( is_same< next< WRAPPER(T,i) >::type, WRAPPER(T,i+1) > )); } \ + { MPL_ASSERT(( is_same< prior< WRAPPER(T,i) >::type, WRAPPER(T,i-1) > )); } \ + { MPL_ASSERT_RELATION( (WRAPPER(T,i)::value), ==, i ); } \ + CONSTEXPR_INTEGRAL_TEST(WRAPPER(T,i), i) \ + INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ +/**/ +#endif + diff --git a/src/boost/libs/mpl/test/is_placeholder.cpp b/src/boost/libs/mpl/test/is_placeholder.cpp new file mode 100644 index 00000000..b90b3a3c --- /dev/null +++ b/src/boost/libs/mpl/test/is_placeholder.cpp @@ -0,0 +1,42 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include +#include +#include + +#define AUX_IS_PLACEHOLDER_TEST(unused1, n, unused2) \ + { MPL_ASSERT(( is_placeholder< \ + BOOST_PP_CAT(_,BOOST_PP_INC(n)) \ + > )); } \ +/**/ + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( is_placeholder )); + MPL_ASSERT_NOT(( is_placeholder )); + MPL_ASSERT_NOT(( is_placeholder )); + MPL_ASSERT_NOT(( is_placeholder )); + MPL_ASSERT_NOT(( is_placeholder )); + MPL_ASSERT(( is_placeholder<_> )); + + BOOST_PP_REPEAT( + BOOST_MPL_LIMIT_METAFUNCTION_ARITY + , AUX_IS_PLACEHOLDER_TEST + , unused + ) +} diff --git a/src/boost/libs/mpl/test/is_sequence.cpp b/src/boost/libs/mpl/test/is_sequence.cpp new file mode 100644 index 00000000..1efa8175 --- /dev/null +++ b/src/boost/libs/mpl/test/is_sequence.cpp @@ -0,0 +1,39 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +template< typename T > struct std_vector +{ + T* begin(); +}; + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( is_sequence< std_vector > )); + MPL_ASSERT_NOT(( is_sequence< int_<0> > )); + MPL_ASSERT_NOT(( is_sequence< int > )); + MPL_ASSERT_NOT(( is_sequence< int& > )); + MPL_ASSERT_NOT(( is_sequence< UDT > )); + MPL_ASSERT_NOT(( is_sequence< UDT* > )); + MPL_ASSERT(( is_sequence< range_c > )); + MPL_ASSERT(( is_sequence< list<> > )); + MPL_ASSERT(( is_sequence< list > )); + MPL_ASSERT(( is_sequence< vector<> > )); + MPL_ASSERT(( is_sequence< vector > )); +} diff --git a/src/boost/libs/mpl/test/iterator_tags.cpp b/src/boost/libs/mpl/test/iterator_tags.cpp new file mode 100644 index 00000000..6840161c --- /dev/null +++ b/src/boost/libs/mpl/test/iterator_tags.cpp @@ -0,0 +1,23 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + MPL_ASSERT(( less )); + MPL_ASSERT(( less )); +} diff --git a/src/boost/libs/mpl/test/joint_view.cpp b/src/boost/libs/mpl/test/joint_view.cpp new file mode 100644 index 00000000..17f824c6 --- /dev/null +++ b/src/boost/libs/mpl/test/joint_view.cpp @@ -0,0 +1,56 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + + +MPL_TEST_CASE() +{ + typedef joint_view< + range_c + , range_c + > numbers; + + typedef range_c answer; + + MPL_ASSERT(( equal )); + MPL_ASSERT(( equal )); + MPL_ASSERT_RELATION( size::value, ==, 15 ); +} + +template< typename View > struct test_is_empty +{ + typedef typename begin::type first_; + typedef typename end::type last_; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT(( is_same< first_,last_> )); + + MPL_ASSERT_INSTANTIATION( View ); + MPL_ASSERT_INSTANTIATION( first_ ); + MPL_ASSERT_INSTANTIATION( last_ ); +}; + +MPL_TEST_CASE() +{ + test_is_empty< joint_view< list0<>,list0<> > >(); + test_is_empty< joint_view< list<>,list0<> > >(); + test_is_empty< joint_view< list<>,list<> > >(); + test_is_empty< joint_view< list<>, joint_view< list0<>,list0<> > > >(); +} diff --git a/src/boost/libs/mpl/test/lambda.cpp b/src/boost/libs/mpl/test/lambda.cpp new file mode 100644 index 00000000..22e6236c --- /dev/null +++ b/src/boost/libs/mpl/test/lambda.cpp @@ -0,0 +1,78 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +struct my +{ + char a[100]; +}; + +MPL_TEST_CASE() +{ + // !(x == char) && !(x == double) || sizeof(x) > 8 + typedef lambda< + or_< + and_< + not_< boost::is_same<_1, char> > + , not_< boost::is_float<_1> > + > + , greater< sizeof_<_1>, mpl::size_t<8> > + > + >::type f; + + MPL_ASSERT_NOT(( apply_wrap1 )); + MPL_ASSERT_NOT(( apply_wrap1 )); + MPL_ASSERT(( apply_wrap1 )); + MPL_ASSERT(( apply_wrap1 )); +} + +MPL_TEST_CASE() +{ + // x == y || x == my || sizeof(x) == sizeof(y) + typedef lambda< + or_< + boost::is_same<_1, _2> + , boost::is_same<_2, my> + , equal_to< sizeof_<_1>, sizeof_<_2> > + > + >::type f; + + MPL_ASSERT_NOT(( apply_wrap2 )); + MPL_ASSERT_NOT(( apply_wrap2 )); + MPL_ASSERT_NOT(( apply_wrap2 )); + MPL_ASSERT(( apply_wrap2 )); + MPL_ASSERT(( apply_wrap2 )); + MPL_ASSERT(( apply_wrap2 )); +} + +MPL_TEST_CASE() +{ + // bind <-> lambda interaction + typedef lambda< less<_1,_2> >::type pred; + typedef bind2< pred, _1, int_<4> > f; + + MPL_ASSERT(( apply_wrap1< f,int_<3> > )); +} diff --git a/src/boost/libs/mpl/test/lambda_args.cpp b/src/boost/libs/mpl/test/lambda_args.cpp new file mode 100644 index 00000000..fdd26205 --- /dev/null +++ b/src/boost/libs/mpl/test/lambda_args.cpp @@ -0,0 +1,48 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + +typedef int UDT::* mem_ptr; +typedef int (UDT::* mem_fun_ptr)(); + +#define AUX_LAMBDA_TEST(T) \ + { MPL_ASSERT(( apply1 >::type, T> )); } \ + { MPL_ASSERT(( apply1 >::type, T> )); } \ + { MPL_ASSERT(( apply2 >::type, T, T> )); } \ +/**/ + +MPL_TEST_CASE() +{ + AUX_LAMBDA_TEST( UDT ); + AUX_LAMBDA_TEST( abstract ); + AUX_LAMBDA_TEST( noncopyable ); + AUX_LAMBDA_TEST( incomplete ); + AUX_LAMBDA_TEST( int ); + AUX_LAMBDA_TEST( void ); + AUX_LAMBDA_TEST( double ); + AUX_LAMBDA_TEST( int& ); + AUX_LAMBDA_TEST( int* ); +#if !BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \ + && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) + AUX_LAMBDA_TEST( int[] ); +#endif + AUX_LAMBDA_TEST( int[10] ); + AUX_LAMBDA_TEST( int (*)() ) + AUX_LAMBDA_TEST( mem_ptr ); + AUX_LAMBDA_TEST( mem_fun_ptr ); +} diff --git a/src/boost/libs/mpl/test/list.cpp b/src/boost/libs/mpl/test/list.cpp new file mode 100644 index 00000000..655905a1 --- /dev/null +++ b/src/boost/libs/mpl/test/list.cpp @@ -0,0 +1,68 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef list0<> l0; + typedef list1 l1; + typedef list2 l2; + typedef list9 l9; + + MPL_ASSERT_RELATION(size::value, ==, 0); + MPL_ASSERT_RELATION(size::value, ==, 1); + MPL_ASSERT_RELATION(size::value, ==, 2); + MPL_ASSERT_RELATION(size::value, ==, 9); + + MPL_ASSERT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + + MPL_ASSERT(( is_same::type,char> )); + MPL_ASSERT(( is_same::type,char> )); + MPL_ASSERT(( is_same::type,char> )); +} + +MPL_TEST_CASE() +{ + typedef list2 l2; + + typedef begin::type i1; + typedef next::type i2; + typedef next::type i3; + + MPL_ASSERT(( is_same::type,char> )); + MPL_ASSERT(( is_same::type,long> )); + MPL_ASSERT(( is_same< i3, end::type > )); +} + +MPL_TEST_CASE() +{ + typedef list0<> l0; + + typedef push_front::type l1; + MPL_ASSERT(( is_same::type,char> )); + + typedef push_front::type l2; + MPL_ASSERT(( is_same::type,long> )); +} diff --git a/src/boost/libs/mpl/test/list_c.cpp b/src/boost/libs/mpl/test/list_c.cpp new file mode 100644 index 00000000..7683fda0 --- /dev/null +++ b/src/boost/libs/mpl/test/list_c.cpp @@ -0,0 +1,81 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include + + +#if !BOOST_WORKAROUND(BOOST_MSVC,<= 1200) +MPL_TEST_CASE() +{ + typedef list_c::type l1; + typedef list_c::type l2; + + MPL_ASSERT(( is_same< l1::value_type, bool > )); + MPL_ASSERT(( is_same< l2::value_type, bool > )); + + MPL_ASSERT_RELATION( front::type::value, ==, true ); + MPL_ASSERT_RELATION( front::type::value, ==, false ); +} +#endif + +MPL_TEST_CASE() +{ + typedef list_c::type l1; + typedef list_c::type l2; + typedef list_c::type l3; + + MPL_ASSERT(( is_same< l1::value_type, int > )); + MPL_ASSERT(( is_same< l2::value_type, int > )); + MPL_ASSERT(( is_same< l3::value_type, int > )); + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 3 ); + MPL_ASSERT_RELATION( front::type::value, ==, -1 ); + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( front::type::value, ==, 1 ); +} + +MPL_TEST_CASE() +{ + typedef list_c::type l1; + typedef list_c::type l2; + + MPL_ASSERT(( is_same< l1::value_type, unsigned > )); + MPL_ASSERT(( is_same< l2::value_type, unsigned > )); + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( front::type::value, ==, 1 ); +} + +MPL_TEST_CASE() +{ + typedef list_c l2; + + MPL_ASSERT(( is_same< l2::value_type, unsigned > )); + + typedef begin::type i1; + typedef next::type i2; + typedef next::type i3; + + MPL_ASSERT_RELATION( deref::type::value, ==, 2 ); + MPL_ASSERT_RELATION( deref::type::value, ==, 1 ); + MPL_ASSERT(( is_same< i3, end::type > )); +} diff --git a/src/boost/libs/mpl/test/logical.cpp b/src/boost/libs/mpl/test/logical.cpp new file mode 100644 index 00000000..bea6b7ac --- /dev/null +++ b/src/boost/libs/mpl/test/logical.cpp @@ -0,0 +1,41 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +struct unknown; + +using mpl::true_; +using mpl::false_; + +MPL_TEST_CASE() +{ + MPL_ASSERT(( mpl::and_< true_,true_ > )); + MPL_ASSERT_NOT(( mpl::and_< false_,true_ > )); + MPL_ASSERT_NOT(( mpl::and_< true_,false_ > )); + MPL_ASSERT_NOT(( mpl::and_< false_,false_ > )); + MPL_ASSERT_NOT(( mpl::and_< false_,unknown > )); + MPL_ASSERT_NOT(( mpl::and_< false_,unknown,unknown > )); + + MPL_ASSERT(( mpl::or_< true_,true_ > )); + MPL_ASSERT(( mpl::or_< false_,true_ > )); + MPL_ASSERT(( mpl::or_< true_,false_ > )); + MPL_ASSERT_NOT(( mpl::or_< false_,false_ > )); + MPL_ASSERT(( mpl::or_< true_,unknown > )); + MPL_ASSERT(( mpl::or_< true_,unknown,unknown > )); + + MPL_ASSERT_NOT(( mpl::not_< true_ > )); + MPL_ASSERT(( mpl::not_< false_ > )); +} diff --git a/src/boost/libs/mpl/test/lower_bound.cpp b/src/boost/libs/mpl/test/lower_bound.cpp new file mode 100644 index 00000000..95be40de --- /dev/null +++ b/src/boost/libs/mpl/test/lower_bound.cpp @@ -0,0 +1,28 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list_c numbers; + typedef lower_bound< numbers, int_<4> >::type iter; + + MPL_ASSERT_RELATION( (mpl::distance< begin::type,iter >::value), ==, 5 ); + MPL_ASSERT_RELATION( deref::type::value, ==, 5 ); +} diff --git a/src/boost/libs/mpl/test/map.cpp b/src/boost/libs/mpl/test/map.cpp new file mode 100644 index 00000000..f39b85d8 --- /dev/null +++ b/src/boost/libs/mpl/test/map.cpp @@ -0,0 +1,235 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef map2< + mpl::pair + , mpl::pair + > m_; + + typedef erase_key::type m; + + MPL_ASSERT_RELATION( size::type::value, ==, 1 ); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT(( is_same< clear::type,map0<> > )); + + MPL_ASSERT(( is_same< at::type,unsigned > )); + MPL_ASSERT(( is_same< at::type,void_ > )); + MPL_ASSERT(( contains< m,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m,mpl::pair > )); + + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT(( has_key::type )); + + MPL_ASSERT_NOT(( is_same< order::type, void_ > )); + MPL_ASSERT(( is_same< order::type,void_ > )); + + typedef begin::type first; + typedef end::type last; + + MPL_ASSERT(( is_same< deref::type,mpl::pair > )); + MPL_ASSERT(( is_same< next::type,last > )); + + typedef insert >::type m2; + + MPL_ASSERT_RELATION( size::type::value, ==, 2 ); + MPL_ASSERT_NOT(( empty::type )); + MPL_ASSERT(( is_same< clear::type,map0<> > )); + MPL_ASSERT(( is_same< at::type,unsigned > )); + MPL_ASSERT(( is_same< at::type,long > )); + + MPL_ASSERT(( contains< m2,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m2,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m2,mpl::pair > )); + MPL_ASSERT(( contains< m2,mpl::pair > )); + + MPL_ASSERT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( is_same< order::type, void_ > )); + MPL_ASSERT_NOT(( is_same< order::type, void_ > )); + MPL_ASSERT_NOT(( is_same< order::type, order::type > )); + + typedef begin::type first2; + typedef end::type last2; + + MPL_ASSERT(( is_same::type,mpl::pair > )); + typedef next::type iter; + MPL_ASSERT(( is_same::type,mpl::pair > )); + MPL_ASSERT(( is_same< next::type,last2 > )); + + typedef insert >::type s2_1; + MPL_ASSERT(( is_same )); + + typedef insert >::type m3; + MPL_ASSERT_RELATION( size::type::value, ==, 3 ); + MPL_ASSERT(( has_key::type )); + MPL_ASSERT(( has_key::type )); + MPL_ASSERT(( has_key::type )); + MPL_ASSERT(( contains< m3,mpl::pair > )); + MPL_ASSERT(( contains< m3,mpl::pair > )); + + typedef insert >::type m1; + MPL_ASSERT_RELATION( size::type::value, ==, 2 ); + MPL_ASSERT(( is_same< at::type,unsigned > )); + MPL_ASSERT(( is_same< at::type,long > )); + + MPL_ASSERT(( contains< m1,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m1,mpl::pair > )); + MPL_ASSERT_NOT(( contains< m1,mpl::pair > )); + MPL_ASSERT(( contains< m1,mpl::pair > )); + + MPL_ASSERT(( is_same< m1,m2 > )); + + typedef erase_key::type m_1; + MPL_ASSERT(( is_same )); + MPL_ASSERT_RELATION( size::type::value, ==, 1 ); + MPL_ASSERT(( is_same< at::type,void_ > )); + MPL_ASSERT(( is_same< at::type,unsigned > )); + + typedef erase_key::type m2_1; + MPL_ASSERT_RELATION( size::type::value, ==, 2 ); + MPL_ASSERT(( is_same< at::type,void_ > )); + MPL_ASSERT(( is_same< at::type,unsigned > )); + MPL_ASSERT(( is_same< at::type,unsigned > )); +} + +MPL_TEST_CASE() +{ + typedef map0<> m; + + MPL_ASSERT_RELATION( size::type::value, ==, 0 ); + MPL_ASSERT(( empty::type )); + + MPL_ASSERT(( is_same< clear::type,map0<> > )); + MPL_ASSERT(( is_same< at::type,void_ > )); + + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + MPL_ASSERT_NOT(( has_key::type )); + + typedef insert >::type m1; + MPL_ASSERT_RELATION( size::type::value, ==, 1 ); + MPL_ASSERT(( is_same< at::type,int > )); + + typedef erase_key::type m0_1; + MPL_ASSERT_RELATION( size::type::value, ==, 0 ); + MPL_ASSERT(( is_same< at::type,void_ > )); +} + +// Use a template for testing so that GCC will show us the actual types involved +template +void test() +{ + MPL_ASSERT_RELATION( size::value, ==, 3 ); + + typedef typename end::type not_found; + BOOST_MPL_ASSERT_NOT(( is_same >::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same >::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same >::type,not_found> )); + BOOST_MPL_ASSERT(( is_same::type,not_found> )); +}; + +MPL_TEST_CASE() +{ + typedef map< mpl::pair > map_of_1_pair; + typedef begin::type iter_to_1_pair; + + BOOST_MPL_ASSERT(( + is_same< + deref::type + , mpl::pair + > + )); + + typedef map< + mpl::pair + , mpl::pair + , mpl::pair + > mymap; + + test(); + test(); +} + +MPL_TEST_CASE() +{ + typedef mpl::erase_key< + mpl::map< + mpl::pair + , mpl::pair + > + , char + >::type int_to_float_map; + + typedef mpl::insert< + int_to_float_map + , mpl::pair + >::type with_char_too; + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::at::type + , long + > + )); +} + +MPL_TEST_CASE() +{ + typedef insert< map<>, pair >::type little_map; + + MPL_ASSERT_RELATION(size::value, ==, 1); + MPL_ASSERT_RELATION(size::value, ==, 1); +} + +MPL_TEST_CASE() +{ + typedef erase_key< map< pair, pair >, float >::type little_map; + + MPL_ASSERT_RELATION(size::value, ==, 1); + MPL_ASSERT_RELATION(size::value, ==, 1); +} diff --git a/src/boost/libs/mpl/test/max_element.cpp b/src/boost/libs/mpl/test/max_element.cpp new file mode 100644 index 00000000..65bb0f3a --- /dev/null +++ b/src/boost/libs/mpl/test/max_element.cpp @@ -0,0 +1,26 @@ + +// Copyright Eric Friedman 2002-2003 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef list_c::type numbers; + typedef max_element< numbers >::type iter; + typedef deref::type max_value; + + MPL_ASSERT_RELATION( max_value::value, ==, 8 ); +} diff --git a/src/boost/libs/mpl/test/min_max.cpp b/src/boost/libs/mpl/test/min_max.cpp new file mode 100644 index 00000000..02ead233 --- /dev/null +++ b/src/boost/libs/mpl/test/min_max.cpp @@ -0,0 +1,27 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +#include + + +MPL_TEST_CASE() +{ + MPL_ASSERT(( is_same< mpl::min< int_<5>,int_<7> >::type,int_<5> > )); + MPL_ASSERT(( is_same< mpl::max< int_<5>,int_<7> >::type,int_<7> > )); + + MPL_ASSERT(( is_same< mpl::min< int_<-5>,int_<-7> >::type,int_<-7> > )); + MPL_ASSERT(( is_same< mpl::max< int_<-5>,int_<-7> >::type,int_<-5> > )); +} diff --git a/src/boost/libs/mpl/test/multiset.cpp b/src/boost/libs/mpl/test/multiset.cpp new file mode 100644 index 00000000..48a6176e --- /dev/null +++ b/src/boost/libs/mpl/test/multiset.cpp @@ -0,0 +1,107 @@ + +// Copyright Aleksey Gurtovoy 2003-2006 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +//#include + +#include +#include +#include + +#include +#include +#include + +#include + +/* +struct test_data1 +{ + typedef multiset0<> s0; + typedef multiset1 s1; + typedef multiset2 s2; + typedef multiset3 s3; + typedef multiset4 s4; +}; + +struct test_data2 +{ + typedef multiset<> s0; + typedef multiset s1; + typedef multiset s2; + typedef multiset s3; + typedef multiset s4; +}; +*/ + +template< typename S0 > +struct test_data +{ + typedef S0 s0; + typedef typename insert::type s1; + typedef typename insert::type s2; + typedef typename insert::type s3; + typedef typename insert::type s4; +}; + + +template< typename T > +void count_test() +{ + MPL_ASSERT_RELATION( ( count::value ), ==, 0 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 1 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 1 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 1 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 2 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 1 ); + MPL_ASSERT_RELATION( ( count::value ), ==, 1 ); +} + +MPL_TEST_CASE() +{ + //count_test(); + //count_test(); + //count_test< test_data< multiset<> > >(); + count_test< test_data< multiset0<> > >(); +} + +/* +// Use a template for testing so that GCC will show us the actual types involved +template +void find_test() +{ + BOOST_MPL_ASSERT_RELATION( size::value, ==, 3 ); + + typedef typename end::type not_found; + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT(( is_same::type,not_found> )); +} +*/ + +MPL_TEST_CASE() +{ + // agurt 11/jun/06: multiset does not implement iterators yet! + // typedef insert, int>::type set_of_1_int; + // typedef begin::type iter_to_1_int; + // BOOST_MPL_ASSERT(( is_same< deref::type, int > )); + + typedef multiset0<> s0; + typedef insert::type s1; + typedef insert::type s2; + typedef insert::type myset; + + // find_test(); + // find_test(); +} diff --git a/src/boost/libs/mpl/test/next.cpp b/src/boost/libs/mpl/test/next.cpp new file mode 100644 index 00000000..d7356c72 --- /dev/null +++ b/src/boost/libs/mpl/test/next.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef int_<0> _0; + typedef int_<1> _1; + typedef int_<2> _2; + + MPL_ASSERT(( is_same< next<_0>::type, _1 > )); + MPL_ASSERT(( is_same< next<_1>::type, _2 > )); + MPL_ASSERT(( is_same< prior<_1>::type, _0 > )); + MPL_ASSERT(( is_same< prior<_2>::type, _1 > )); +} diff --git a/src/boost/libs/mpl/test/no_has_xxx.cpp b/src/boost/libs/mpl/test/no_has_xxx.cpp new file mode 100644 index 00000000..53e4691f --- /dev/null +++ b/src/boost/libs/mpl/test/no_has_xxx.cpp @@ -0,0 +1,30 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + + +// This file tests that we have the right value for +// BOOST_MPL_CFG_NO_HAS_XXX, and that 'has_xxx' doesn't just fail to +// compile arbitrarily. + +#include + +#if defined(BOOST_MPL_CFG_NO_HAS_XXX) +# define HAS_XXX_ASSERT(x) MPL_ASSERT_NOT(x) +#endif + +#if defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE) +# define HAS_XXX_TEMPLATE_ASSERT(x) MPL_ASSERT_NOT(x) +#endif + +#include "has_xxx.cpp" diff --git a/src/boost/libs/mpl/test/numeric_ops.cpp b/src/boost/libs/mpl/test/numeric_ops.cpp new file mode 100644 index 00000000..453b4aab --- /dev/null +++ b/src/boost/libs/mpl/test/numeric_ops.cpp @@ -0,0 +1,155 @@ + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +struct complex_tag : int_<10> {}; + +template< typename Re, typename Im > struct complex +{ + typedef complex_tag tag; + typedef complex type; + typedef Re real; + typedef Im imag; +}; + +template< typename C > struct real : C::real {}; +template< typename C > struct imag : C::imag {}; + +namespace boost { namespace mpl { + +template<> struct BOOST_MPL_AUX_NUMERIC_CAST< integral_c_tag,complex_tag > +{ + template< typename N > struct apply + : complex< N, integral_c< typename N::value_type, 0 > > + { + }; +}; + +template<> +struct plus_impl< complex_tag,complex_tag > +{ + template< typename N1, typename N2 > struct apply + : complex< + plus< typename N1::real, typename N2::real > + , plus< typename N1::imag, typename N2::imag > + > + { + }; +}; + +template<> +struct times_impl< complex_tag,complex_tag > +{ + template< typename N1, typename N2 > struct apply + : complex< + minus< + times< typename N1::real, typename N2::real > + , times< typename N1::imag, typename N2::imag > + > + , plus< + times< typename N1::real, typename N2::imag > + , times< typename N1::imag, typename N2::real > + > + > + { + }; +}; + +template<> +struct equal_to_impl< complex_tag,complex_tag > +{ + template< typename N1, typename N2 > struct apply + : and_< + equal_to< typename N1::real, typename N2::real > + , equal_to< typename N1::imag, typename N2::imag > + > + { + }; +}; + +}} + + +typedef int_<2> i; +typedef complex< int_<5>, int_<-1> > c1; +typedef complex< int_<-5>, int_<1> > c2; + +MPL_TEST_CASE() +{ + typedef plus::type r1; + MPL_ASSERT_RELATION( real::value, ==, 0 ); + MPL_ASSERT_RELATION( imag::value, ==, 0 ); + + typedef plus::type r2; + MPL_ASSERT_RELATION( real::value, ==, 10 ); + MPL_ASSERT_RELATION( imag::value, ==, -2 ); + + typedef plus::type r3; + MPL_ASSERT_RELATION( real::value, ==, -10 ); + MPL_ASSERT_RELATION( imag::value, ==, 2 ); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typedef plus::type r4; + MPL_ASSERT_RELATION( real::value, ==, 7 ); + MPL_ASSERT_RELATION( imag::value, ==, -1 ); + + typedef plus::type r5; + MPL_ASSERT_RELATION( real::value, ==, -3 ); + MPL_ASSERT_RELATION( imag::value, ==, 1 ); +#endif +} + +MPL_TEST_CASE() +{ + typedef times::type r1; + MPL_ASSERT_RELATION( real::value, ==, -24 ); + MPL_ASSERT_RELATION( imag::value, ==, 10 ); + + typedef times::type r2; + MPL_ASSERT_RELATION( real::value, ==, 24 ); + MPL_ASSERT_RELATION( imag::value, ==, -10 ); + + typedef times::type r3; + MPL_ASSERT_RELATION( real::value, ==, 24 ); + MPL_ASSERT_RELATION( imag::value, ==, -10 ); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typedef times::type r4; + MPL_ASSERT_RELATION( real::value, ==, 10 ); + MPL_ASSERT_RELATION( imag::value, ==, -2 ); + + typedef times::type r5; + MPL_ASSERT_RELATION( real::value, ==, -10 ); + MPL_ASSERT_RELATION( imag::value, ==, 2 ); +#endif +} + +MPL_TEST_CASE() +{ + MPL_ASSERT(( equal_to )); + MPL_ASSERT(( equal_to )); + MPL_ASSERT_NOT(( equal_to )); + + MPL_ASSERT(( equal_to, long_<-1> > > )); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + MPL_ASSERT_NOT(( equal_to )); + MPL_ASSERT_NOT(( equal_to )); +#endif +} diff --git a/src/boost/libs/mpl/test/pair_view.cpp b/src/boost/libs/mpl/test/pair_view.cpp new file mode 100644 index 00000000..937ff427 --- /dev/null +++ b/src/boost/libs/mpl/test/pair_view.cpp @@ -0,0 +1,45 @@ + +// Copyright David Abrahams 2003-2004 +// Copyright Aleksey Gurtovoy 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + + +MPL_TEST_CASE() +{ + typedef range_c r; + typedef vector10_c v; + + typedef pair_view view; + typedef begin::type first_; + typedef end::type last_; + + MPL_ASSERT(( is_same< first_::category, mpl::random_access_iterator_tag > )); + + MPL_ASSERT(( is_same< advance_c::type, first_ > )); + MPL_ASSERT(( is_same< advance_c::type, last_ > )); + MPL_ASSERT(( is_same< advance_c::type, last_ > )); + MPL_ASSERT(( is_same< advance_c::type, first_ > )); + + typedef advance_c::type iter; + + MPL_ASSERT(( is_same< + deref::type + , mpl::pair< integral_c,integral_c > + > )); + +} diff --git a/src/boost/libs/mpl/test/partition.cpp b/src/boost/libs/mpl/test/partition.cpp new file mode 100644 index 00000000..947c310d --- /dev/null +++ b/src/boost/libs/mpl/test/partition.cpp @@ -0,0 +1,42 @@ + +// Copyright Aleksey Gurtovoy 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template< typename N > struct is_odd + : modulus< N, int_<2> > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, is_odd, (N)) +}; + + +MPL_TEST_CASE() +{ + typedef partition< + range_c + , is_odd<_1> + , mpl::back_inserter< vector<> > + , mpl::back_inserter< vector<> > + >::type r; + + MPL_ASSERT(( equal< r::first, vector_c > )); + MPL_ASSERT(( equal< r::second, vector_c > )); +} diff --git a/src/boost/libs/mpl/test/pop_front.cpp b/src/boost/libs/mpl/test/pop_front.cpp new file mode 100644 index 00000000..71512c10 --- /dev/null +++ b/src/boost/libs/mpl/test/pop_front.cpp @@ -0,0 +1,36 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list::type types1; + typedef list::type types2; + typedef list::type types3; + + typedef pop_front::type result1; + typedef pop_front::type result2; + typedef pop_front::type result3; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + + MPL_ASSERT(( is_same< front::type, long > )); + MPL_ASSERT(( is_same< front::type, int > )); +} diff --git a/src/boost/libs/mpl/test/print.cpp b/src/boost/libs/mpl/test/print.cpp new file mode 100644 index 00000000..12295df3 --- /dev/null +++ b/src/boost/libs/mpl/test/print.cpp @@ -0,0 +1,22 @@ + +// Copyright Aleksey Gurtovoy 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include + + +MPL_TEST_CASE() +{ + typedef print::type t; +} diff --git a/src/boost/libs/mpl/test/push_back.cpp b/src/boost/libs/mpl/test/push_back.cpp new file mode 100644 index 00000000..bdf7a920 --- /dev/null +++ b/src/boost/libs/mpl/test/push_back.cpp @@ -0,0 +1,52 @@ + +// Copyright Steven Watanabe 2009 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date: 2008-10-10 02:21:07 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49240 $ + +#include + +#include + +struct no_push_back_tag {}; + +struct no_push_back +{ + typedef no_push_back_tag tag; +}; + +struct has_push_back_tag {}; + +struct with_push_back +{ + typedef has_push_back_tag tag; +}; + +namespace boost { namespace mpl { + +template<> +struct push_back_impl< has_push_back_tag > +{ + template struct apply + { + typedef no_push_back type; + }; +}; + +}} + +MPL_TEST_CASE() +{ + MPL_ASSERT_NOT(( has_push_back< no_push_back > )); + MPL_ASSERT(( has_push_back< with_push_back > )); + + typedef push_back< with_push_back , int >::type test; + MPL_ASSERT(( is_same< test, no_push_back > )); +} diff --git a/src/boost/libs/mpl/test/push_front.cpp b/src/boost/libs/mpl/test/push_front.cpp new file mode 100644 index 00000000..f5edc2f9 --- /dev/null +++ b/src/boost/libs/mpl/test/push_front.cpp @@ -0,0 +1,50 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Steven Watanabe 2009 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + +#include + +struct no_push_front_tag {}; + +struct no_push_front +{ + typedef no_push_front_tag tag; +}; + +MPL_TEST_CASE() +{ + typedef push_front,long>::type res1; + typedef push_front,int>::type res2; + typedef push_front,char>::type res3; + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 3 ); + + MPL_ASSERT(( is_same< front::type, long > )); + MPL_ASSERT(( is_same< front::type, int > )); + MPL_ASSERT(( is_same< front::type, char > )); + + MPL_ASSERT(( has_push_front< list0<> > )); + MPL_ASSERT(( has_push_front< list1 > )); + + MPL_ASSERT_NOT(( has_push_back< list0<> > )); + + MPL_ASSERT_NOT(( has_push_front< no_push_front > )); +} diff --git a/src/boost/libs/mpl/test/quote.cpp b/src/boost/libs/mpl/test/quote.cpp new file mode 100644 index 00000000..45e97f8d --- /dev/null +++ b/src/boost/libs/mpl/test/quote.cpp @@ -0,0 +1,42 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +template< typename T > struct f1 +{ + typedef T type; +}; + +template< + typename T1, typename T2, typename T3, typename T4, typename T5 + > +struct f5 +{ +#if !defined(BOOST_MPL_CFG_NO_IMPLICIT_METAFUNCTIONS) + // no 'type' member! +#else + typedef f5 type; +#endif +}; + +MPL_TEST_CASE() +{ + typedef quote1::apply::type t1; + typedef quote5::apply::type t5; + + MPL_ASSERT(( boost::is_same< t1, int > )); + MPL_ASSERT(( boost::is_same< t5, f5 > )); +} diff --git a/src/boost/libs/mpl/test/range_c.cpp b/src/boost/libs/mpl/test/range_c.cpp new file mode 100644 index 00000000..90c32cc4 --- /dev/null +++ b/src/boost/libs/mpl/test/range_c.cpp @@ -0,0 +1,60 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef range_c range0; + typedef range_c range1; + typedef range_c range10; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 10 ); + + MPL_ASSERT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + + MPL_ASSERT(( is_same< begin::type, end::type > )); + MPL_ASSERT_NOT(( is_same::type, end::type > )); + MPL_ASSERT_NOT(( is_same::type, end::type > )); + + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( back::type::value, ==, 0 ); + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( back::type::value, ==, 9 ); +} + +MPL_TEST_CASE() +{ + typedef range_c r; + typedef begin::type first; + typedef end::type last; + + MPL_ASSERT(( is_same< advance_c::type, last > )); + MPL_ASSERT(( is_same< advance_c::type, first > )); + + MPL_ASSERT_RELATION( ( mpl::distance::value ), ==, 10 ); + + typedef advance_c::type iter; + MPL_ASSERT_RELATION( deref::type::value, ==, 5 ); +} diff --git a/src/boost/libs/mpl/test/remove.cpp b/src/boost/libs/mpl/test/remove.cpp new file mode 100644 index 00000000..6147b08d --- /dev/null +++ b/src/boost/libs/mpl/test/remove.cpp @@ -0,0 +1,28 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef vector6 types; + typedef mpl::remove< types,float >::type result; + typedef vector3 answer; + MPL_ASSERT(( equal< result,answer > )); +} diff --git a/src/boost/libs/mpl/test/remove_if.cpp b/src/boost/libs/mpl/test/remove_if.cpp new file mode 100644 index 00000000..bf9d0eae --- /dev/null +++ b/src/boost/libs/mpl/test/remove_if.cpp @@ -0,0 +1,54 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list10_c numbers; + typedef list5_c::type answer; + typedef remove_if< + numbers + , greater<_,int_<4> > + , mpl::front_inserter< list0_c > + >::type result; + + MPL_ASSERT_RELATION( size::value, ==, 5 ); + MPL_ASSERT(( equal )); +} + +MPL_TEST_CASE() +{ + typedef list8 types; + typedef list4::type answer; + typedef reverse_remove_if< + types + , is_float<_> + , mpl::front_inserter< list0<> > + >::type result; + + MPL_ASSERT_RELATION( size::value, ==, 4 ); + MPL_ASSERT(( equal )); +} diff --git a/src/boost/libs/mpl/test/replace.cpp b/src/boost/libs/mpl/test/replace.cpp new file mode 100644 index 00000000..4b3005be --- /dev/null +++ b/src/boost/libs/mpl/test/replace.cpp @@ -0,0 +1,27 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list types; + typedef replace< types,float,double >::type result; + typedef list answer; + MPL_ASSERT(( equal< result,answer > )); +} diff --git a/src/boost/libs/mpl/test/replace_if.cpp b/src/boost/libs/mpl/test/replace_if.cpp new file mode 100644 index 00000000..4fc690d9 --- /dev/null +++ b/src/boost/libs/mpl/test/replace_if.cpp @@ -0,0 +1,33 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright John R. Bandela 2000-2002 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list8_c::type numbers; + typedef replace_if< numbers, greater<_1,int_<4> >, int_<0> >::type result; + + typedef list8_c::type answer; + MPL_ASSERT(( equal< answer,result,equal_to<_1,_2> > )); +} diff --git a/src/boost/libs/mpl/test/reverse.cpp b/src/boost/libs/mpl/test/reverse.cpp new file mode 100644 index 00000000..69b4a432 --- /dev/null +++ b/src/boost/libs/mpl/test/reverse.cpp @@ -0,0 +1,32 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list_c numbers; + typedef reverse< numbers >::type result; + + typedef range_c answer; + + MPL_ASSERT(( equal< result,answer,equal_to<_1,_2> > )); +} diff --git a/src/boost/libs/mpl/test/same_as.cpp b/src/boost/libs/mpl/test/same_as.cpp new file mode 100644 index 00000000..41a7c573 --- /dev/null +++ b/src/boost/libs/mpl/test/same_as.cpp @@ -0,0 +1,23 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + MPL_ASSERT(( apply1< same_as,int > )); + MPL_ASSERT_NOT(( apply1< same_as,long > )); +} diff --git a/src/boost/libs/mpl/test/set.cpp b/src/boost/libs/mpl/test/set.cpp new file mode 100644 index 00000000..0710b41b --- /dev/null +++ b/src/boost/libs/mpl/test/set.cpp @@ -0,0 +1,347 @@ + +// Copyright Aleksey Gurtovoy 2003-2007 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +// Use templates for testing so that GCC will show us the actual types involved + +template< typename s > +void empty_set_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT(( empty )); + + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME clear::type, set0<> > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, void_ > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, void_ > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, void_ > )); + + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + typedef BOOST_DEDUCED_TYPENAME order::type o1; + typedef BOOST_DEDUCED_TYPENAME order::type o2; + typedef BOOST_DEDUCED_TYPENAME order::type o3; + MPL_ASSERT(( is_same< o1, void_ > )); + MPL_ASSERT(( is_same< o2, void_ > )); + MPL_ASSERT(( is_same< o3, void_ > )); + + typedef BOOST_DEDUCED_TYPENAME begin::type first; + typedef BOOST_DEDUCED_TYPENAME end::type last; + + MPL_ASSERT(( is_same )); + MPL_ASSERT_RELATION( (distance::value), ==, 0 ); +} + + +template< typename s > +void int_set_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_NOT(( empty )); + + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME clear::type, set0<> > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, int > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, void_ > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, void_ > )); + + MPL_ASSERT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + typedef BOOST_DEDUCED_TYPENAME order::type o1; + typedef BOOST_DEDUCED_TYPENAME order::type o2; + typedef BOOST_DEDUCED_TYPENAME order::type o3; + MPL_ASSERT_NOT(( is_same< o1, void_ > )); + MPL_ASSERT(( is_same< o2, void_ > )); + MPL_ASSERT(( is_same< o3, void_ > )); + + typedef BOOST_DEDUCED_TYPENAME begin::type first; + typedef BOOST_DEDUCED_TYPENAME end::type last; + + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME deref::type, int > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME next::type, last > )); + + MPL_ASSERT_RELATION( (distance::value), ==, 1 ); + MPL_ASSERT(( contains< s, int > )); +} + + +template< typename s > +void int_char_set_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME clear::type, set0<> > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, int > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, char > )); + + MPL_ASSERT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + typedef BOOST_DEDUCED_TYPENAME order::type o1; + typedef BOOST_DEDUCED_TYPENAME order::type o2; + typedef BOOST_DEDUCED_TYPENAME order::type o3; + MPL_ASSERT_NOT(( is_same< o1, void_ > )); + MPL_ASSERT_NOT(( is_same< o2, void_ > )); + MPL_ASSERT(( is_same< o3, void_ > )); + MPL_ASSERT_NOT(( is_same< o1, o2 > )); + + typedef BOOST_DEDUCED_TYPENAME begin::type first; + typedef BOOST_DEDUCED_TYPENAME end::type last; + + MPL_ASSERT_RELATION( (distance::value), ==, 2 ); + + MPL_ASSERT(( contains< s, int > )); + MPL_ASSERT(( contains< s, char > )); +} + +template< typename s > +void int_char_long_set_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 3 ); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME clear::type, set0<> > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, int > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, char > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME at::type, long > )); + + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + + typedef BOOST_DEDUCED_TYPENAME order::type o1; + typedef BOOST_DEDUCED_TYPENAME order::type o2; + typedef BOOST_DEDUCED_TYPENAME order::type o3; + MPL_ASSERT_NOT(( is_same< o1, void_ > )); + MPL_ASSERT_NOT(( is_same< o2, void_ > )); + MPL_ASSERT_NOT(( is_same< o3, void_ > )); + MPL_ASSERT_NOT(( is_same< o1, o2 > )); + MPL_ASSERT_NOT(( is_same< o1, o3 > )); + MPL_ASSERT_NOT(( is_same< o2, o3 > )); + + typedef BOOST_DEDUCED_TYPENAME begin::type first; + typedef BOOST_DEDUCED_TYPENAME end::type last; + MPL_ASSERT_RELATION( (distance::value), ==, 3 ); + + MPL_ASSERT(( contains< s, int > )); + MPL_ASSERT(( contains< s, char > )); + MPL_ASSERT(( contains< s, long > )); +} + +template< typename S0, typename S1, typename S2, typename S3 > +void basic_set_test() +{ + empty_set_test(); + empty_set_test< BOOST_DEDUCED_TYPENAME erase_key::type >(); + empty_set_test< BOOST_DEDUCED_TYPENAME erase_key< + BOOST_DEDUCED_TYPENAME erase_key::type + , int + >::type >(); + + empty_set_test< BOOST_DEDUCED_TYPENAME erase_key< + BOOST_DEDUCED_TYPENAME erase_key< + BOOST_DEDUCED_TYPENAME erase_key::type + , long + >::type + , int + >::type >(); + + + int_set_test(); + int_set_test< BOOST_DEDUCED_TYPENAME insert::type >(); + + int_set_test< BOOST_DEDUCED_TYPENAME erase_key::type >(); + int_set_test< BOOST_DEDUCED_TYPENAME erase_key< + BOOST_DEDUCED_TYPENAME erase_key::type + , long + >::type >(); + + int_char_set_test(); + int_char_set_test< BOOST_DEDUCED_TYPENAME insert< + BOOST_DEDUCED_TYPENAME insert::type + , int + >::type >(); + + int_char_set_test< BOOST_DEDUCED_TYPENAME insert::type >(); + int_char_set_test< BOOST_DEDUCED_TYPENAME erase_key::type >(); + + int_char_long_set_test(); + int_char_long_set_test< BOOST_DEDUCED_TYPENAME insert< + BOOST_DEDUCED_TYPENAME insert< + BOOST_DEDUCED_TYPENAME insert::type + , long + >::type + , int + >::type >(); + + int_char_long_set_test< BOOST_DEDUCED_TYPENAME insert< + BOOST_DEDUCED_TYPENAME insert::type + , char + >::type >(); + + int_char_long_set_test< BOOST_DEDUCED_TYPENAME insert::type >(); +} + + +template< typename S1, typename S2 > +void numbered_vs_variadic_set_test() +{ + MPL_ASSERT(( is_same< S1, BOOST_DEDUCED_TYPENAME S1::type > )); + MPL_ASSERT(( is_same< BOOST_DEDUCED_TYPENAME S2::type, S1 > )); +} + + +MPL_TEST_CASE() +{ + typedef mpl::set0<> s01; + typedef mpl::set<> s02; + typedef mpl::set1 s11; + typedef mpl::set s12; + typedef mpl::set2 s21; + typedef mpl::set s22; + typedef mpl::set s23; + typedef mpl::set3 s31; + typedef mpl::set s32; + typedef mpl::set s33; + typedef mpl::set s34; + + numbered_vs_variadic_set_test(); + numbered_vs_variadic_set_test(); + numbered_vs_variadic_set_test(); + numbered_vs_variadic_set_test(); + + basic_set_test(); + basic_set_test(); + basic_set_test(); + basic_set_test(); + basic_set_test(); +} + + +template< typename s > +void empty_set_types_variety_test() +{ + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); +} + +template< typename s > +void set_types_variety_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 8 ); + + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + MPL_ASSERT(( has_key )); + + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); + MPL_ASSERT_NOT(( has_key )); +} + + +MPL_TEST_CASE() +{ + empty_set_types_variety_test< set<> >(); + empty_set_types_variety_test< set<>::type >(); + + typedef set< + char,int const,long*,UDT* const,incomplete,abstract + , incomplete volatile&,abstract const& + > s; + + set_types_variety_test(); + set_types_variety_test(); +} + + +template +void find_test() +{ + MPL_ASSERT_RELATION( size::value, ==, 3 ); + + typedef typename end::type not_found; + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT_NOT(( is_same::type,not_found> )); + BOOST_MPL_ASSERT(( is_same::type,not_found> )); +} + +MPL_TEST_CASE() +{ + typedef mpl::set s; + find_test(); + find_test(); +} + +MPL_TEST_CASE() +{ + typedef insert< set<>, int >::type little_set; + + MPL_ASSERT_RELATION(size::value, ==, 1); + MPL_ASSERT_RELATION(size::value, ==, 1); +} + +MPL_TEST_CASE() +{ + typedef erase_key< set< float, int >, float >::type little_set; + + MPL_ASSERT_RELATION(size::value, ==, 1); + MPL_ASSERT_RELATION(size::value, ==, 1); +} diff --git a/src/boost/libs/mpl/test/set_c.cpp b/src/boost/libs/mpl/test/set_c.cpp new file mode 100644 index 00000000..e34d86de --- /dev/null +++ b/src/boost/libs/mpl/test/set_c.cpp @@ -0,0 +1,106 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include + +namespace test { namespace { +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +template< typename S, typename S::value_type k > +struct at_c + : at< S, integral_c >::type +{ +}; +#else +template< typename S, long k > +struct at_c + : aux::msvc_eti_base< + at< S, integral_c > + > +{ +}; +#endif +}} + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +MPL_TEST_CASE() +{ + typedef set_c::type s1; + typedef set_c::type s2; + typedef set_c::type s3; + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + + MPL_ASSERT(( is_same< s1::value_type, bool > )); + MPL_ASSERT(( is_same< s3::value_type, bool > )); + MPL_ASSERT(( is_same< s2::value_type, bool > )); + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, true ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, false ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, true ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, false ); + + MPL_ASSERT(( is_same< test::at_c::type, void_ > )); + MPL_ASSERT(( is_same< test::at_c::type, void_ > )); +#endif + + typedef begin::type first1; + typedef end::type last1; + MPL_ASSERT_RELATION( (distance::value), ==, 1 ); + + typedef begin::type first2; + typedef end::type last2; + MPL_ASSERT_RELATION( (distance::value), ==, 1 ); + + typedef begin::type first3; + typedef end::type last3; + MPL_ASSERT_RELATION( (distance::value), ==, 2 ); +} +#endif + +MPL_TEST_CASE() +{ + typedef set_c::type s1; + typedef set_c::type s2; + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 8 ); + + MPL_ASSERT(( is_same< s1::value_type, char > )); + MPL_ASSERT(( is_same< s2::value_type, char > )); + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'a' ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'a' ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'd' ); + MPL_ASSERT_RELATION( ( test::at_c::value ), ==, 'h' ); + + MPL_ASSERT(( is_same< test::at_c::type, void_ > )); + MPL_ASSERT(( is_same< test::at_c::type, void_ > )); +#endif + + typedef begin::type first1; + typedef end::type last1; + MPL_ASSERT_RELATION( (distance::value), ==, 1 ); + + typedef begin::type first2; + typedef end::type last2; + MPL_ASSERT_RELATION( (distance::value), ==, 8 ); +} diff --git a/src/boost/libs/mpl/test/single_view.cpp b/src/boost/libs/mpl/test/single_view.cpp new file mode 100644 index 00000000..18169d35 --- /dev/null +++ b/src/boost/libs/mpl/test/single_view.cpp @@ -0,0 +1,43 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef single_view view; + typedef begin::type first; + typedef end::type last; + + MPL_ASSERT(( is_same< deref::type, int > )); + MPL_ASSERT(( is_same< next::type, last > )); + MPL_ASSERT(( is_same< prior::type, first > )); + + MPL_ASSERT(( is_same< mpl::advance >::type, first > )); + MPL_ASSERT(( is_same< mpl::advance >::type, last > )); + MPL_ASSERT(( is_same< mpl::advance >::type, last > )); + MPL_ASSERT(( is_same< mpl::advance >::type, first > )); + + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 0 ); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 1 ); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 0 ); + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + + MPL_ASSERT(( equal< view, view::type > )); +} diff --git a/src/boost/libs/mpl/test/size.cpp b/src/boost/libs/mpl/test/size.cpp new file mode 100644 index 00000000..0c80711e --- /dev/null +++ b/src/boost/libs/mpl/test/size.cpp @@ -0,0 +1,26 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef list<> empty_list; + typedef list list; + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 4 ); +} diff --git a/src/boost/libs/mpl/test/size_t.cpp b/src/boost/libs/mpl/test/size_t.cpp new file mode 100644 index 00000000..c53194ba --- /dev/null +++ b/src/boost/libs/mpl/test/size_t.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +// Necessary to overcome a strange name lookup bug in GCC 3.3 and 4.0 for Mac OS X +#if defined(__APPLE_CC__) && defined(__GNUC__) && (__GNUC__ <= 4) +# include +#endif + +#include +#include +#include + +#include "integral_wrapper_test.hpp" + +MPL_TEST_CASE() +{ +# define WRAPPER(T, i) mpl::size_t + BOOST_PP_REPEAT_FROM_TO(1, 11, INTEGRAL_WRAPPER_TEST, std::size_t) +} diff --git a/src/boost/libs/mpl/test/sizeof.cpp b/src/boost/libs/mpl/test/sizeof.cpp new file mode 100644 index 00000000..21c0ce02 --- /dev/null +++ b/src/boost/libs/mpl/test/sizeof.cpp @@ -0,0 +1,28 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License,Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include + +struct my +{ + char a[100]; +}; + +MPL_TEST_CASE() +{ + MPL_ASSERT_RELATION( sizeof_::value, ==, sizeof(char) ); + MPL_ASSERT_RELATION( sizeof_::value, ==, sizeof(int) ); + MPL_ASSERT_RELATION( sizeof_::value, ==, sizeof(double) ); + MPL_ASSERT_RELATION( sizeof_::value, ==, sizeof(my) ); +} diff --git a/src/boost/libs/mpl/test/sort.cpp b/src/boost/libs/mpl/test/sort.cpp new file mode 100644 index 00000000..e461f703 --- /dev/null +++ b/src/boost/libs/mpl/test/sort.cpp @@ -0,0 +1,27 @@ + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Eric Friedman 2002-2003 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +#include + +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list_c::type numbers; + typedef list_c::type manual_result; + + typedef sort< numbers >::type result; + + MPL_ASSERT(( equal< result,manual_result,equal_to<_1,_2> > )); +} diff --git a/src/boost/libs/mpl/test/stable_partition.cpp b/src/boost/libs/mpl/test/stable_partition.cpp new file mode 100644 index 00000000..e72d453a --- /dev/null +++ b/src/boost/libs/mpl/test/stable_partition.cpp @@ -0,0 +1,47 @@ + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Eric Friedman 2003 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +typedef vector_c::type numbers; +typedef vector_c::type manual_first; +typedef vector_c::type manual_second; + +MPL_TEST_CASE() +{ + typedef stable_partition< + numbers + , less< _, int_<3> > + >::type result; + + MPL_ASSERT(( equal< result::first,manual_first > )); + MPL_ASSERT(( equal< result::second,manual_second > )); +} + +MPL_TEST_CASE() +{ + typedef stable_partition< + numbers + , greater_equal< _, int_<3> > + >::type result; + + MPL_ASSERT(( equal< result::first,manual_second > )); + MPL_ASSERT(( equal< result::second,manual_first > )); +} diff --git a/src/boost/libs/mpl/test/string.cpp b/src/boost/libs/mpl/test/string.cpp new file mode 100644 index 00000000..57b5979d --- /dev/null +++ b/src/boost/libs/mpl/test/string.cpp @@ -0,0 +1,516 @@ + +// Copyright Eric Niebler 2009 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: string.cpp 49240 2009-04-01 09:21:07Z eric_niebler $ +// $Date: 2009-04-01 02:21:07 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49240 $ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace mpl = boost::mpl; + +// Accept a string as a template parameter! +template +struct greeting +{ + std::string say_hello() const + { + return sz; + } +}; + +struct push_char +{ + push_char(std::string &str) + : str_(&str) + {} + + void operator()(char ch) const + { + this->str_->push_back(ch); + } + + std::string *str_; +}; + +int main() +{ + // Test mpl::size of strings + { + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> almost_full; + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa'> full; + + BOOST_MPL_ASSERT_RELATION(0, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(1, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(2, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(2, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(4, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(5, ==, (mpl::size >::value)); + BOOST_MPL_ASSERT_RELATION(31, ==, (mpl::size::value)); + BOOST_MPL_ASSERT_RELATION(32, ==, (mpl::size::value)); + } + + // Test mpl::begin and mpl::end with strings + { + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> almost_full; + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa'> full; + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::begin >::type + , mpl::end >::type + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::begin >::type + , mpl::string_iterator, 0, 0> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::end >::type + , mpl::string_iterator, 1, 0> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::begin::type + , mpl::string_iterator + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::end::type + , mpl::string_iterator + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::begin::type + , mpl::string_iterator + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::end::type + , mpl::string_iterator + > + )); + } + + // testing push_back + { + typedef mpl::push_back, mpl::char_<'a'> >::type t1; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t2; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t3; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t4; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t5; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> almost_full; + typedef mpl::push_back >::type t6; + BOOST_MPL_ASSERT((boost::is_same >)); + } + + // Test mpl::next + { + typedef mpl::string<'a','bc','def','ghij'> s; + + typedef mpl::begin::type i0; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i1; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i2; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i3; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i4; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i5; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i6; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i7; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i8; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i9; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::next::type i10; + BOOST_MPL_ASSERT((boost::is_same >)); + + BOOST_MPL_ASSERT((boost::is_same::type>)); + } + + // Test mpl::prior + { + typedef mpl::string<'a','bc','def','ghij'> s; + + typedef mpl::end::type i10; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i9; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i8; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i7; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i6; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i5; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i4; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i3; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i2; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i1; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::prior::type i0; + BOOST_MPL_ASSERT((boost::is_same >)); + + BOOST_MPL_ASSERT((boost::is_same::type>)); + } + + // Test mpl::deref + { + typedef mpl::string<'a','bc','def','ghij'> s; + + typedef mpl::begin::type i0; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'a'> >)); + + typedef mpl::next::type i1; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'b'> >)); + + typedef mpl::next::type i2; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'c'> >)); + + typedef mpl::next::type i3; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'d'> >)); + + typedef mpl::next::type i4; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'e'> >)); + + typedef mpl::next::type i5; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'f'> >)); + + typedef mpl::next::type i6; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'g'> >)); + + typedef mpl::next::type i7; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'h'> >)); + + typedef mpl::next::type i8; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'i'> >)); + + typedef mpl::next::type i9; + BOOST_MPL_ASSERT((boost::is_same::type, mpl::char_<'j'> >)); + } + + // testing push_back + { + typedef mpl::push_back, mpl::char_<'a'> >::type t1; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t2; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t3; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t4; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_back >::type t5; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> almost_full; + typedef mpl::push_back >::type t6; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'a','a','a','a','a','a','a','aaaa'> must_repack; + typedef mpl::push_back >::type t7; + BOOST_MPL_ASSERT((boost::is_same >)); + } + + BOOST_MPL_ASSERT((mpl::empty >)); + BOOST_MPL_ASSERT_NOT((mpl::empty >)); + + // testing push_front + { + typedef mpl::push_front, mpl::char_<'a'> >::type t1; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_front >::type t2; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_front >::type t3; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_front >::type t4; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::push_front >::type t5; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'aaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa'> almost_full; + typedef mpl::push_front >::type t6; + BOOST_MPL_ASSERT((boost::is_same >)); + + typedef mpl::string<'aaaa','a','a','a','a','a','a','a'> must_repack; + typedef mpl::push_front >::type t7; + BOOST_MPL_ASSERT((boost::is_same >)); + } + + // Test c_str<> + BOOST_TEST(0 == std::strcmp( + mpl::c_str >::value + , "" + )); + + BOOST_TEST(0 == std::strcmp( + mpl::c_str >::value + , "Hell" "o wo" "rld!" + )); + + BOOST_TEST(0 == std::strcmp( + mpl::c_str >::value + , "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaa" "aaaX" + )); + + // test using a string as a template parameter + greeting >::value> g; + BOOST_TEST("Hello world!" == g.say_hello()); + + std::string result; + mpl::for_each >(push_char(result)); + BOOST_TEST("Hello world!" == result); + + BOOST_TEST(('h' == mpl::front >::type())); + BOOST_TEST(('!' == mpl::back >::type())); + + // back-inserter with copy + typedef mpl::vector_c rgc; + BOOST_TEST(0 == std::strcmp("abcde", mpl::c_str::value)); + typedef mpl::copy > >::type str; + BOOST_TEST(0 == std::strcmp("abcde", mpl::c_str::value)); + + // test insert_range and erase + { + typedef mpl::string<'Hell','o wo','rld!'> hello; + typedef mpl::advance_c::type, 5>::type where; + typedef mpl::string<' cru','el'> cruel; + typedef mpl::insert_range::type hello_cruel; + BOOST_TEST(0 == std::strcmp("Hello cruel world!", mpl::c_str::value)); + + typedef mpl::erase::type, where>::type erased1; + BOOST_TEST(0 == std::strcmp(" world!", mpl::c_str::value)); + } + + // test pop_front + { + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'b'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'bc'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'bcd'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'bcd','e'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'e'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_front >::type + , mpl::string<'aaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa'> + > + )); + } + + // test pop_back + { + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'a'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'ab'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'abc'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'abcd'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'d'> + > + )); + + BOOST_MPL_ASSERT(( + boost::is_same< + mpl::pop_back >::type + , mpl::string<'aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaaa','aaa'> + > + )); + } + + { + BOOST_TEST(( + mpl::at_c< + mpl::string<'\x7f'> + , 0 + >::type::value == (char)0x7f + )); + + BOOST_TEST(( + mpl::at_c< + mpl::string<'\x80'> + , 0 + >::type::value == (char)0x80 + )); + + BOOST_TEST(( + mpl::at_c< + mpl::string< + mpl::at_c< + mpl::string<'\x7f'> + , 0 + >::type::value + > + , 0 + >::type::value == (char)0x7f + )); + + BOOST_TEST(( + mpl::at_c< + mpl::string< + mpl::at_c< + mpl::string<'\x80'> + , 0 + >::type::value + > + , 0 + >::type::value == (char)0x80 + )); + } + + return boost::report_errors(); +} diff --git a/src/boost/libs/mpl/test/transform.cpp b/src/boost/libs/mpl/test/transform.cpp new file mode 100644 index 00000000..8df17f20 --- /dev/null +++ b/src/boost/libs/mpl/test/transform.cpp @@ -0,0 +1,51 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef list types; + typedef list pointers; + + typedef transform1< types,add_pointer<_1> >::type result; + MPL_ASSERT(( equal )); +} + +MPL_TEST_CASE() +{ + typedef list_c evens; + typedef list_c primes; + typedef list_c sums; + + typedef transform2< evens, primes, plus<> >::type result; + MPL_ASSERT(( equal< result,sums,equal_to<_1,_2> > )); + +#if !defined(BOOST_MPL_CFG_NO_HAS_XXX) + typedef transform< evens, primes, plus<> >::type result2; + MPL_ASSERT(( is_same )); +#endif +} diff --git a/src/boost/libs/mpl/test/transform_view.cpp b/src/boost/libs/mpl/test/transform_view.cpp new file mode 100644 index 00000000..ff8fe6b5 --- /dev/null +++ b/src/boost/libs/mpl/test/transform_view.cpp @@ -0,0 +1,40 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list types; + typedef list< + sizeof_::type, + sizeof_::type, + sizeof_::type, + sizeof_::type, + sizeof_::type + > sizes; + + MPL_ASSERT(( equal< transform_view< types, sizeof_<_> >::type,sizes > )); + + typedef max_element< + transform_view< types, sizeof_<_> > + >::type iter; + + MPL_ASSERT_RELATION( deref::type::value, ==, 50 ); +} diff --git a/src/boost/libs/mpl/test/unique.cpp b/src/boost/libs/mpl/test/unique.cpp new file mode 100644 index 00000000..2e1baa71 --- /dev/null +++ b/src/boost/libs/mpl/test/unique.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include + +#include + +MPL_TEST_CASE() +{ + typedef list types; + typedef unique< types, is_same<_1,_2> >::type result; + + typedef list::type answer; + MPL_ASSERT(( equal< result,answer > )); +} diff --git a/src/boost/libs/mpl/test/unpack_args.cpp b/src/boost/libs/mpl/test/unpack_args.cpp new file mode 100644 index 00000000..d506535e --- /dev/null +++ b/src/boost/libs/mpl/test/unpack_args.cpp @@ -0,0 +1,26 @@ + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include + +MPL_TEST_CASE() +{ + MPL_ASSERT(( apply1< + unpack_args< is_same<_1,_2> > + , vector2 + > )); +} diff --git a/src/boost/libs/mpl/test/upper_bound.cpp b/src/boost/libs/mpl/test/upper_bound.cpp new file mode 100644 index 00000000..7d6ea3bb --- /dev/null +++ b/src/boost/libs/mpl/test/upper_bound.cpp @@ -0,0 +1,29 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include + +MPL_TEST_CASE() +{ + typedef list_c numbers; + typedef upper_bound< numbers, int_<3> >::type iter; + + MPL_ASSERT_RELATION( (mpl::distance< begin::type,iter >::value), ==, 5 ); + MPL_ASSERT_RELATION( deref::type::value, ==, 5 ); +} diff --git a/src/boost/libs/mpl/test/vector.cpp b/src/boost/libs/mpl/test/vector.cpp new file mode 100644 index 00000000..e1f6e0cb --- /dev/null +++ b/src/boost/libs/mpl/test/vector.cpp @@ -0,0 +1,124 @@ + +// Copyright Aleksey Gurtovoy 2000-2005 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +MPL_TEST_CASE() +{ + typedef vector0<> v0; + typedef vector1 v1; + typedef vector2 v2; + typedef vector9 v9; + + MPL_ASSERT(( equal< v0,v0::type > )); + MPL_ASSERT(( equal< v1,v1::type > )); + MPL_ASSERT(( equal< v2,v2::type > )); + MPL_ASSERT(( equal< v9,v9::type > )); + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 9 ); + + MPL_ASSERT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + MPL_ASSERT_NOT(( empty )); + + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,char > )); + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,long > )); + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,int > )); +} + + +MPL_TEST_CASE() +{ + typedef vector2 v2; + + typedef begin::type i1; + typedef next::type i2; + typedef next::type i3; + + MPL_ASSERT(( is_same::type,char> )); + MPL_ASSERT(( is_same::type,long> )); + MPL_ASSERT(( is_same< i3, end::type > )); +} + +MPL_TEST_CASE() +{ + typedef vector0<> v0; + + typedef push_back::type v1; + typedef push_front::type v2; + typedef push_back::type v3; + + MPL_ASSERT(( is_same< back::type,int > )); + MPL_ASSERT(( is_same< back::type,int > )); + MPL_ASSERT(( is_same< front::type,char > )); + MPL_ASSERT(( is_same< back::type,long > )); + + MPL_ASSERT(( equal< v1,v1::type > )); + MPL_ASSERT(( equal< v2,v2::type > )); + MPL_ASSERT(( equal< v3,v3::type > )); +} + +MPL_TEST_CASE() +{ + typedef vector9 v9; + + typedef pop_back::type v8; + typedef pop_front::type v7; + + MPL_ASSERT(( is_same< back::type,int > )); + MPL_ASSERT(( is_same< back::type,long > )); + MPL_ASSERT(( is_same< back::type,long > )); + MPL_ASSERT(( is_same< front::type,bool > )); + + MPL_ASSERT(( equal< v9,v9::type > )); + MPL_ASSERT(( equal< v8,v8::type > )); + MPL_ASSERT(( equal< v7,v7::type > )); +} + +MPL_TEST_CASE() +{ + typedef vector<> v0; + typedef vector v1; + typedef vector v2; + typedef vector v9; + + MPL_ASSERT(( equal< v0,v0::type > )); + MPL_ASSERT(( equal< v1,v1::type > )); + MPL_ASSERT(( equal< v2,v2::type > )); + MPL_ASSERT(( equal< v9,v9::type > )); + + MPL_ASSERT_RELATION( size::value, ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 9 ); +} diff --git a/src/boost/libs/mpl/test/vector_c.cpp b/src/boost/libs/mpl/test/vector_c.cpp new file mode 100644 index 00000000..fbff9ea3 --- /dev/null +++ b/src/boost/libs/mpl/test/vector_c.cpp @@ -0,0 +1,66 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include + +#include + +#if !BOOST_WORKAROUND(BOOST_MSVC, <=1200) +MPL_TEST_CASE() +{ + typedef vector_c::type v1; + typedef vector_c::type v2; + + MPL_ASSERT(( is_same< v1::value_type, bool > )); + MPL_ASSERT(( is_same< v2::value_type, bool > )); + + MPL_ASSERT_RELATION( front::type::value, ==, true ); + MPL_ASSERT_RELATION( front::type::value, ==, false ); +} +#endif + +MPL_TEST_CASE() +{ + typedef vector_c v1; + typedef vector_c v2; + typedef vector_c v3; + + MPL_ASSERT(( is_same< v1::value_type, int > )); + MPL_ASSERT(( is_same< v2::value_type, int > )); + MPL_ASSERT(( is_same< v3::value_type, int > )); + + MPL_ASSERT_RELATION( size::value, ==, 1 ); + MPL_ASSERT_RELATION( size::value, ==, 2 ); + MPL_ASSERT_RELATION( size::value, ==, 3 ); + + MPL_ASSERT_RELATION( front::type::value, ==, -1 ); + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( front::type::value, ==, 1 ); +} + +MPL_TEST_CASE() +{ + typedef vector_c v1; + typedef vector_c v2; + + MPL_ASSERT(( is_same< v1::value_type, unsigned > )); + MPL_ASSERT(( is_same< v2::value_type, unsigned > )); + + MPL_ASSERT_RELATION( size::type::value, ==, 1 ); + MPL_ASSERT_RELATION( size::type::value, ==, 2 ); + + MPL_ASSERT_RELATION( front::type::value, ==, 0 ); + MPL_ASSERT_RELATION( front::type::value, ==, 1 ); +} diff --git a/src/boost/libs/mpl/test/zip_view.cpp b/src/boost/libs/mpl/test/zip_view.cpp new file mode 100644 index 00000000..a8d9b03c --- /dev/null +++ b/src/boost/libs/mpl/test/zip_view.cpp @@ -0,0 +1,45 @@ + +// Copyright Aleksey Gurtovoy 2002-2010 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + + +MPL_TEST_CASE() +{ + typedef transform_view< + zip_view< vector< range_c, range_c > > + , unpack_args< plus<> > + > result; + + MPL_ASSERT(( equal< + result + , filter_view< range_c, is_even<_> > + , equal_to<_,_> + > )); + + MPL_ASSERT(( boost::is_same< zip_view >, zip_view >::type > )); +} -- cgit v1.2.3