summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/fusion
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/fusion')
-rw-r--r--src/boost/libs/fusion/CMakeLists.txt29
-rw-r--r--src/boost/libs/fusion/example/cookbook/do_the_bind.cpp268
-rw-r--r--src/boost/libs/fusion/example/cookbook/fill_em_up.cpp105
-rw-r--r--src/boost/libs/fusion/example/extension/Jamfile20
-rw-r--r--src/boost/libs/fusion/example/extension/detail/advance_impl.hpp47
-rw-r--r--src/boost/libs/fusion/example/extension/detail/at_impl.hpp67
-rw-r--r--src/boost/libs/fusion/example/extension/detail/at_key_impl.hpp72
-rw-r--r--src/boost/libs/fusion/example/extension/detail/begin_impl.hpp43
-rw-r--r--src/boost/libs/fusion/example/extension/detail/category_of_impl.hpp34
-rw-r--r--src/boost/libs/fusion/example/extension/detail/deref_data_impl.hpp30
-rw-r--r--src/boost/libs/fusion/example/extension/detail/deref_impl.hpp67
-rw-r--r--src/boost/libs/fusion/example/extension/detail/distance_impl.hpp44
-rw-r--r--src/boost/libs/fusion/example/extension/detail/end_impl.hpp43
-rw-r--r--src/boost/libs/fusion/example/extension/detail/equal_to_impl.hpp38
-rw-r--r--src/boost/libs/fusion/example/extension/detail/has_key_impl.hpp45
-rw-r--r--src/boost/libs/fusion/example/extension/detail/is_sequence_impl.hpp34
-rw-r--r--src/boost/libs/fusion/example/extension/detail/is_view_impl.hpp32
-rw-r--r--src/boost/libs/fusion/example/extension/detail/key_of_impl.hpp42
-rw-r--r--src/boost/libs/fusion/example/extension/detail/next_impl.hpp46
-rw-r--r--src/boost/libs/fusion/example/extension/detail/prior_impl.hpp46
-rw-r--r--src/boost/libs/fusion/example/extension/detail/size_impl.hpp36
-rw-r--r--src/boost/libs/fusion/example/extension/detail/value_at_impl.hpp44
-rw-r--r--src/boost/libs/fusion/example/extension/detail/value_at_key_impl.hpp50
-rw-r--r--src/boost/libs/fusion/example/extension/detail/value_of_data_impl.hpp30
-rw-r--r--src/boost/libs/fusion/example/extension/detail/value_of_impl.hpp49
-rw-r--r--src/boost/libs/fusion/example/extension/example_struct.hpp25
-rw-r--r--src/boost/libs/fusion/example/extension/example_struct_iterator.hpp70
-rw-r--r--src/boost/libs/fusion/example/extension/example_struct_type.hpp27
-rw-r--r--src/boost/libs/fusion/example/extension/tag_of.hpp30
-rw-r--r--src/boost/libs/fusion/example/extension/test_example.cpp65
-rw-r--r--src/boost/libs/fusion/example/extension/triple.cpp377
-rw-r--r--src/boost/libs/fusion/example/performance/Jamfile20
-rw-r--r--src/boost/libs/fusion/example/performance/accumulate.cpp357
-rw-r--r--src/boost/libs/fusion/example/performance/functional.cpp307
-rw-r--r--src/boost/libs/fusion/example/performance/inner_product.cpp184
-rw-r--r--src/boost/libs/fusion/example/performance/inner_product2.cpp206
-rw-r--r--src/boost/libs/fusion/example/performance/measure.hpp85
-rw-r--r--src/boost/libs/fusion/example/performance/sequence_efficiency.cpp248
-rw-r--r--src/boost/libs/fusion/example/performance/timings.txt57
-rw-r--r--src/boost/libs/fusion/example/performance/zip_efficiency.cpp155
-rw-r--r--src/boost/libs/fusion/index.html15
-rw-r--r--src/boost/libs/fusion/meta/explicit-failures-markup.xml23
-rw-r--r--src/boost/libs/fusion/meta/libraries.json20
-rw-r--r--src/boost/libs/fusion/preprocess/Jamfile.v241
-rw-r--r--src/boost/libs/fusion/preprocess/preprocess_fusion.cpp15
-rw-r--r--src/boost/libs/fusion/preprocess/wave.cfg31
-rw-r--r--src/boost/libs/fusion/test/Jamfile277
-rw-r--r--src/boost/libs/fusion/test/algorithm/all.cpp70
-rw-r--r--src/boost/libs/fusion/test/algorithm/any.cpp57
-rw-r--r--src/boost/libs/fusion/test/algorithm/clear.cpp45
-rw-r--r--src/boost/libs/fusion/test/algorithm/copy.cpp26
-rw-r--r--src/boost/libs/fusion/test/algorithm/count.cpp41
-rw-r--r--src/boost/libs/fusion/test/algorithm/count_if.cpp46
-rw-r--r--src/boost/libs/fusion/test/algorithm/erase.cpp63
-rw-r--r--src/boost/libs/fusion/test/algorithm/erase_key.cpp74
-rw-r--r--src/boost/libs/fusion/test/algorithm/filter.cpp43
-rw-r--r--src/boost/libs/fusion/test/algorithm/filter_if.cpp77
-rw-r--r--src/boost/libs/fusion/test/algorithm/find.cpp79
-rw-r--r--src/boost/libs/fusion/test/algorithm/find_if.cpp69
-rw-r--r--src/boost/libs/fusion/test/algorithm/flatten.cpp57
-rw-r--r--src/boost/libs/fusion/test/algorithm/fold.cpp257
-rw-r--r--src/boost/libs/fusion/test/algorithm/fold.hpp212
-rw-r--r--src/boost/libs/fusion/test/algorithm/for_each.cpp83
-rw-r--r--src/boost/libs/fusion/test/algorithm/insert.cpp67
-rw-r--r--src/boost/libs/fusion/test/algorithm/insert_range.cpp71
-rw-r--r--src/boost/libs/fusion/test/algorithm/iter_fold.cpp10
-rw-r--r--src/boost/libs/fusion/test/algorithm/join.cpp28
-rw-r--r--src/boost/libs/fusion/test/algorithm/move.cpp27
-rw-r--r--src/boost/libs/fusion/test/algorithm/none.cpp58
-rw-r--r--src/boost/libs/fusion/test/algorithm/pop_back.cpp105
-rw-r--r--src/boost/libs/fusion/test/algorithm/pop_front.cpp46
-rw-r--r--src/boost/libs/fusion/test/algorithm/push_back.cpp72
-rw-r--r--src/boost/libs/fusion/test/algorithm/push_front.cpp55
-rw-r--r--src/boost/libs/fusion/test/algorithm/remove.cpp80
-rw-r--r--src/boost/libs/fusion/test/algorithm/remove_if.cpp78
-rw-r--r--src/boost/libs/fusion/test/algorithm/replace.cpp49
-rw-r--r--src/boost/libs/fusion/test/algorithm/replace_if.cpp52
-rw-r--r--src/boost/libs/fusion/test/algorithm/reverse.cpp49
-rw-r--r--src/boost/libs/fusion/test/algorithm/reverse_fold.cpp10
-rw-r--r--src/boost/libs/fusion/test/algorithm/reverse_iter_fold.cpp12
-rw-r--r--src/boost/libs/fusion/test/algorithm/segmented_find.cpp62
-rw-r--r--src/boost/libs/fusion/test/algorithm/segmented_find_if.cpp65
-rw-r--r--src/boost/libs/fusion/test/algorithm/segmented_fold.cpp63
-rw-r--r--src/boost/libs/fusion/test/algorithm/segmented_for_each.cpp140
-rw-r--r--src/boost/libs/fusion/test/algorithm/ticket-5490.cpp41
-rw-r--r--src/boost/libs/fusion/test/algorithm/transform.cpp157
-rw-r--r--src/boost/libs/fusion/test/algorithm/zip.cpp30
-rw-r--r--src/boost/libs/fusion/test/algorithm/zip2.cpp30
-rw-r--r--src/boost/libs/fusion/test/algorithm/zip_ignore.cpp28
-rw-r--r--src/boost/libs/fusion/test/compile_time/Makefile29
-rw-r--r--src/boost/libs/fusion/test/compile_time/driver.hpp75
-rw-r--r--src/boost/libs/fusion/test/compile_time/fold.cpp42
-rw-r--r--src/boost/libs/fusion/test/compile_time/sfinae_friendly.hpp53
-rw-r--r--src/boost/libs/fusion/test/compile_time/transform.cpp55
-rw-r--r--src/boost/libs/fusion/test/compile_time/vector_construction.cpp28
-rw-r--r--src/boost/libs/fusion/test/compile_time/vector_intrinsic.cpp59
-rw-r--r--src/boost/libs/fusion/test/compile_time/vector_iteration.cpp38
-rw-r--r--src/boost/libs/fusion/test/functional/fused.cpp97
-rw-r--r--src/boost/libs/fusion/test/functional/fused_function_object.cpp83
-rw-r--r--src/boost/libs/fusion/test/functional/fused_procedure.cpp82
-rw-r--r--src/boost/libs/fusion/test/functional/invoke.cpp562
-rw-r--r--src/boost/libs/fusion/test/functional/invoke_function_object.cpp265
-rw-r--r--src/boost/libs/fusion/test/functional/invoke_procedure.cpp385
-rw-r--r--src/boost/libs/fusion/test/functional/make_fused.cpp85
-rw-r--r--src/boost/libs/fusion/test/functional/make_fused_function_object.cpp95
-rw-r--r--src/boost/libs/fusion/test/functional/make_fused_procedure.cpp91
-rw-r--r--src/boost/libs/fusion/test/functional/make_unfused.cpp128
-rw-r--r--src/boost/libs/fusion/test/functional/unfused.cpp119
-rw-r--r--src/boost/libs/fusion/test/functional/unfused_typed.cpp165
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_adt.cpp311
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_adt_empty.cpp87
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_adt_named.cpp161
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_adt_named_empty.cpp88
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_adt.cpp164
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_adt_empty.cpp89
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named.cpp159
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named_empty.cpp90
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_struct.cpp168
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_struct_empty.cpp89
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named.cpp139
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named_empty.cpp90
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt.cpp177
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt_empty.cpp89
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct.cpp168
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct_empty.cpp89
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_struct.cpp271
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_struct_empty.cpp87
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_struct_named.cpp164
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_struct_named_empty.cpp88
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_tpl_adt.cpp182
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_tpl_adt_empty.cpp87
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_tpl_struct.cpp159
-rw-r--r--src/boost/libs/fusion/test/sequence/adapt_tpl_struct_empty.cpp87
-rw-r--r--src/boost/libs/fusion/test/sequence/adt_attribute_proxy.cpp189
-rw-r--r--src/boost/libs/fusion/test/sequence/array.cpp41
-rw-r--r--src/boost/libs/fusion/test/sequence/as_deque.cpp70
-rw-r--r--src/boost/libs/fusion/test/sequence/as_list.cpp53
-rw-r--r--src/boost/libs/fusion/test/sequence/as_map.cpp61
-rw-r--r--src/boost/libs/fusion/test/sequence/as_map_assoc.cpp85
-rw-r--r--src/boost/libs/fusion/test/sequence/as_set.cpp64
-rw-r--r--src/boost/libs/fusion/test/sequence/as_vector.cpp54
-rw-r--r--src/boost/libs/fusion/test/sequence/back_extended_deque.cpp114
-rw-r--r--src/boost/libs/fusion/test/sequence/boost_array.cpp44
-rw-r--r--src/boost/libs/fusion/test/sequence/boost_tuple.cpp118
-rw-r--r--src/boost/libs/fusion/test/sequence/boost_tuple_iterator.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/comparison.hpp79
-rw-r--r--src/boost/libs/fusion/test/sequence/cons.cpp95
-rw-r--r--src/boost/libs/fusion/test/sequence/construction.hpp122
-rw-r--r--src/boost/libs/fusion/test/sequence/conversion.hpp322
-rw-r--r--src/boost/libs/fusion/test/sequence/convert.hpp51
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_boost_tuple.cpp14
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_deque.cpp13
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_list.cpp13
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_std_pair.cpp14
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_std_tuple.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/convert_vector.cpp13
-rw-r--r--src/boost/libs/fusion/test/sequence/copy.hpp154
-rw-r--r--src/boost/libs/fusion/test/sequence/deduce_sequence.cpp91
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_struct.cpp117
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_struct_empty.cpp78
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_struct_move.cpp67
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct.cpp121
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_empty.cpp78
-rw-r--r--src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_move.cpp78
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct.cpp130
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct_empty.cpp76
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct_inline.cpp153
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct_inline_empty.cpp76
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct_inline_move.cpp73
-rw-r--r--src/boost/libs/fusion/test/sequence/define_struct_move.cpp66
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct.cpp112
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct_empty.cpp75
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct_inline.cpp138
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_empty.cpp75
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_move.cpp73
-rw-r--r--src/boost/libs/fusion/test/sequence/define_tpl_struct_move.cpp66
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_comparison.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_construction.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_copy.cpp42
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_hash.cpp16
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_is_constructible.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_iterator.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_make.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_misc.cpp24
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_move.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_mutate.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_nest.cpp43
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_tie.cpp23
-rw-r--r--src/boost/libs/fusion/test/sequence/deque_value_at.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/filter_view.cpp129
-rw-r--r--src/boost/libs/fusion/test/sequence/fixture.hpp216
-rw-r--r--src/boost/libs/fusion/test/sequence/flatten_view.cpp56
-rw-r--r--src/boost/libs/fusion/test/sequence/front_extended_deque.cpp114
-rw-r--r--src/boost/libs/fusion/test/sequence/github-159.cpp16
-rw-r--r--src/boost/libs/fusion/test/sequence/github-176.cpp90
-rw-r--r--src/boost/libs/fusion/test/sequence/hash.cpp59
-rw-r--r--src/boost/libs/fusion/test/sequence/hash.hpp35
-rw-r--r--src/boost/libs/fusion/test/sequence/io.cpp131
-rw-r--r--src/boost/libs/fusion/test/sequence/iterator.hpp200
-rw-r--r--src/boost/libs/fusion/test/sequence/iterator_range.cpp115
-rw-r--r--src/boost/libs/fusion/test/sequence/joint_view.cpp188
-rw-r--r--src/boost/libs/fusion/test/sequence/list_comparison.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/list_construction.cpp18
-rw-r--r--src/boost/libs/fusion/test/sequence/list_copy.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/list_hash.cpp16
-rw-r--r--src/boost/libs/fusion/test/sequence/list_iterator.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/list_make.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/list_misc.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/list_mutate.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/list_nest.cpp36
-rw-r--r--src/boost/libs/fusion/test/sequence/list_tie.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/list_value_at.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/make.hpp88
-rw-r--r--src/boost/libs/fusion/test/sequence/make_list.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/make_vector.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/map.cpp181
-rw-r--r--src/boost/libs/fusion/test/sequence/map_comparison.cpp68
-rw-r--r--src/boost/libs/fusion/test/sequence/map_construction.cpp134
-rw-r--r--src/boost/libs/fusion/test/sequence/map_copy.cpp90
-rw-r--r--src/boost/libs/fusion/test/sequence/map_misc.cpp179
-rw-r--r--src/boost/libs/fusion/test/sequence/map_move.cpp28
-rw-r--r--src/boost/libs/fusion/test/sequence/map_mutate.cpp69
-rw-r--r--src/boost/libs/fusion/test/sequence/map_tie.cpp35
-rw-r--r--src/boost/libs/fusion/test/sequence/misc.hpp204
-rw-r--r--src/boost/libs/fusion/test/sequence/move.hpp120
-rw-r--r--src/boost/libs/fusion/test/sequence/mutate.hpp52
-rw-r--r--src/boost/libs/fusion/test/sequence/nest.hpp321
-rw-r--r--src/boost/libs/fusion/test/sequence/nil.cpp25
-rw-r--r--src/boost/libs/fusion/test/sequence/nview.cpp139
-rw-r--r--src/boost/libs/fusion/test/sequence/ref_vector.cpp64
-rw-r--r--src/boost/libs/fusion/test/sequence/repetitive_view.cpp53
-rw-r--r--src/boost/libs/fusion/test/sequence/reverse_view.cpp109
-rw-r--r--src/boost/libs/fusion/test/sequence/segmented_iterator_range.cpp146
-rw-r--r--src/boost/libs/fusion/test/sequence/set.cpp110
-rw-r--r--src/boost/libs/fusion/test/sequence/single_view.cpp93
-rw-r--r--src/boost/libs/fusion/test/sequence/size.cpp103
-rw-r--r--src/boost/libs/fusion/test/sequence/std_array.cpp51
-rw-r--r--src/boost/libs/fusion/test/sequence/std_pair.cpp100
-rw-r--r--src/boost/libs/fusion/test/sequence/std_tuple.cpp37
-rw-r--r--src/boost/libs/fusion/test/sequence/std_tuple_iterator.cpp26
-rw-r--r--src/boost/libs/fusion/test/sequence/swap.cpp35
-rw-r--r--src/boost/libs/fusion/test/sequence/test_deduce_sequence.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/tie.hpp85
-rw-r--r--src/boost/libs/fusion/test/sequence/traits.hpp253
-rw-r--r--src/boost/libs/fusion/test/sequence/transform_view.cpp115
-rw-r--r--src/boost/libs/fusion/test/sequence/tree.hpp100
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_comparison.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_construction.cpp49
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_conversion.cpp51
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_copy.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_element.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_hash.cpp16
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_make.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_misc.cpp23
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_mutate.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_nest.cpp35
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_tie.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/tuple_traits.cpp89
-rw-r--r--src/boost/libs/fusion/test/sequence/value_at.hpp100
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_comparison.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_construction.cpp18
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_conversion.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_copy.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_hash.cpp16
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_iterator.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_make.cpp20
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_misc.cpp21
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_move.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_mutate.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_n.cpp231
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_nest.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_tie.cpp22
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_traits.cpp32
-rw-r--r--src/boost/libs/fusion/test/sequence/vector_value_at.cpp19
-rw-r--r--src/boost/libs/fusion/test/sequence/zip_view.cpp87
-rw-r--r--src/boost/libs/fusion/test/sequence/zip_view2.cpp64
-rw-r--r--src/boost/libs/fusion/test/sequence/zip_view_ignore.cpp58
-rw-r--r--src/boost/libs/fusion/test/support/and.cpp28
-rw-r--r--src/boost/libs/fusion/test/support/index_sequence.cpp32
-rw-r--r--src/boost/libs/fusion/test/support/is_sequence.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/is_view.cpp15
-rw-r--r--src/boost/libs/fusion/test/support/pair_container.hpp27
-rw-r--r--src/boost/libs/fusion/test/support/pair_deque.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/pair_list.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/pair_map.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/pair_nest.cpp24
-rw-r--r--src/boost/libs/fusion/test/support/pair_set.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/pair_vector.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/tag_of.cpp17
-rw-r--r--src/boost/libs/fusion/test/support/unused.cpp96
290 files changed, 22891 insertions, 0 deletions
diff --git a/src/boost/libs/fusion/CMakeLists.txt b/src/boost/libs/fusion/CMakeLists.txt
new file mode 100644
index 000000000..2972717b1
--- /dev/null
+++ b/src/boost/libs/fusion/CMakeLists.txt
@@ -0,0 +1,29 @@
+# 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
+#
+# Partial (add_subdirectory only) and experimental CMake support
+# Subject to change; please do not rely on the contents of this file yet
+
+cmake_minimum_required(VERSION 3.5)
+project(BoostFusion LANGUAGES CXX)
+
+add_library(boost_fusion INTERFACE)
+add_library(Boost::fusion ALIAS boost_fusion)
+
+target_include_directories(boost_fusion INTERFACE include)
+
+target_link_libraries(boost_fusion
+ INTERFACE
+ Boost::config
+ Boost::container_hash
+ Boost::core
+ Boost::function_types
+ Boost::mpl
+ Boost::preprocessor
+ Boost::static_assert
+ Boost::tuple
+ Boost::type_traits
+ Boost::typeof
+ Boost::utility
+)
diff --git a/src/boost/libs/fusion/example/cookbook/do_the_bind.cpp b/src/boost/libs/fusion/example/cookbook/do_the_bind.cpp
new file mode 100644
index 000000000..ac5baee4d
--- /dev/null
+++ b/src/boost/libs/fusion/example/cookbook/do_the_bind.cpp
@@ -0,0 +1,268 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+
+ Problem:
+
+ How to "do the Bind?"
+
+ This recipe shows how to implement a function binder, similar to
+ Boost.Bind based on the Functional module of Fusion.
+
+ It works as follows:
+
+ 'bind' is a global, stateless function object. It is implemented in
+ fused form (fused_binder) and transformed into a variadic function
+ object. When called, 'bind' returns another function object, which
+ holds the arguments of the call to 'bind'. It is, again, implemented
+ in fused form (fused_bound_function) and transformed into unfused
+ form.
+==============================================================================*/
+
+
+#include <boost/fusion/functional/invocation/invoke.hpp>
+#include <boost/fusion/functional/adapter/unfused.hpp>
+#include <boost/fusion/support/deduce_sequence.hpp>
+
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/fusion/algorithm/transformation/pop_front.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/view/filter_view.hpp>
+
+#include <boost/functional/forward_adapter.hpp>
+#include <boost/functional/lightweight_forward_adapter.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/max.hpp>
+#include <boost/mpl/next.hpp>
+
+#include <boost/ref.hpp>
+#include <iostream>
+#include <typeinfo>
+
+namespace impl
+{
+ namespace fusion = boost::fusion;
+ namespace traits = boost::fusion::traits;
+ namespace result_of = boost::fusion::result_of;
+ namespace mpl = boost::mpl;
+ using mpl::placeholders::_;
+
+ // Placeholders (we inherit from mpl::int_, so we can use placeholders
+ // as indices for fusion::at, later)
+ template <int I> struct placeholder : mpl::int_<I> { };
+
+ // A traits class to find out whether T is a placeholeder
+ template <typename T> struct is_placeholder : mpl::false_ { };
+ template <int I> struct is_placeholder< placeholder<I> > : mpl::true_ { };
+ template <int I> struct is_placeholder< placeholder<I> & > : mpl::true_ { };
+ template <int I> struct is_placeholder< placeholder<I> const > : mpl::true_ { };
+ template <int I> struct is_placeholder< placeholder<I> const & > : mpl::true_ { };
+
+ // This class template provides a Polymorphic Function Object to be used
+ // with fusion::transform. It is applied to the sequence of arguments that
+ // describes the binding and holds a reference to the sequence of arguments
+ // from the final call.
+ template<class FinalArgs> struct argument_transform
+ {
+ FinalArgs const & ref_final_args;
+ public:
+
+ explicit argument_transform(FinalArgs const & final_args)
+ : ref_final_args(final_args)
+ { }
+
+ // A placeholder? Replace it with an argument from the final call...
+ template <int Index>
+ inline typename result_of::at_c<FinalArgs const, Index>::type
+ operator()(placeholder<Index> const &) const
+ {
+ return fusion::at_c<Index>(this->ref_final_args);
+ }
+ // ...just return the bound argument, otherwise.
+ template <typename T> inline T & operator()(T & bound) const
+ {
+ return bound;
+ }
+
+ template <typename Signature>
+ struct result;
+
+ template <class Self, typename T>
+ struct result< Self (T) >
+ : mpl::eval_if< is_placeholder<T>,
+ result_of::at<FinalArgs,typename boost::remove_reference<T>::type>,
+ mpl::identity<T>
+ >
+ { };
+ };
+
+ // Fused implementation of the bound function, the function object
+ // returned by bind
+ template <class BindArgs> class fused_bound_function
+ {
+ // Transform arguments to be held by value
+ typedef typename traits::deduce_sequence<BindArgs>::type bound_args;
+
+ bound_args fsq_bind_args;
+ public:
+
+ fused_bound_function(BindArgs const & bind_args)
+ : fsq_bind_args(bind_args)
+ { }
+
+ template <typename Signature>
+ struct result;
+
+ template <class FinalArgs>
+ struct result_impl
+ : result_of::invoke< typename result_of::front<bound_args>::type,
+ typename result_of::transform<
+ typename result_of::pop_front<bound_args>::type,
+ argument_transform<FinalArgs> const
+ >::type
+ >
+ { };
+
+ template <class Self, class FinalArgs>
+ struct result< Self (FinalArgs) >
+ : result_impl< typename boost::remove_reference<FinalArgs>::type >
+ { };
+
+ template <class FinalArgs>
+ inline typename result_impl<FinalArgs>::type
+ operator()(FinalArgs const & final_args) const
+ {
+ return fusion::invoke( fusion::front(this->fsq_bind_args),
+ fusion::transform( fusion::pop_front(this->fsq_bind_args),
+ argument_transform<FinalArgs>(final_args) ) );
+ }
+ // Could add a non-const variant - omitted for readability
+
+ };
+
+ // Find the number of placeholders in use
+ struct n_placeholders
+ {
+ struct fold_op
+ {
+ template <typename Sig> struct result;
+ template <class S, class A, class B> struct result< S(A &,B &) >
+ : mpl::max<A,B> { };
+ };
+ struct filter_pred
+ {
+ template <class X> struct apply : is_placeholder<X> { };
+ };
+
+ template <typename Seq>
+ struct apply
+ : mpl::next< typename result_of::fold<
+ fusion::filter_view<Seq,filter_pred>, mpl::int_<-1>, fold_op
+ >::type>::type
+ { };
+ };
+
+ // Fused implementation of the 'bind' function
+ struct fused_binder
+ {
+ template <class Signature>
+ struct result;
+
+ template <class BindArgs,
+ int Placeholders = n_placeholders::apply<BindArgs>::value>
+ struct result_impl
+ {
+ typedef boost::forward_adapter<fusion::unfused<
+ fused_bound_function<BindArgs>,!Placeholders>,Placeholders> type;
+ };
+
+ template <class Self, class BindArgs>
+ struct result< Self (BindArgs) >
+ : result_impl< typename boost::remove_reference<BindArgs>::type >
+ { };
+
+ template <class BindArgs>
+ inline typename result_impl< BindArgs >::type
+ operator()(BindArgs & bind_args) const
+ {
+ return typename result< void(BindArgs) >::type(
+ fusion::unfused< fused_bound_function<BindArgs>,
+ ! n_placeholders::apply<BindArgs>::value >(bind_args) );
+ }
+ };
+
+ // The binder's unfused type. We use lightweght_forward_adapter to make
+ // that thing more similar to Boost.Bind. Because of that we have to use
+ // Boost.Ref (below in the sample code)
+ typedef boost::lightweight_forward_adapter< fusion::unfused<fused_binder> > binder;
+}
+
+// Placeholder globals
+impl::placeholder<0> const _1_ = impl::placeholder<0>();
+impl::placeholder<1> const _2_ = impl::placeholder<1>();
+impl::placeholder<2> const _3_ = impl::placeholder<2>();
+impl::placeholder<3> const _4_ = impl::placeholder<3>();
+
+// The bind function is a global, too
+impl::binder const bind = impl::binder();
+
+
+// OK, let's try it out:
+
+struct func
+{
+ typedef int result_type;
+
+ inline int operator()() const
+ {
+ std::cout << "operator()" << std::endl;
+ return 0;
+ }
+
+ template <typename A>
+ inline int operator()(A const & a) const
+ {
+ std::cout << "operator()(A const & a)" << std::endl;
+ std::cout << " a = " << a << " A = " << typeid(A).name() << std::endl;
+ return 1;
+ }
+
+ template <typename A, typename B>
+ inline int operator()(A const & a, B & b) const
+ {
+ std::cout << "operator()(A const & a, B & b)" << std::endl;
+ std::cout << " a = " << a << " A = " << typeid(A).name() << std::endl;
+ std::cout << " b = " << b << " B = " << typeid(B).name() << std::endl;
+ return 2;
+ }
+};
+
+int main()
+{
+ func f;
+ int value = 42;
+ using boost::ref;
+
+ int errors = 0;
+
+ errors += !( bind(f)() == 0);
+ errors += !( bind(f,"Hi")() == 1);
+ errors += !( bind(f,_1_)("there.") == 1);
+ errors += !( bind(f,"The answer is",_1_)(12) == 2);
+ errors += !( bind(f,_1_,ref(value))("Really?") == 2);
+ errors += !( bind(f,_1_,_2_)("Dunno. If there is an answer, it's",value) == 2);
+
+ return !! errors;
+}
+
diff --git a/src/boost/libs/fusion/example/cookbook/fill_em_up.cpp b/src/boost/libs/fusion/example/cookbook/fill_em_up.cpp
new file mode 100644
index 000000000..9b37aec8f
--- /dev/null
+++ b/src/boost/libs/fusion/example/cookbook/fill_em_up.cpp
@@ -0,0 +1,105 @@
+/*=============================================================================
+ Copyright (c) 2011 Joel de Guzman
+
+ 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)
+
+ Problem:
+
+ So... you have an input sequence I and a target vector R. You want to
+ copy I into R. But, I may have less elements than the result vector R.
+ For those elements not in R, you want them to be default constructed.
+
+ Here's a case:
+
+ I: list<double, std::string>
+ R: vector<double, std::string, int, short>
+
+ You want the elements at the right of I not in R (i.e. int, short)
+ default constructed. Those at the left, found in both I and R, you want
+ to simply copy from I.
+
+ Of course you want to be able to handle any type of I and R.
+
+==============================================================================*/
+
+// We'll use these containers as examples
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+// For doing I/O
+#include <boost/fusion/sequence/io.hpp>
+
+// We'll use join and advance for processing
+#include <boost/fusion/algorithm/transformation/join.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+
+// The fusion <--> MPL link header
+#include <boost/fusion/mpl.hpp>
+
+// Same-o same-o
+#include <iostream>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ // Let's specify our own tuple delimeters for nicer printing
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ // Here's your input sequence
+ typedef list<double, std::string> I;
+ I i(123.456, "Hello");
+
+ // Here's your output sequence. For now, it is just a typedef
+ typedef vector<double, std::string, int, short> R;
+
+ // Let's get the sizes of the sequences. Yeah, you already know that.
+ // But with templates, you are simply given, say, R and I, corresponding
+ // to the types of the sequences. You'll have to deal with it generically.
+ static int const r_size = result_of::size<R>::value;
+ static int const i_size = result_of::size<I>::value;
+
+ // Make sure that I has no more elements than R
+ // Be nice and catch obvious errors earlier rather than later.
+ // Without this assert, the mistake will still be caught by Fusion,
+ // but the error will point to somewhere really obscure.
+ BOOST_STATIC_ASSERT(i_size <= r_size);
+
+ // Let's get the begin and end iterator types of the output sequence
+ // There's no actual vector yet. We just want to know the types.
+ typedef result_of::begin<R>::type r_begin;
+ typedef result_of::end<R>::type r_end;
+
+ // Let's skip i_size elements from r_begin. Again, we just want to know the type.
+ typedef result_of::advance_c<r_begin, i_size>::type r_advance;
+
+ // Now, make MPL iterators from r_advance and r_end. Ditto, just types.
+ typedef mpl::fusion_iterator<r_advance> mpl_r_advance;
+ typedef mpl::fusion_iterator<r_end> mpl_r_end;
+
+ // Make an mpl::iterator_range from the MPL iterators we just created
+ // You guessed it! --just a type.
+ typedef mpl::iterator_range<mpl_r_advance, mpl_r_end> tail;
+
+ // Use join to join the input sequence and our mpl::iterator_range
+ // Our mpl::iterator_range is 'tail'. Here, we'll actually instantiate
+ // 'tail'. Notice that this is a flyweight object, typically just 1 byte
+ // in size -- it doesn't really hold any data, but is a fully conforming
+ // sequence nonetheless. When asked to return its elements, 'tail' returns
+ // each element default constructed. Breeds like a rabbit!
+
+ // Construct R from the joined sequences:
+ R r(join(i, tail()));
+
+ // Then finally, print the result:
+ std::cout << r << std::endl;
+
+ return 0;
+}
+
diff --git a/src/boost/libs/fusion/example/extension/Jamfile b/src/boost/libs/fusion/example/extension/Jamfile
new file mode 100644
index 000000000..aabe83021
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/Jamfile
@@ -0,0 +1,20 @@
+#==============================================================================
+# Copyright (c) 2003-2006 Joel de Guzman
+# Copyright (c) 2006 Dan Marsden
+#
+# Use, modification and distribution is 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)
+#==============================================================================
+
+# bring in rules for testing
+import testing ;
+
+{
+ test-suite example :
+
+ [ run test_example.cpp : : : : ]
+ [ run triple.cpp : : : : ]
+ ;
+}
+
diff --git a/src/boost/libs/fusion/example/extension/detail/advance_impl.hpp b/src/boost/libs/fusion/example/extension/detail/advance_impl.hpp
new file mode 100644
index 000000000..0d7781237
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/advance_impl.hpp
@@ -0,0 +1,47 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_ADVANCE_IMPL_20060222_2150)
+#define BOOST_FUSION_ADVANCE_IMPL_20060222_2150
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct advance_impl;
+
+ template<>
+ struct advance_impl<example::example_struct_iterator_tag>
+ {
+ template<typename Iterator, typename N>
+ struct apply
+ {
+ typedef typename Iterator::struct_type struct_type;
+ typedef typename Iterator::index index;
+ typedef example::example_struct_iterator<
+ struct_type, index::value + N::value> type;
+
+ static type
+ call(Iterator const& it)
+ {
+ return type(it.struct_);
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/at_impl.hpp b/src/boost/libs/fusion/example/extension/detail/at_impl.hpp
new file mode 100644
index 000000000..605589305
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/at_impl.hpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_AT_IMPL_20060223_2017)
+#define BOOST_FUSION_AT_IMPL_20060223_2017
+
+#include <string>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct at_impl;
+
+ template<>
+ struct at_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence, typename Key>
+ struct apply;
+
+ template<typename Sequence>
+ struct apply<Sequence, mpl::int_<0> >
+ {
+ typedef typename mpl::if_<
+ is_const<Sequence>,
+ std::string const&,
+ std::string&>::type type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return seq.name;
+ };
+ };
+
+ template<typename Sequence>
+ struct apply<Sequence, mpl::int_<1> >
+ {
+ typedef typename mpl::if_<
+ is_const<Sequence>,
+ int const&,
+ int&>::type type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return seq.age;
+ };
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/at_key_impl.hpp b/src/boost/libs/fusion/example/extension/detail/at_key_impl.hpp
new file mode 100644
index 000000000..e925c62a0
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/at_key_impl.hpp
@@ -0,0 +1,72 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_AT_KEY_IMPL_20060223_2017)
+#define BOOST_FUSION_AT_KEY_IMPL_20060223_2017
+
+#include <string>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+namespace fields
+{
+ struct name;
+ struct age;
+}
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct at_key_impl;
+
+ template<>
+ struct at_key_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence, typename Key>
+ struct apply;
+
+ template<typename Sequence>
+ struct apply<Sequence, fields::name>
+ {
+ typedef typename mpl::if_<
+ is_const<Sequence>,
+ std::string const&,
+ std::string&>::type type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return seq.name;
+ };
+ };
+
+ template<typename Sequence>
+ struct apply<Sequence, fields::age>
+ {
+ typedef typename mpl::if_<
+ is_const<Sequence>,
+ int const&,
+ int&>::type type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return seq.age;
+ };
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/begin_impl.hpp b/src/boost/libs/fusion/example/extension/detail/begin_impl.hpp
new file mode 100644
index 000000000..a4296c59c
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/begin_impl.hpp
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_BEGIN_IMPL_20060222_2042)
+#define BOOST_FUSION_BEGIN_IMPL_20060222_2042
+
+#include "../example_struct_iterator.hpp"
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct begin_impl;
+
+ template<>
+ struct begin_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef example::example_struct_iterator<Sequence, 0> type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/category_of_impl.hpp b/src/boost/libs/fusion/example/extension/detail/category_of_impl.hpp
new file mode 100644
index 000000000..b0bc7d90e
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/category_of_impl.hpp
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_20060223_2037)
+#define BOOST_FUSION_CATEGORY_OF_IMPL_20060223_2037
+
+#include <boost/fusion/support/category_of.hpp>
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<>
+ struct category_of_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ struct type : random_access_traversal_tag, associative_tag {};
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/deref_data_impl.hpp b/src/boost/libs/fusion/example/extension/detail/deref_data_impl.hpp
new file mode 100644
index 000000000..c9907d5cd
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/deref_data_impl.hpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2009 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_DEREF_DATA_IMPL_HPP
+#define BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_DEREF_DATA_IMPL_HPP
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct deref_data_impl;
+
+ template<>
+ struct deref_data_impl<example::example_struct_iterator_tag>
+ : deref_impl<example::example_struct_iterator_tag>
+ {};
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/deref_impl.hpp b/src/boost/libs/fusion/example/extension/detail/deref_impl.hpp
new file mode 100644
index 000000000..7e515e9d2
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/deref_impl.hpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_DEREF_IMPL_20060222_1952)
+#define BOOST_FUSION_DEREF_IMPL_20060222_1952
+
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/mpl/if.hpp>
+
+#include <string>
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct deref_impl;
+
+ template<>
+ struct deref_impl<example::example_struct_iterator_tag>
+ {
+ template<typename Iterator>
+ struct apply;
+
+ template<typename Struct>
+ struct apply<example::example_struct_iterator<Struct, 0> >
+ {
+ typedef typename mpl::if_<
+ is_const<Struct>, std::string const&, std::string&>::type type;
+
+ static type
+ call(example::example_struct_iterator<Struct, 0> const& it)
+ {
+ return it.struct_.name;
+ }
+ };
+
+ template<typename Struct>
+ struct apply<example::example_struct_iterator<Struct, 1> >
+ {
+ typedef typename mpl::if_<
+ is_const<Struct>, int const&, int&>::type type;
+
+ static type
+ call(example::example_struct_iterator<Struct, 1> const& it)
+ {
+ return it.struct_.age;
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/distance_impl.hpp b/src/boost/libs/fusion/example/extension/detail/distance_impl.hpp
new file mode 100644
index 000000000..b138cc4a1
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/distance_impl.hpp
@@ -0,0 +1,44 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_DISTANCE_IMPL_20060223_0814)
+#define BOOST_FUSION_DISTANCE_IMPL_20060223_0814
+
+#include <boost/mpl/minus.hpp>
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct distance_impl;
+
+ template<>
+ struct distance_impl<example::example_struct_iterator_tag>
+ {
+ template<typename First, typename Last>
+ struct apply
+ : mpl::minus<typename Last::index, typename First::index>
+ {
+ typedef apply<First, Last> self;
+
+ static typename self::type
+ call(First const& first, Last const& last)
+ {
+ return typename self::type();
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/end_impl.hpp b/src/boost/libs/fusion/example/extension/detail/end_impl.hpp
new file mode 100644
index 000000000..749bb33a8
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/end_impl.hpp
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_END_IMPL_20060222_2042)
+#define BOOST_FUSION_END_IMPL_20060222_2042
+
+#include "../example_struct_iterator.hpp"
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct end_impl;
+
+ template<>
+ struct end_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef example::example_struct_iterator<Sequence, 2> type;
+
+ static type
+ call(Sequence& seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/equal_to_impl.hpp b/src/boost/libs/fusion/example/extension/detail/equal_to_impl.hpp
new file mode 100644
index 000000000..8ab27649d
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/equal_to_impl.hpp
@@ -0,0 +1,38 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_EQUAL_TO_IMPL_20060223_1941)
+#define BOOST_FUSION_EQUAL_TO_IMPL_20060223_1941
+
+#include <boost/mpl/equal_to.hpp>
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct equal_to_impl;
+
+ template<>
+ struct equal_to_impl<example::example_struct_iterator_tag>
+ {
+ template<typename It1, typename It2>
+ struct apply
+ : mpl::equal_to<
+ typename It1::index,
+ typename It2::index>
+ {};
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/has_key_impl.hpp b/src/boost/libs/fusion/example/extension/detail/has_key_impl.hpp
new file mode 100644
index 000000000..596827cef
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/has_key_impl.hpp
@@ -0,0 +1,45 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_HAS_KEY_IMPL_20060223_2156)
+#define BOOST_FUSION_HAS_KEY_IMPL_20060223_2156
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/or.hpp>
+
+namespace fields
+{
+ struct name;
+ struct age;
+}
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct has_key_impl;
+
+ template<>
+ struct has_key_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence, typename Key>
+ struct apply
+ : mpl::or_<
+ is_same<Key, fields::name>,
+ is_same<Key, fields::age> >
+ {};
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/is_sequence_impl.hpp b/src/boost/libs/fusion/example/extension/detail/is_sequence_impl.hpp
new file mode 100644
index 000000000..e373342a7
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/is_sequence_impl.hpp
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_20060228_1946)
+#define BOOST_FUSION_IS_SEQUENCE_IMPL_20060228_1946
+
+#include <boost/mpl/bool.hpp>
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion
+{
+ namespace extension
+ {
+ template<typename Tag>
+ struct is_sequence_impl;
+
+ template<>
+ struct is_sequence_impl<example::example_sequence_tag>
+ {
+ template<typename T>
+ struct apply : mpl::true_ {};
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/is_view_impl.hpp b/src/boost/libs/fusion/example/extension/detail/is_view_impl.hpp
new file mode 100644
index 000000000..b2344bf2d
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/is_view_impl.hpp
@@ -0,0 +1,32 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_IS_VIEW_IMPL_200604227_2150)
+#define BOOST_FUSION_IS_VIEW_IMPL_200604227_2150
+
+#include <boost/mpl/bool.hpp>
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion
+{
+ namespace extension
+ {
+ template<typename Tag>
+ struct is_view_impl;
+
+ template<>
+ struct is_view_impl<example::example_sequence_tag>
+ : boost::mpl::false_
+ {};
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/key_of_impl.hpp b/src/boost/libs/fusion/example/extension/detail/key_of_impl.hpp
new file mode 100644
index 000000000..6a7a836d7
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/key_of_impl.hpp
@@ -0,0 +1,42 @@
+/*=============================================================================
+ Copyright (c) 2009 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_KEY_OF_IMPL_HPP
+#define BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_KEY_OF_IMPL_HPP
+
+#include <boost/mpl/if.hpp>
+
+namespace fields
+{
+ struct name;
+ struct age;
+}
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct key_of_impl;
+
+ template<>
+ struct key_of_impl<example::example_struct_iterator_tag>
+ {
+ template<typename It>
+ struct apply
+ : mpl::if_c<!It::index::value, fields::name, fields::age>
+ {};
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/next_impl.hpp b/src/boost/libs/fusion/example/extension/detail/next_impl.hpp
new file mode 100644
index 000000000..8fbaa8b17
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/next_impl.hpp
@@ -0,0 +1,46 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_NEXT_IMPL_20060222_1859)
+#define BOOST_FUSION_NEXT_IMPL_20060222_1859
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct next_impl;
+
+ template<>
+ struct next_impl<example::example_struct_iterator_tag>
+ {
+ template<typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::struct_type struct_type;
+ typedef typename Iterator::index index;
+ typedef example::example_struct_iterator<struct_type, index::value + 1> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(i.struct_);
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/prior_impl.hpp b/src/boost/libs/fusion/example/extension/detail/prior_impl.hpp
new file mode 100644
index 000000000..415692cee
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/prior_impl.hpp
@@ -0,0 +1,46 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_PRIOR_IMPL_20060222_1944)
+#define BOOST_FUSION_PRIOR_IMPL_20060222_1944
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct prior_impl;
+
+ template<>
+ struct prior_impl<example::example_struct_iterator_tag>
+ {
+ template<typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::struct_type struct_type;
+ typedef typename Iterator::index index;
+ typedef example::example_struct_iterator<struct_type, index::value - 1> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(i.struct_);
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/size_impl.hpp b/src/boost/libs/fusion/example/extension/detail/size_impl.hpp
new file mode 100644
index 000000000..4dc6ec930
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/size_impl.hpp
@@ -0,0 +1,36 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_SIZE_IMPL_20060223_2033)
+#define BOOST_FUSION_SIZE_IMPL_20060223_2033
+
+#include <boost/mpl/int.hpp>
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct size_impl;
+
+ template<>
+ struct size_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::int_<2>
+ {};
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/value_at_impl.hpp b/src/boost/libs/fusion/example/extension/detail/value_at_impl.hpp
new file mode 100644
index 000000000..6a1d63ef2
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/value_at_impl.hpp
@@ -0,0 +1,44 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_VALUE_AT_IMPL_20060223_2025)
+#define BOOST_FUSION_VALUE_AT_IMPL_20060223_2025
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct value_at_impl;
+
+ template<>
+ struct value_at_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence, typename N>
+ struct apply;
+
+ template<typename Sequence>
+ struct apply<Sequence, mpl::int_<0> >
+ {
+ typedef std::string type;
+ };
+
+ template<typename Sequence>
+ struct apply<Sequence, mpl::int_<1> >
+ {
+ typedef int type;
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/value_at_key_impl.hpp b/src/boost/libs/fusion/example/extension/detail/value_at_key_impl.hpp
new file mode 100644
index 000000000..cabc59aad
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/value_at_key_impl.hpp
@@ -0,0 +1,50 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_VALUE_AT_KEY_IMPL_20060223_2025)
+#define BOOST_FUSION_VALUE_AT_KEY_IMPL_20060223_2025
+
+namespace fields
+{
+ struct name;
+ struct age;
+}
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct value_at_key_impl;
+
+ template<>
+ struct value_at_key_impl<example::example_sequence_tag>
+ {
+ template<typename Sequence, typename N>
+ struct apply;
+
+ template<typename Sequence>
+ struct apply<Sequence, fields::name>
+ {
+ typedef std::string type;
+ };
+
+ template<typename Sequence>
+ struct apply<Sequence, fields::age>
+ {
+ typedef int type;
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/value_of_data_impl.hpp b/src/boost/libs/fusion/example/extension/detail/value_of_data_impl.hpp
new file mode 100644
index 000000000..94cdcc307
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/value_of_data_impl.hpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2009 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#ifndef BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_VALUE_OF_DATA_IMPL_HPP
+#define BOOST_FUSION_EXAMPLE_EXTENSION_DETAIL_VALUE_OF_DATA_IMPL_HPP
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct value_of_data_impl;
+
+ template<>
+ struct value_of_data_impl<example::example_struct_iterator_tag>
+ : value_of_impl<example::example_struct_iterator_tag>
+ {};
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/detail/value_of_impl.hpp b/src/boost/libs/fusion/example/extension/detail/value_of_impl.hpp
new file mode 100644
index 000000000..6fc7e161f
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/detail/value_of_impl.hpp
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_VALUE_OF_IMPL_20060223_1905)
+#define BOOST_FUSION_VALUE_OF_IMPL_20060223_1905
+
+#include <string>
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace extension
+ {
+ template<typename Tag>
+ struct value_of_impl;
+
+ template<>
+ struct value_of_impl<example::example_struct_iterator_tag>
+ {
+ template<typename Iterator>
+ struct apply;
+
+ template<typename Struct>
+ struct apply<example::example_struct_iterator<Struct, 0> >
+ {
+ typedef std::string type;
+ };
+
+ template<typename Struct>
+ struct apply<example::example_struct_iterator<Struct, 1> >
+ {
+ typedef int type;
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/example_struct.hpp b/src/boost/libs/fusion/example/extension/example_struct.hpp
new file mode 100644
index 000000000..cbb058f59
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/example_struct.hpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_EXAMPLE_STRUCT)
+#define BOOST_FUSION_EXAMPLE_STRUCT
+
+#include "./tag_of.hpp"
+#include "./example_struct_iterator.hpp"
+#include "./detail/begin_impl.hpp"
+#include "./detail/end_impl.hpp"
+#include "./detail/at_impl.hpp"
+#include "./detail/value_at_impl.hpp"
+#include "./detail/size_impl.hpp"
+#include "./detail/category_of_impl.hpp"
+#include "./detail/at_key_impl.hpp"
+#include "./detail/value_at_key_impl.hpp"
+#include "./detail/has_key_impl.hpp"
+#include "./detail/is_sequence_impl.hpp"
+#include "./detail/is_view_impl.hpp"
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/example_struct_iterator.hpp b/src/boost/libs/fusion/example/extension/example_struct_iterator.hpp
new file mode 100644
index 000000000..fa04f0856
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/example_struct_iterator.hpp
@@ -0,0 +1,70 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_EXAMPLE_STRUCT_ITERATOR)
+#define BOOST_FUSION_EXAMPLE_STRUCT_ITERATOR
+
+#include <boost/fusion/support/iterator_base.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/support/tag_of_fwd.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/static_assert.hpp>
+
+#include "./detail/next_impl.hpp"
+#include "./detail/prior_impl.hpp"
+#include "./detail/deref_impl.hpp"
+#include "./detail/advance_impl.hpp"
+#include "./detail/distance_impl.hpp"
+#include "./detail/value_of_impl.hpp"
+#include "./detail/equal_to_impl.hpp"
+#include "./detail/key_of_impl.hpp"
+#include "./detail/value_of_data_impl.hpp"
+#include "./detail/deref_data_impl.hpp"
+
+namespace example
+{
+ struct example_struct_iterator_tag;
+
+ template<typename Struct, int Pos>
+ struct example_struct_iterator;
+}
+
+namespace boost { namespace fusion {
+
+ namespace traits
+ {
+ template<typename Struct, int Pos>
+ struct tag_of<example::example_struct_iterator<Struct, Pos> >
+ {
+ typedef example::example_struct_iterator_tag type;
+ };
+ }
+}}
+
+namespace example {
+ template<typename Struct, int Pos>
+ struct example_struct_iterator
+ : boost::fusion::iterator_base<example_struct_iterator<Struct, Pos> >
+ {
+ BOOST_STATIC_ASSERT(Pos >=0 && Pos < 3);
+ typedef Struct struct_type;
+ typedef boost::mpl::int_<Pos> index;
+
+ struct category
+ : boost::fusion::random_access_traversal_tag
+ , boost::fusion::associative_tag
+ {};
+
+ example_struct_iterator(Struct& str)
+ : struct_(str) {}
+
+ Struct& struct_;
+ };
+}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/example_struct_type.hpp b/src/boost/libs/fusion/example/extension/example_struct_type.hpp
new file mode 100644
index 000000000..e1d8e1754
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/example_struct_type.hpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_EXAMPLE_STRUCT_TYPE)
+#define BOOST_FUSION_EXAMPLE_STRUCT_TYPE
+
+#include <string>
+
+namespace example
+{
+ struct example_struct
+ {
+ std::string name;
+ int age;
+ example_struct(
+ const std::string& n,
+ int a)
+ : name(n), age(a)
+ {}
+ };
+}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/tag_of.hpp b/src/boost/libs/fusion/example/extension/tag_of.hpp
new file mode 100644
index 000000000..083b730c8
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/tag_of.hpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_TAG_OF_20060222_2052)
+#define BOOST_FUSION_TAG_OF_20060222_2052
+
+#include <boost/fusion/support/tag_of_fwd.hpp>
+#include "./example_struct_type.hpp"
+
+namespace example
+{
+ struct example_sequence_tag;
+}
+
+namespace boost { namespace fusion {
+
+namespace traits {
+
+ template<>
+ struct tag_of<example::example_struct>
+ {
+ typedef example::example_sequence_tag type;
+ };
+}}}
+
+#endif
diff --git a/src/boost/libs/fusion/example/extension/test_example.cpp b/src/boost/libs/fusion/example/extension/test_example.cpp
new file mode 100644
index 000000000..581e2300f
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/test_example.cpp
@@ -0,0 +1,65 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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 "./example_struct.hpp"
+#include "./example_struct_type.hpp"
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/assert.hpp>
+
+int main()
+{
+ example::example_struct bert("bert", 99);
+ using namespace boost::fusion;
+
+ BOOST_MPL_ASSERT((traits::is_associative<example::example_struct>));
+ BOOST_MPL_ASSERT((traits::is_random_access<example::example_struct>));
+ BOOST_MPL_ASSERT((traits::is_sequence<example::example_struct>));
+
+ BOOST_TEST(deref(begin(bert)) == "bert");
+ BOOST_TEST(*next(begin(bert)) == 99);
+ BOOST_TEST(*prior(end(bert)) == 99);
+ BOOST_TEST(*advance_c<1>(begin(bert)) == 99);
+ BOOST_TEST(*advance_c<-1>(end(bert)) == 99);
+ BOOST_TEST(distance(begin(bert), end(bert)) == 2);
+
+ typedef result_of::begin<example::example_struct>::type first;
+ typedef result_of::next<first>::type second;
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<first>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_of<second>::type, int>));
+
+ BOOST_TEST(begin(bert) != end(bert));
+ BOOST_TEST(advance_c<2>(begin(bert)) == end(const_cast<const example::example_struct&>(bert)));
+
+ BOOST_TEST(at_c<0>(bert) == "bert");
+ BOOST_TEST(at_c<1>(bert) == 99);
+
+ BOOST_TEST(at_key<fields::name>(bert) == "bert");
+ BOOST_TEST(at_key<fields::age>(bert) == 99);
+
+ BOOST_TEST(has_key<fields::name>(bert));
+ BOOST_TEST(has_key<fields::age>(bert));
+ BOOST_TEST(!has_key<int>(bert));
+
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_c<example::example_struct, 0>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_c<example::example_struct, 1>::type, int>));
+
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<example::example_struct, fields::name>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<example::example_struct, fields::age>::type, int>));
+
+ BOOST_TEST(deref_data(begin(bert)) == "bert");
+ BOOST_TEST(deref_data(next(begin(bert))) == 99);
+
+ BOOST_TEST(size(bert) == 2);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/example/extension/triple.cpp b/src/boost/libs/fusion/example/extension/triple.cpp
new file mode 100644
index 000000000..ac8f18e08
--- /dev/null
+++ b/src/boost/libs/fusion/example/extension/triple.cpp
@@ -0,0 +1,377 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Nathan Ridge
+ Copyright (c) 2006 Dan Marsden
+
+ 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)
+==============================================================================*/
+
+/*=============================================================================
+ An implementation of a std::pair like triple<T0, T1, T2>
+ We use fusion::sequence_facade and fusion::iterator_facade
+ to make our triple a fully conforming Boost.Fusion random
+ traversal sequence.
+==============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/fusion/sequence/sequence_facade.hpp>
+#include <boost/fusion/iterator/iterator_facade.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/mpl/assert.hpp>
+
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <string>
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+namespace demo
+{
+ template<typename Seq, int N>
+ struct triple_iterator
+ : fusion::iterator_facade<triple_iterator<Seq, N>,
+ fusion::random_access_traversal_tag>
+ {
+ typedef mpl::int_<N> index;
+ typedef Seq sequence_type;
+
+ triple_iterator(Seq& seq)
+ : seq_(seq) {}
+
+ Seq& seq_;
+
+ template<typename T>
+ struct value_of;
+
+ template<typename Sq>
+ struct value_of<triple_iterator<Sq, 0> >
+ : mpl::identity<typename Sq::t0_type>
+ {};
+
+ template<typename Sq>
+ struct value_of<triple_iterator<Sq, 1> >
+ : mpl::identity<typename Sq::t1_type>
+ {};
+
+ template<typename Sq>
+ struct value_of<triple_iterator<Sq, 2> >
+ : mpl::identity<typename Sq::t2_type>
+ {};
+
+ template<typename T>
+ struct deref;
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 0> >
+ {
+ typedef typename Sq::t0_type& type;
+
+ static type
+ call(triple_iterator<Sq, 0> const& iter)
+ {
+ return iter.seq_.t0;
+ }
+ };
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 0> const>
+ {
+ typedef typename Sq::t0_type const& type;
+
+ static type
+ call(triple_iterator<Sq, 0> const& iter)
+ {
+ return iter.seq_.t0;
+ }
+ };
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 1> >
+ {
+ typedef typename Sq::t1_type& type;
+
+ static type
+ call(triple_iterator<Sq, 1> const& iter)
+ {
+ return iter.seq_.t1;
+ }
+ };
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 1> const>
+ {
+ typedef typename Sq::t1_type const& type;
+
+ static type
+ call(triple_iterator<Sq, 1> const& iter)
+ {
+ return iter.seq_.t1;
+ }
+ };
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 2> >
+ {
+ typedef typename Sq::t2_type& type;
+
+ static type
+ call(triple_iterator<Sq, 2> const& iter)
+ {
+ return iter.seq_.t2;
+ }
+ };
+
+ template <typename Sq>
+ struct deref<triple_iterator<Sq, 2> const>
+ {
+ typedef typename Sq::t2_type const& type;
+
+ static type
+ call(triple_iterator<Sq, 2> const& iter)
+ {
+ return iter.seq_.t2;
+ }
+ };
+
+ template<typename It>
+ struct next
+ {
+ typedef triple_iterator<
+ typename It::sequence_type, It::index::value + 1>
+ type;
+
+ static type call(It const& it)
+ {
+ return type(it.seq_);
+ }
+ };
+
+ template<typename It>
+ struct prior
+ {
+ typedef triple_iterator<
+ typename It::sequence_type, It::index::value - 1>
+ type;
+
+ static type call(It const& it)
+ {
+ return type(it.seq_);
+ }
+ };
+
+ template<typename It1, typename It2>
+ struct distance
+ {
+ typedef typename mpl::minus<
+ typename It2::index, typename It1::index>::type
+ type;
+
+ static type call(It1 const& it1, It2 const& it2)
+ {
+ return type();
+ }
+ };
+
+ template<typename It, typename M>
+ struct advance
+ {
+ typedef triple_iterator<
+ typename It::sequence_type,
+ It::index::value + M::value>
+ type;
+
+ static type call(It const& it)
+ {
+ return type(it.seq_);
+ }
+ };
+ };
+
+ template<typename T0, typename T1, typename T2>
+ struct triple
+ : fusion::sequence_facade<triple<T0, T1, T2>,
+ fusion::random_access_traversal_tag>
+ {
+ triple(T0 const& t0, T1 const& t1, T2 const& t2)
+ : t0(t0), t1(t1), t2(t2)
+ {}
+
+ template<typename Sq>
+ struct begin
+ {
+ typedef demo::triple_iterator<Sq, 0> type;
+
+ static type call(Sq& sq)
+ {
+ return type(sq);
+ }
+ };
+
+ template<typename Sq>
+ struct end
+ {
+ typedef demo::triple_iterator<Sq, 3> type;
+
+ static type call(Sq& sq)
+ {
+ return type(sq);
+ }
+ };
+
+ template<typename Sq>
+ struct size
+ : mpl::int_<3>
+ {};
+
+ template<typename Sq, typename N>
+ struct value_at
+ : value_at<Sq, mpl::int_<N::value> >
+ {};
+
+ template<typename Sq>
+ struct value_at<Sq, mpl::int_<0> >
+ {
+ typedef typename Sq::t0_type type;
+ };
+
+ template<typename Sq>
+ struct value_at<Sq, mpl::int_<1> >
+ {
+ typedef typename Sq::t1_type type;
+ };
+
+ template<typename Sq>
+ struct value_at<Sq, mpl::int_<2> >
+ {
+ typedef typename Sq::t2_type type;
+ };
+
+ template<typename Sq, typename N>
+ struct at
+ : at<Sq, mpl::int_<N::value> >
+ {};
+
+ template<typename Sq>
+ struct at<Sq, mpl::int_<0> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<Sq>
+ , typename Sq::t0_type const&
+ , typename Sq::t0_type&
+ >::type
+ type;
+
+ static type call(Sq& sq)
+ {
+ return sq.t0;
+ }
+ };
+
+ template<typename Sq>
+ struct at<Sq, mpl::int_<1> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<Sq>
+ , typename Sq::t1_type const&
+ , typename Sq::t1_type&
+ >::type
+ type;
+
+ static type call(Sq& sq)
+ {
+ return sq.t1;
+ }
+ };
+
+ template<typename Sq>
+ struct at<Sq, mpl::int_<2> >
+ {
+ typedef typename
+ mpl::if_<
+ boost::is_const<Sq>
+ , typename Sq::t2_type const&
+ , typename Sq::t2_type&
+ >::type
+ type;
+
+ static type call(Sq& sq)
+ {
+ return sq.t2;
+ }
+ };
+
+ typedef T0 t0_type;
+ typedef T1 t1_type;
+ typedef T2 t2_type;
+
+ T0 t0;
+ T1 t1;
+ T2 t2;
+ };
+}
+
+struct modifying_fold_functor
+{
+ template <typename T>
+ struct result
+ {
+ typedef bool type;
+ };
+
+ template <typename T>
+ bool operator()(bool b, T&)
+ {
+ return b;
+ }
+};
+
+struct nonmodifying_fold_functor
+{
+ template <typename T>
+ struct result
+ {
+ typedef bool type;
+ };
+
+ template <typename T>
+ bool operator()(bool b, const T&)
+ {
+ return b;
+ }
+};
+
+int main()
+{
+ typedef demo::triple<int, char, std::string> my_triple;
+ my_triple t(101, 'a', "hello");
+ BOOST_TEST(*fusion::begin(t) == 101);
+ BOOST_TEST(*fusion::next(fusion::begin(t)) == 'a');
+ BOOST_TEST(*fusion::prior(fusion::end(t)) == "hello");
+ BOOST_TEST(fusion::distance(fusion::begin(t), fusion::end(t)) == 3);
+ BOOST_TEST(fusion::size(t) == 3);
+ BOOST_MPL_ASSERT((boost::is_same<
+ int, fusion::result_of::value_at_c<my_triple, 0>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ char, fusion::result_of::value_at_c<my_triple, 1>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ std::string, fusion::result_of::value_at_c<my_triple, 2>::type>));
+ BOOST_TEST(fusion::at_c<0>(t) == 101);
+ BOOST_TEST(fusion::at_c<1>(t) == 'a');
+ BOOST_TEST(fusion::at_c<2>(t) == "hello");
+ BOOST_TEST(fusion::fold(t, true, modifying_fold_functor()) == true);
+ BOOST_TEST(fusion::fold(t, true, nonmodifying_fold_functor()) == true);
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/example/performance/Jamfile b/src/boost/libs/fusion/example/performance/Jamfile
new file mode 100644
index 000000000..3b8c8ffcc
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/Jamfile
@@ -0,0 +1,20 @@
+#==============================================================================
+# Copyright (c) 2003-2006 Joel de Guzman
+# Copyright (c) 2006 Dan Marsden
+#
+# Use, modification and distribution is 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)
+#==============================================================================
+project fusion-performance ;
+
+exe accumulate : accumulate.cpp ;
+
+exe inner_product : inner_product.cpp ;
+
+exe inner_product2 : inner_product2.cpp ;
+
+exe sequence_efficiency : sequence_efficiency.cpp ;
+
+exe functional : functional.cpp ;
+
diff --git a/src/boost/libs/fusion/example/performance/accumulate.cpp b/src/boost/libs/fusion/example/performance/accumulate.cpp
new file mode 100644
index 000000000..176dc4586
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/accumulate.cpp
@@ -0,0 +1,357 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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/array.hpp>
+#include <boost/timer.hpp>
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/adapted/array.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <algorithm>
+#include <numeric>
+#include <functional>
+#include <iostream>
+#include <cmath>
+#include <limits>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+int const REPEAT_COUNT = 10;
+
+double const duration = 0.5;
+
+namespace
+{
+ template<int N>
+ double time_for_std_accumulate(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr;
+ std::generate(arr.begin(), arr.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::accumulate(arr.begin(), arr.end(), 0);
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::accumulate(arr.begin(), arr.end(), 0);
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+ struct poly_add
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_add(Lhs,Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + rhs;
+ }
+ };
+
+ struct poly_mult
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_mult(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs * rhs;
+ }
+ };
+
+ template<int N>
+ double time_for_fusion_accumulate(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr;
+ std::generate(arr.begin(), arr.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(arr, 0, poly_add());
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ std::cout << iter << " iterations" << std::endl;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(arr, 0, poly_add());
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ std::cout << ".";
+ std::cout.flush();
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+#if 0
+ template<int N>
+ double time_for_std_inner_product(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+ template<int N>
+ double time_for_fusion_inner_product(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::transform(arr1, arr2, poly_mult()), 0, poly_add());
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::transform(arr1, arr2, poly_mult()), 0, poly_add());
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+ struct poly_combine
+ {
+ template<typename Lhs, typename Rhs>
+ struct result
+ {
+ typedef Lhs type;
+ };
+
+ template<typename Lhs, typename Rhs>
+ typename result<Lhs,Rhs>::type
+ operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + boost::fusion::at_c<0>(rhs) * boost::fusion::at_c<1>(rhs);
+ }
+ };
+
+ template<int N>
+ double time_for_fusion_inner_product2(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::zip(arr1, arr2), 0, poly_combine());
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ std::cout << iter << " iterations" << std::endl;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::zip(arr1, arr2), 0, poly_combine());
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+#endif
+}
+
+int main()
+{
+ int total = 0;
+ int res;
+ std::cout << "short accumulate std test " << time_for_std_accumulate<8>(res) << std::endl;
+ total += res;
+ std::cout << "short accumulate fusion test " << time_for_fusion_accumulate<8>(res) << std::endl;
+ total += res;
+
+ std::cout << "medium accumulate std test " << time_for_std_accumulate<64>(res) << std::endl;
+ total += res;
+ std::cout << "medium accumulate fusion test " << time_for_fusion_accumulate<64>(res) << std::endl;
+ total += res;
+
+ std::cout << "long accumulate std test " << time_for_std_accumulate<128>(res) << std::endl;
+ total += res;
+ std::cout << "long accumulate fusion test " << time_for_fusion_accumulate<128>(res) << std::endl;
+ total += res;
+
+#if 0
+ std::cout << "short inner_product std test " << time_for_std_inner_product<8>(res) << std::endl;
+ total += res;
+ std::cout << "short inner_product fusion test " << time_for_fusion_inner_product<8>(res) << std::endl;
+ total += res;
+ std::cout << "short inner_product fusion 2 test " << time_for_fusion_inner_product2<8>(res) << std::endl;
+ total += res;
+
+ std::cout << "medium inner_product std test " << time_for_std_inner_product<64>(res) << std::endl;
+ total += res;
+ std::cout << "medium inner_product fusion test " << time_for_fusion_inner_product<64>(res) << std::endl;
+ total += res;
+ std::cout << "medium inner_product fusion 2 test " << time_for_fusion_inner_product2<64>(res) << std::endl;
+ total += res;
+
+
+ std::cout << "long inner_product std test " << time_for_std_inner_product<128>(res) << std::endl;
+ total += res;
+ std::cout << "long inner_product fusion test " << time_for_fusion_inner_product<128>(res) << std::endl;
+ total += res;
+ std::cout << "long inner_product fusion 2 test " << time_for_fusion_inner_product2<128>(res) << std::endl;
+ total += res;
+#endif
+
+ return total;
+}
diff --git a/src/boost/libs/fusion/example/performance/functional.cpp b/src/boost/libs/fusion/example/performance/functional.cpp
new file mode 100644
index 000000000..9207a90d7
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/functional.cpp
@@ -0,0 +1,307 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/functional/adapter/unfused.hpp>
+#include <boost/fusion/functional/adapter/fused_function_object.hpp>
+
+#include <boost/functional/forward_adapter.hpp>
+#include <boost/functional/lightweight_forward_adapter.hpp>
+
+#include <boost/utility/result_of.hpp>
+#include <boost/config.hpp>
+#include <boost/timer.hpp>
+#include <algorithm>
+#include <iostream>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+int const REPEAT_COUNT = 3;
+
+double const duration = 0.125;
+
+
+namespace
+{
+ struct fused_sum
+ {
+ template <typename Seq>
+ int operator()(Seq const & seq) const
+ {
+ int state = 0;
+ return boost::fusion::fold(seq, state, sum_op());
+ }
+
+ typedef int result_type;
+
+ private:
+
+ struct sum_op
+ {
+ template <typename T>
+ int operator()(T const & elem, int value) const
+ {
+ return value + sizeof(T) * elem;
+ }
+
+ template <typename T>
+ int operator()(T & elem, int value) const
+ {
+ elem += sizeof(T);
+ return value;
+ }
+
+ typedef int result_type;
+ };
+ };
+
+ struct unfused_sum
+ {
+ inline int operator()() const
+ {
+ return 0;
+ }
+ template<typename T0>
+ inline int operator()(T0 const & a0) const
+ {
+ return a0;
+ }
+ template<typename T0, typename T1>
+ inline int operator()(T0 const & a0, T1 const & a1) const
+ {
+ return a0 + a1;
+ }
+ template<typename T0, typename T1, typename T2>
+ inline int operator()(T0 const & a0, T1 const & a1, T2 a2) const
+ {
+ return a0 + a1 + a2;
+ }
+ template<typename T0, typename T1, typename T2, typename T3>
+ inline int operator()(T0 const & a0, T1 const & a1, T2 const & a2, T3 const & a3) const
+ {
+ return a0 + a1 + a2 + a3;
+ }
+
+ typedef int result_type;
+ };
+
+ template<typename F>
+ double call_unfused(F const & func, int & j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i += func();
+ i += func(0);
+ i += func(0,1);
+ i += func(0,1,2);
+ i += func(0,1,2,3);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = func(); j += i;
+ i = func(0); j += i;
+ i = func(0,1); j += i;
+ i = func(0,1,2); j += i;
+ i = func(0,1,2,3); j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+ }
+
+ template<typename F>
+ double call_fused_ra(F const & func, int & j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ do
+ {
+ boost::fusion::vector<> v0;
+ boost::fusion::vector<int> v1(0);
+ boost::fusion::vector<int,int> v2(0,1);
+ boost::fusion::vector<int,int,int> v3(0,1,2);
+ boost::fusion::vector<int,int,int,int> v4(0,1,2,3);
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i += func(v0);
+ i += func(v1);
+ i += func(v2);
+ i += func(v3);
+ i += func(v4);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ boost::fusion::vector<> v0;
+ boost::fusion::vector<int> v1(0);
+ boost::fusion::vector<int,int> v2(0,1);
+ boost::fusion::vector<int,int,int> v3(0,1,2);
+ boost::fusion::vector<int,int,int,int> v4(0,1,2,3);
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = func(v0); j += i;
+ i = func(v1); j += i;
+ i = func(v2); j += i;
+ i = func(v3); j += i;
+ i = func(v4); j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+ }
+
+ template<typename F>
+ double call_fused(F const & func, int & j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ do
+ {
+ boost::fusion::list<> l0;
+ boost::fusion::list<int> l1(0);
+ boost::fusion::list<int,int> l2(0,1);
+ boost::fusion::list<int,int,int> l3(0,1,2);
+ boost::fusion::list<int,int,int,int> l4(0,1,2,3);
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i += func(l0);
+ i += func(l1);
+ i += func(l2);
+ i += func(l3);
+ i += func(l4);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ boost::fusion::list<> l0;
+ boost::fusion::list<int> l1(0);
+ boost::fusion::list<int,int> l2(0,1);
+ boost::fusion::list<int,int,int> l3(0,1,2);
+ boost::fusion::list<int,int,int,int> l4(0,1,2,3);
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = func(l0); j += i;
+ i = func(l1); j += i;
+ i = func(l2); j += i;
+ i = func(l3); j += i;
+ i = func(l4); j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+ }
+}
+
+int main()
+{
+ int total = 0;
+ int res;
+ typedef fused_sum F;
+ typedef unfused_sum U;
+
+ std::cout << "Compiler: " << BOOST_COMPILER << std::endl;
+ std::cout << std::endl << "Unfused adapters:" << std::endl;
+ {
+ F f;
+ std::cout << "F /* a fused function object */ " << call_fused_ra(f,res) << std::endl;
+ total += res;
+ }
+ {
+ F f;
+ std::cout << "without random access " << call_fused(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::lightweight_forward_adapter< boost::fusion::unfused<F> > f;
+ std::cout << "lightweight_forward_adapter< unfused<F> > " << call_unfused(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::forward_adapter< boost::fusion::unfused<F> > f;
+ std::cout << "forward_adapter< unfused<F> > " << call_unfused(f,res) << std::endl;
+ total += res;
+ }
+ std::cout << std::endl << "Fused adapters:" << std::endl;
+ {
+ unfused_sum f;
+ std::cout << "U /* an unfused function object */ " << call_unfused(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::fusion::fused_function_object<U> f;
+ std::cout << "fused_function_object<U> " << call_fused_ra(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::fusion::fused_function_object<U> f;
+ std::cout << "without random access " << call_fused(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::lightweight_forward_adapter< boost::fusion::unfused< boost::fusion::fused_function_object<U> > > f;
+ std::cout << "lightweight_forward_adapter< unfused<fused_function_object<U> > >" << call_unfused(f,res) << std::endl;
+ total += res;
+ }
+ {
+ boost::forward_adapter< boost::fusion::unfused< boost::fusion::fused_function_object<U> > > f;
+ std::cout << "forward_adapter< unfused<fused_function_object<U> > > " << call_unfused(f,res) << std::endl;
+ total += res;
+ }
+
+ return total;
+}
diff --git a/src/boost/libs/fusion/example/performance/inner_product.cpp b/src/boost/libs/fusion/example/performance/inner_product.cpp
new file mode 100644
index 000000000..c9f22c7cd
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/inner_product.cpp
@@ -0,0 +1,184 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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/array.hpp>
+#include <boost/timer.hpp>
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/adapted/array.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <algorithm>
+#include <numeric>
+#include <functional>
+#include <iostream>
+#include <cmath>
+#include <limits>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+int const REPEAT_COUNT = 10;
+
+double const duration = 0.5;
+
+namespace
+{
+ struct poly_add
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_add(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + rhs;
+ }
+ };
+
+ struct poly_mult
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_mult(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs * rhs;
+ }
+ };
+
+ template<int N>
+ double time_for_std_inner_product(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+ template<int N>
+ double time_for_fusion_inner_product(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::transform(arr1, arr2, poly_mult()), 0, poly_add());
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::transform(arr1, arr2, poly_mult()), 0, poly_add());
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+}
+
+int main()
+{
+ int total = 0;
+ int res;
+
+ std::cout << "short inner_product std test " << time_for_std_inner_product<8>(res) << std::endl;
+ total += res;
+ std::cout << "short inner_product fusion test " << time_for_fusion_inner_product<8>(res) << std::endl;
+ total += res;
+
+ std::cout << "medium inner_product std test " << time_for_std_inner_product<64>(res) << std::endl;
+ total += res;
+ std::cout << "medium inner_product fusion test " << time_for_fusion_inner_product<64>(res) << std::endl;
+ total += res;
+
+ std::cout << "long inner_product std test " << time_for_std_inner_product<128>(res) << std::endl;
+ total += res;
+ std::cout << "long inner_product fusion test " << time_for_fusion_inner_product<128>(res) << std::endl;
+ total += res;
+
+ return total;
+}
diff --git a/src/boost/libs/fusion/example/performance/inner_product2.cpp b/src/boost/libs/fusion/example/performance/inner_product2.cpp
new file mode 100644
index 000000000..f1d536afd
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/inner_product2.cpp
@@ -0,0 +1,206 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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/array.hpp>
+#include <boost/timer.hpp>
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/adapted/array.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <algorithm>
+#include <numeric>
+#include <functional>
+#include <iostream>
+#include <cmath>
+#include <limits>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+int const REPEAT_COUNT = 10;
+
+double const duration = 0.5;
+
+namespace
+{
+ struct poly_add
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_add(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + rhs;
+ }
+ };
+
+ struct poly_mult
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_mult(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs * rhs;
+ }
+ };
+
+ template<int N>
+ double time_for_std_inner_product(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = std::inner_product(arr1.begin(), arr1.end(), arr2.begin(), 0);
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+
+ struct poly_combine
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_combine(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ typename result<poly_combine(Lhs,Rhs)>::type
+ operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + boost::fusion::at_c<0>(rhs) * boost::fusion::at_c<1>(rhs);
+ }
+ };
+
+ template<int N>
+ double time_for_fusion_inner_product2(int& j)
+ {
+ boost::timer tim;
+ int i = 0;
+ long long iter = 65536;
+ long long counter, repeats;
+ double result = (std::numeric_limits<double>::max)();
+ double runtime = 0;
+ double run;
+ boost::array<int, N> arr1;
+ boost::array<int, N> arr2;
+ std::generate(arr1.begin(), arr1.end(), rand);
+ std::generate(arr2.begin(), arr2.end(), rand);
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::zip(arr1, arr2), 0, poly_combine());
+ static_cast<void>(i);
+ }
+ runtime = tim.elapsed();
+ iter *= 2;
+ } while(runtime < duration);
+ iter /= 2;
+
+ std::cout << iter << " iterations" << std::endl;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ i = boost::fusion::accumulate(
+ boost::fusion::zip(arr1, arr2), 0, poly_combine());
+ j += i;
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ std::cout << i << std::endl;
+ return result / iter;
+ }
+}
+
+int main()
+{
+ int total = 0;
+ int res;
+
+ std::cout << "short inner_product std test " << time_for_std_inner_product<8>(res) << std::endl;
+ total += res;
+ std::cout << "short inner_product fusion 2 test " << time_for_fusion_inner_product2<8>(res) << std::endl;
+ total += res;
+
+ std::cout << "medium inner_product std test " << time_for_std_inner_product<64>(res) << std::endl;
+ total += res;
+ std::cout << "medium inner_product fusion 2 test " << time_for_fusion_inner_product2<64>(res) << std::endl;
+ total += res;
+
+#if 0 // Leads to ICE with MSVC 8.0
+ std::cout << "long inner_product std test " << time_for_std_inner_product<128>(res) << std::endl;
+ total += res;
+ std::cout << "long inner_product fusion 2 test " << time_for_fusion_inner_product2<128>(res) << std::endl;
+ total += res;
+#endif
+
+ return total;
+}
diff --git a/src/boost/libs/fusion/example/performance/measure.hpp b/src/boost/libs/fusion/example/performance/measure.hpp
new file mode 100644
index 000000000..72cd71ba6
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/measure.hpp
@@ -0,0 +1,85 @@
+// Copyright David Abrahams, Matthias Troyer, Michael Gauckler
+// 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)
+
+#if !defined(LIVE_CODE_TYPE)
+# define LIVE_CODE_TYPE int
+#endif
+
+#include <boost/timer.hpp>
+
+namespace test
+{
+ // This value is required to ensure that a smart compiler's dead
+ // code elimination doesn't optimize away anything we're testing.
+ // We'll use it to compute the return code of the executable to make
+ // sure it's needed.
+ LIVE_CODE_TYPE live_code;
+
+ // Call objects of the given Accumulator type repeatedly with x as
+ // an argument.
+ template <class Accumulator, class Arg>
+ void hammer(Arg const& x, long const repeats)
+ {
+ // Strategy: because the sum in an accumulator after each call
+ // depends on the previous value of the sum, the CPU's pipeline
+ // might be stalled while waiting for the previous addition to
+ // complete. Therefore, we allocate an array of accumulators,
+ // and update them in sequence, so that there's no dependency
+ // between adjacent addition operations.
+ //
+ // Additionally, if there were only one accumulator, the
+ // compiler or CPU might decide to update the value in a
+ // register rather that writing it back to memory. we want each
+ // operation to at least update the L1 cache. *** Note: This
+ // concern is specific to the particular application at which
+ // we're targeting the test. ***
+
+ // This has to be at least as large as the number of
+ // simultaneous accumulations that can be executing in the
+ // compiler pipeline. A safe number here is larger than the
+ // machine's maximum pipeline depth. If you want to test the L2
+ // or L3 cache, or main memory, you can increase the size of
+ // this array. 1024 is an upper limit on the pipeline depth of
+ // current vector machines.
+ const std::size_t number_of_accumulators = 1024;
+ live_code = 0; // reset to zero
+
+ Accumulator a[number_of_accumulators];
+
+ for (long iteration = 0; iteration < repeats; ++iteration)
+ {
+ for (Accumulator* ap = a; ap < a + number_of_accumulators; ++ap)
+ {
+ (*ap)(x);
+ }
+ }
+
+ // Accumulate all the partial sums to avoid dead code
+ // elimination.
+ for (Accumulator* ap = a; ap < a + number_of_accumulators; ++ap)
+ {
+ live_code += ap->sum;
+ }
+ }
+
+ // Measure the time required to hammer accumulators of the given
+ // type with the argument x.
+ template <class Accumulator, class T>
+ double measure(T const& x, long const repeats)
+ {
+ // Hammer accumulators a couple of times to ensure the
+ // instruction cache is full of our test code, and that we don't
+ // measure the cost of a page fault for accessing the data page
+ // containing the memory where the accumulators will be
+ // allocated
+ hammer<Accumulator>(x, repeats);
+ hammer<Accumulator>(x, repeats);
+
+ // Now start a timer
+ boost::timer time;
+ hammer<Accumulator>(x, repeats); // This time, we'll measure
+ return time.elapsed() / repeats; // return the time of one iteration
+ }
+}
diff --git a/src/boost/libs/fusion/example/performance/sequence_efficiency.cpp b/src/boost/libs/fusion/example/performance/sequence_efficiency.cpp
new file mode 100644
index 000000000..307ecdf3f
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/sequence_efficiency.cpp
@@ -0,0 +1,248 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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 "measure.hpp"
+
+#define FUSION_MAX_LIST_SIZE 30
+#define FUSION_MAX_VECTOR_SIZE 30
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+
+#include <boost/type_traits/remove_reference.hpp>
+
+#include <boost/lexical_cast.hpp>
+#include <boost/preprocessor/stringize.hpp>
+#include <boost/preprocessor/enum.hpp>
+
+#include <iostream>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+// About the tests:
+//
+// The tests below compare various fusion sequences to see how abstraction
+// affects prformance.
+//
+// We have 3 sequence sizes for each fusion sequence we're going to test.
+//
+// small = 3 elements
+// medium = 10 elements
+// big = 30 elements
+//
+// The sequences are initialized with values 0..N-1 from numeric strings
+// parsed by boost::lexical_cast to make sure that the compiler is not
+// optimizing by replacing the computation with constant results computed
+// at compile time.
+//
+// These sequences will be subjected to our accumulator which calls
+// fusion::accumulate:
+//
+// this->sum += boost::fusion::accumulate(seq, 0, poly_add());
+//
+// where poly_add simply sums the current value with the content of
+// the sequence element. This accumulator will be called many times
+// through the "hammer" test (see measure.hpp).
+//
+// The tests are compared against a base using a plain_accumulator
+// which does a simple addition:
+//
+// this->sum += x;
+
+namespace
+{
+ struct poly_add
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename Lhs, typename Rhs>
+ struct result<poly_add(Lhs, Rhs)>
+ : boost::remove_reference<Lhs>
+ {};
+
+ template<typename Lhs, typename Rhs>
+ Lhs operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return lhs + rhs;
+ }
+ };
+
+ // Our Accumulator function
+ template <typename T>
+ struct accumulator
+ {
+ accumulator()
+ : sum()
+ {}
+
+ template <typename Sequence>
+ void operator()(Sequence const& seq)
+ {
+ this->sum += boost::fusion::accumulate(seq, 0, poly_add());
+ }
+
+ T sum;
+ };
+
+ // Plain Accumulator function
+ template <typename T>
+ struct plain_accumulator
+ {
+ plain_accumulator()
+ : sum()
+ {}
+
+ template <typename X>
+ void operator()(X const& x)
+ {
+ this->sum += x;
+ }
+
+ T sum;
+ };
+
+ template <typename T>
+ void check(T const& seq, char const* info)
+ {
+ test::measure<accumulator<int> >(seq, 1);
+ std::cout << info << test::live_code << std::endl;
+ }
+
+ template <typename T>
+ void measure(T const& seq, char const* info, long const repeats, double base)
+ {
+ double t = test::measure<accumulator<int> >(seq, repeats);
+ std::cout
+ << info
+ << t
+ << " (" << int((t/base)*100) << "%)"
+ << std::endl;
+ }
+
+ template <typename T>
+ void test_assembler(T const& seq)
+ {
+ test::live_code = boost::fusion::accumulate(seq, 0, poly_add());
+ }
+}
+
+// We'll initialize the sequences from numeric strings that
+// pass through boost::lexical_cast to make sure that the
+// compiler is not optimizing by replacing the computation
+// with constant results computed at compile time.
+#define INIT(z, n, text) boost::lexical_cast<int>(BOOST_PP_STRINGIZE(n))
+
+int main()
+{
+ using namespace boost::fusion;
+ std::cout.setf(std::ios::scientific);
+
+ vector<
+ int, int, int
+ >
+ vsmall(BOOST_PP_ENUM(3, INIT, _));
+
+ list<
+ int, int, int
+ >
+ lsmall(BOOST_PP_ENUM(3, INIT, _));
+
+ vector<
+ int, int, int, int, int, int, int, int, int, int
+ >
+ vmedium(BOOST_PP_ENUM(10, INIT, _));
+
+ list<
+ int, int, int, int, int, int, int, int, int, int
+ >
+ lmedium(BOOST_PP_ENUM(10, INIT, _));
+
+ vector<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ >
+ vbig(BOOST_PP_ENUM(30, INIT, _));
+
+ list<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ >
+ lbig(BOOST_PP_ENUM(30, INIT, _));
+
+ // first decide how many repetitions to measure
+ long repeats = 100;
+ double measured = 0;
+ while (measured < 2.0 && repeats <= 10000000)
+ {
+ repeats *= 10;
+
+ boost::timer time;
+
+ test::hammer<plain_accumulator<int> >(0, repeats);
+ test::hammer<accumulator<int> >(vsmall, repeats);
+ test::hammer<accumulator<int> >(lsmall, repeats);
+ test::hammer<accumulator<int> >(vmedium, repeats);
+ test::hammer<accumulator<int> >(lmedium, repeats);
+ test::hammer<accumulator<int> >(vbig, repeats);
+ test::hammer<accumulator<int> >(lbig, repeats);
+
+ measured = time.elapsed();
+ }
+
+ test::measure<plain_accumulator<int> >(1, 1);
+ std::cout
+ << "base accumulated result: "
+ << test::live_code
+ << std::endl;
+
+ double base_time = test::measure<plain_accumulator<int> >(1, repeats);
+ std::cout
+ << "base time: "
+ << base_time;
+
+ std::cout
+ << std::endl
+ << "-------------------------------------------------------------------"
+ << std::endl;
+
+ check(vsmall, "small vector accumulated result: ");
+ check(lsmall, "small list accumulated result: ");
+ check(vmedium, "medium vector accumulated result: ");
+ check(lmedium, "medium list accumulated result: ");
+ check(vbig, "big vector accumulated result: ");
+ check(lbig, "big list accumulated result: ");
+
+ std::cout
+ << "-------------------------------------------------------------------"
+ << std::endl;
+
+ measure(vsmall, "small vector time: ", repeats, base_time);
+ measure(lsmall, "small list time: ", repeats, base_time);
+ measure(vmedium, "medium vector time: ", repeats, base_time);
+ measure(lmedium, "medium list time: ", repeats, base_time);
+ measure(vbig, "big vector time: ", repeats, base_time);
+ measure(lbig, "big list time: ", repeats, base_time);
+
+ std::cout
+ << "-------------------------------------------------------------------"
+ << std::endl;
+
+ // Let's see how this looks in assembler
+ test_assembler(vmedium);
+
+ // This is ultimately responsible for preventing all the test code
+ // from being optimized away. Change this to return 0 and you
+ // unplug the whole test's life support system.
+ return test::live_code != 0;
+}
diff --git a/src/boost/libs/fusion/example/performance/timings.txt b/src/boost/libs/fusion/example/performance/timings.txt
new file mode 100644
index 000000000..355491708
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/timings.txt
@@ -0,0 +1,57 @@
+===============================================================================
+Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
+
+Use, modification and distribution is 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)
+===============================================================================
+
+Timing result for sequence_efficiency.cpp comparing the speed of various
+fusion sequences. The test involves accumulating the elements of the
+sequence which is primed to have values 0..N (N=size of sequence). Small,
+medium and big sequences are tested where:
+
+ small = 3 elements
+ medium = 10 elements
+ big = 30 elements
+
+Tester: Joel de Guzman. WinXP, P4-3.0GHZ, 2GB RAM
+
+VC7.1 (flags = /MD /O2 /EHsc /GS)
+
+ small vector time: 1.870000e-006
+ small list time: 1.870000e-006
+ medium vector time: 1.880000e-006
+ medium list time: 3.600000e-006
+ big vector time: 2.030000e-006
+ big list time: 8.910000e-006
+
+VC8.0 (flags = /MD /O2 /EHsc /GS)
+
+ small vector time: 2.500000e-05
+ small list time: 2.500000e-05
+ medium vector time: 7.810000e-05
+ medium list time: 7.810000e-05
+ big vector time: 2.469000e-04
+ big list time: 2.453000e-04
+
+G++ 3.4 (flags = -ftemplate-depth-128 -funroll-loops -O3 -finline-functions -Wno-inline -Wall)
+
+ small vector time: 2.500000e-05
+ small list time: 2.500000e-05
+ medium vector time: 7.970000e-05
+ medium list time: 7.970000e-05
+ big vector time: 2.516000e-04
+ big list time: 2.485000e-04
+
+Intel 9.1 (flags = /MD /O2 /EHsc /GS)
+
+ small vector time: 1.125000e-006
+ small list time: 1.125000e-006
+ medium vector time: 1.125000e-006
+ medium list time: 1.141000e-006
+ big vector time: 1.140000e-006
+ big list time: 1.141000e-006
+
+
+
diff --git a/src/boost/libs/fusion/example/performance/zip_efficiency.cpp b/src/boost/libs/fusion/example/performance/zip_efficiency.cpp
new file mode 100644
index 000000000..6d240f2ca
--- /dev/null
+++ b/src/boost/libs/fusion/example/performance/zip_efficiency.cpp
@@ -0,0 +1,155 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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 "measure.hpp"
+
+//~ #define FUSION_MAX_VECTOR_SIZE 30
+
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <iostream>
+
+#ifdef _MSC_VER
+// inline aggressively
+# pragma inline_recursion(on) // turn on inline recursion
+# pragma inline_depth(255) // max inline depth
+#endif
+
+namespace
+{
+ struct zip_add
+ {
+ template<typename Lhs, typename Rhs>
+ struct result
+ {
+ typedef typename
+ boost::remove_reference<
+ typename boost::fusion::result_of::value_at_c<Lhs, 0>::type
+ >::type
+ type;
+ };
+
+ template<typename Lhs, typename Rhs>
+ typename result<Lhs, Rhs>::type
+ operator()(const Lhs& lhs, const Rhs& rhs) const
+ {
+ return boost::fusion::at_c<0>(lhs) + boost::fusion::at_c<1>(lhs) + rhs;
+ }
+ };
+
+ // Our Accumulator function
+ template <typename T>
+ struct zip_accumulator
+ {
+ zip_accumulator()
+ : sum()
+ {}
+
+ template <typename Sequence>
+ void operator()(Sequence const& seq)
+ {
+ this->sum += boost::fusion::accumulate(seq, 0, zip_add());
+ }
+
+ T sum;
+ };
+
+ template <typename T>
+ void check(T const& seq, char const* info)
+ {
+ test::measure<zip_accumulator<int> >(seq, 1);
+ std::cout << info << test::live_code << std::endl;
+ }
+
+ template <typename T>
+ void measure(T const& seq, char const* info, long const repeats)
+ {
+ std::cout
+ << info
+ << test::measure<zip_accumulator<int> >(seq, repeats)
+ << std::endl;
+ }
+}
+
+int main()
+{
+ using namespace boost::fusion;
+
+ std::cout.setf(std::ios::scientific);
+
+ vector<
+ int, int, int
+ >
+ vsmall_1(BOOST_PP_ENUM_PARAMS(3,));
+
+ vector<
+ int, int, int
+ >
+ vsmall_2(BOOST_PP_ENUM_PARAMS(3,));
+
+ vector<
+ int, int, int, int, int, int, int, int, int, int
+ >
+ vmedium_1(BOOST_PP_ENUM_PARAMS(10,));
+
+ vector<
+ int, int, int, int, int, int, int, int, int, int
+ >
+ vmedium_2(BOOST_PP_ENUM_PARAMS(10,));
+
+ //~ vector<
+ //~ int, int, int, int, int, int, int, int, int, int
+ //~ , int, int, int, int, int, int, int, int, int, int
+ //~ , int, int, int, int, int, int, int, int, int, int
+ //~ >
+ //~ vbig_1(BOOST_PP_ENUM_PARAMS(30,));
+
+ //~ vector<
+ //~ int, int, int, int, int, int, int, int, int, int
+ //~ , int, int, int, int, int, int, int, int, int, int
+ //~ , int, int, int, int, int, int, int, int, int, int
+ //~ >
+ //~ vbig_2(BOOST_PP_ENUM_PARAMS(30,));
+
+ // first decide how many repetitions to measure
+ long repeats = 100;
+ double measured = 0;
+ while (measured < 2.0 && repeats <= 10000000)
+ {
+ repeats *= 10;
+
+ boost::timer time;
+
+ test::hammer<zip_accumulator<int> >(zip(vsmall_1, vsmall_2), repeats);
+ test::hammer<zip_accumulator<int> >(zip(vmedium_1, vmedium_2), repeats);
+ //~ test::hammer<zip_accumulator<int> >(zip(vbig_1, vbig_2), repeats);
+
+ measured = time.elapsed();
+ }
+
+ check(zip(vsmall_1, vsmall_2),
+ "small zip accumulated result: ");
+ check(zip(vmedium_1, vmedium_2),
+ "medium zip accumulated result: ");
+ //~ check(zip(vbig_1, vbig_2),
+ //~ "big zip accumulated result: ");
+
+ measure(zip(vsmall_1, vsmall_2),
+ "small zip time: ", repeats);
+ measure(zip(vmedium_1, vmedium_2),
+ "medium zip time: ", repeats);
+ //~ measure(zip(vbig_1, vbig_2),
+ //~ "big zip time: ", repeats);
+
+ // This is ultimately responsible for preventing all the test code
+ // from being optimized away. Change this to return 0 and you
+ // unplug the whole test's life support system.
+ return test::live_code != 0;
+}
diff --git a/src/boost/libs/fusion/index.html b/src/boost/libs/fusion/index.html
new file mode 100644
index 000000000..1eb81150a
--- /dev/null
+++ b/src/boost/libs/fusion/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
+ </head>
+ <body>
+ Automatic redirection failed, click this
+ <a href="doc/html/index.html">link</a> &nbsp;<hr>
+ <p>© Copyright Beman Dawes, 2001</p>
+ <p>Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file <a href="../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</a> or copy at
+ <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/src/boost/libs/fusion/meta/explicit-failures-markup.xml b/src/boost/libs/fusion/meta/explicit-failures-markup.xml
new file mode 100644
index 000000000..c2e6ea979
--- /dev/null
+++ b/src/boost/libs/fusion/meta/explicit-failures-markup.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<explicit-failures-markup>
+ <!-- fusion -->
+ <library name="fusion">
+ <mark-expected-failures>
+ <test name="define_struct_inline_move"/>
+ <test name="define_tpl_struct_inline_move"/>
+ <toolset name="msvc-10.0"/>
+ <toolset name="msvc-11.0"/>
+ <toolset name="msvc-12.0"/>
+ <toolset name="qcc-4.4.2_x86"/>
+ <toolset name="gcc-4.4~c++0x*"/>
+ <toolset name="gcc-4.4~gnu0x*"/>
+ <note author="Kohei Takahashi">
+ The compiler doesn't generate defaulted move ctor/assgin thus
+ perform copy construction/assginment. Even though such case,
+ the `inline` versions don't force generating move ctor/assign
+ to preserve trivial requirements. Since that is not documented
+ behaviour, it might be changed in future release.
+ </note>
+ </mark-expected-failures>
+ </library>
+</explicit-failures-markup>
diff --git a/src/boost/libs/fusion/meta/libraries.json b/src/boost/libs/fusion/meta/libraries.json
new file mode 100644
index 000000000..d60f74e52
--- /dev/null
+++ b/src/boost/libs/fusion/meta/libraries.json
@@ -0,0 +1,20 @@
+{
+ "key": "fusion",
+ "name": "Fusion",
+ "authors": [
+ "Joel de Guzman",
+ "Dan Marsden",
+ "Tobias Schwinger"
+ ],
+ "description": "Library for working with tuples, including various containers, algorithms, etc.",
+ "documentation": "doc/html/",
+ "category": [
+ "Data",
+ "Metaprogramming"
+ ],
+ "maintainers": [
+ "Joel de Guzman <joel -at- boost-consulting.com>",
+ "Dan Marsden <danmarsden -at- yahoo.co.uk>",
+ "Tobias Schwinger <tschwinger -at- isonews2.com>"
+ ]
+}
diff --git a/src/boost/libs/fusion/preprocess/Jamfile.v2 b/src/boost/libs/fusion/preprocess/Jamfile.v2
new file mode 100644
index 000000000..49423be07
--- /dev/null
+++ b/src/boost/libs/fusion/preprocess/Jamfile.v2
@@ -0,0 +1,41 @@
+# (C) Copyright 2012: Eric Niebler
+# 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)
+
+# Generates preprocessed files with wave.
+
+import feature ;
+import toolset ;
+
+feature.feature fusion-limit : : free ;
+toolset.flags wave FUSION-LIMIT <fusion-limit> ;
+
+project : requirements <link>static <variant>release ;
+
+actions wave bind FUSION-LIMIT
+{
+ echo Preprocessing with FUSION_MAX_VECTOR_SIZE=$(FUSION-LIMIT)...
+ $(>[2]) -o- -DFUSION_MAX_VECTOR_SIZE=$(FUSION-LIMIT) -DFUSION_MAX_LIST_SIZE=$(FUSION-LIMIT) -DFUSION_MAX_ZIP_SEQUENCES=$(FUSION-LIMIT) --config-file wave.cfg $(>[1])
+}
+
+W = /boost/libs/wave/tool//wave ;
+
+make preprocess_fusion_10
+ : preprocess_fusion.cpp $(W) : wave : <fusion-limit>10
+ ;
+
+make preprocess_fusion_20
+ : preprocess_fusion.cpp $(W) : wave : <fusion-limit>20
+ ;
+
+make preprocess_fusion_30
+ : preprocess_fusion.cpp $(W) : wave : <fusion-limit>30
+ ;
+
+make preprocess_fusion_40
+ : preprocess_fusion.cpp $(W) : wave : <fusion-limit>40
+ ;
+
+make preprocess_fusion_50
+ : preprocess_fusion.cpp $(W) : wave : <fusion-limit>50
+ ;
diff --git a/src/boost/libs/fusion/preprocess/preprocess_fusion.cpp b/src/boost/libs/fusion/preprocess/preprocess_fusion.cpp
new file mode 100644
index 000000000..a727bf2c3
--- /dev/null
+++ b/src/boost/libs/fusion/preprocess/preprocess_fusion.cpp
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright 2011 Eric Niebler. 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 "../include/boost/fusion/adapted.hpp"
+#include "../include/boost/fusion/algorithm.hpp"
+#include "../include/boost/fusion/container.hpp"
+#include "../include/boost/fusion/functional.hpp"
+#include "../include/boost/fusion/iterator.hpp"
+#include "../include/boost/fusion/mpl.hpp"
+#include "../include/boost/fusion/sequence.hpp"
+#include "../include/boost/fusion/support.hpp"
+#include "../include/boost/fusion/tuple.hpp"
+#include "../include/boost/fusion/view.hpp"
diff --git a/src/boost/libs/fusion/preprocess/wave.cfg b/src/boost/libs/fusion/preprocess/wave.cfg
new file mode 100644
index 000000000..b88198d7c
--- /dev/null
+++ b/src/boost/libs/fusion/preprocess/wave.cfg
@@ -0,0 +1,31 @@
+# (C) Copyright 2012: Eric Niebler
+# 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)
+
+# NOTE: Some of the paths in this file may need to be changed for your system.
+
+-DBOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+-DBOOST_FUSION_CREATE_PREPROCESSED_FILES
+-D_WIN32
+-D_M_IX86
+-NBOOST_CLANG
+-NBOOST_STATIC_ASSERT
+-NBOOST_FORCEINLINE
+-NBOOST_CONSTEXPR
+-NBOOST_CXX14_CONSTEXPR
+-NBOOST_NOEXCEPT
+-NBOOST_NO_CXX11_RVALUE_REFERENCES
+-NBOOST_MPL_ASSERT
+-NBOOST_MPL_ASSERT_MSG
+-NBOOST_MPL_ASSERT_RELATION
+-NBOOST_GPU_ENABLED
+-NBOOST_FUSION_GPU_ENABLED
+-NBOOST_FUSION_HAS_VARIADIC_MAP
+-NBOOST_FUSION_VECTOR_COPY_INIT
+-NBOOST_FUSION_VECTOR_CTOR_HELPER
+-NBOOST_FUSION_BARRIER_BEGIN
+-NBOOST_FUSION_BARRIER_END
+-S..\include
+-S..\..\..
+-S"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE"
+--variadics
diff --git a/src/boost/libs/fusion/test/Jamfile b/src/boost/libs/fusion/test/Jamfile
new file mode 100644
index 000000000..e55b15ad2
--- /dev/null
+++ b/src/boost/libs/fusion/test/Jamfile
@@ -0,0 +1,277 @@
+##==============================================================================
+# Copyright (c) 2003-2006 Joel de Guzman
+# Copyright (c) 2013 Mateusz Loskot
+# Copyright (c) 2014-2018 Kohei Takahashi
+#
+# Use, modification and distribution is 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)
+#==============================================================================
+# bring in rules for testing
+import testing ;
+import os ;
+import ../../config/checks/config : requires ;
+
+if [ os.environ CI ]
+{
+ CI_DEFINES = <define>CI_SKIP_KNOWN_FAILURE=1 ;
+}
+
+project
+ : requirements
+ $(CI_DEFINES)
+ ;
+
+{
+ test-suite fusion :
+
+ [ run algorithm/all.cpp ]
+ [ run algorithm/any.cpp ]
+ [ run algorithm/clear.cpp ]
+ [ run algorithm/copy.cpp ]
+ [ run algorithm/count.cpp ]
+ [ run algorithm/count_if.cpp ]
+ [ run algorithm/erase.cpp ]
+ [ run algorithm/erase_key.cpp ]
+ [ run algorithm/filter.cpp ]
+ [ run algorithm/filter_if.cpp ]
+ [ run algorithm/find.cpp ]
+ [ run algorithm/find_if.cpp ]
+ [ run algorithm/fold.cpp ]
+ [ run algorithm/for_each.cpp ]
+ [ run algorithm/insert.cpp ]
+ [ run algorithm/insert_range.cpp ]
+ [ run algorithm/iter_fold.cpp ]
+ [ run algorithm/move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run algorithm/none.cpp ]
+ [ run algorithm/pop_back.cpp ]
+ [ run algorithm/pop_front.cpp ]
+ [ run algorithm/push_back.cpp ]
+ [ run algorithm/push_front.cpp ]
+ [ run algorithm/remove.cpp ]
+ [ run algorithm/remove_if.cpp ]
+ [ run algorithm/replace.cpp ]
+ [ run algorithm/replace_if.cpp ]
+ [ run algorithm/reverse_fold.cpp ]
+ [ run algorithm/reverse_iter_fold.cpp ]
+ [ run algorithm/reverse.cpp ]
+ [ run algorithm/segmented_for_each.cpp ]
+ [ run algorithm/segmented_find.cpp ]
+ [ run algorithm/segmented_find_if.cpp ]
+ [ run algorithm/segmented_fold.cpp ]
+ [ run algorithm/transform.cpp ]
+ [ run algorithm/join.cpp ]
+ [ run algorithm/zip.cpp ]
+ [ run algorithm/zip2.cpp ]
+ [ run algorithm/zip_ignore.cpp ]
+ [ run algorithm/flatten.cpp ]
+ [ compile algorithm/ticket-5490.cpp ]
+
+ [ run sequence/as_deque.cpp ]
+ [ run sequence/as_list.cpp ]
+ [ run sequence/as_map.cpp ]
+ [ run sequence/as_map_assoc.cpp ]
+ [ run sequence/as_set.cpp ]
+ [ run sequence/as_vector.cpp ]
+ [ run sequence/boost_tuple.cpp ]
+ [ run sequence/boost_tuple_iterator.cpp ]
+ [ run sequence/cons.cpp ]
+ [ run sequence/convert_boost_tuple.cpp ]
+ [ run sequence/convert_deque.cpp ]
+ [ run sequence/convert_list.cpp ]
+ [ run sequence/convert_std_pair.cpp ]
+ [ run sequence/convert_std_tuple.cpp : :
+ : [ requires cxx11_variadic_templates cxx11_hdr_tuple ] ]
+ [ run sequence/convert_vector.cpp ]
+ [ run sequence/filter_view.cpp ]
+ [ run sequence/hash.cpp ]
+ [ run sequence/io.cpp ]
+ [ run sequence/iterator_range.cpp ]
+ [ run sequence/joint_view.cpp ]
+ [ run sequence/list_comparison.cpp ]
+ [ run sequence/list_construction.cpp ]
+ [ run sequence/list_copy.cpp ]
+ [ run sequence/list_iterator.cpp ]
+ [ run sequence/list_hash.cpp ]
+ [ run sequence/list_make.cpp ]
+ [ run sequence/list_misc.cpp ]
+ [ run sequence/list_mutate.cpp ]
+ [ run sequence/list_nest.cpp ]
+ [ run sequence/list_tie.cpp ]
+ [ run sequence/list_value_at.cpp ]
+ [ run sequence/deque_comparison.cpp ]
+ [ run sequence/deque_construction.cpp ]
+ [ run sequence/deque_copy.cpp ]
+ [ run sequence/deque_iterator.cpp ]
+ [ run sequence/deque_hash.cpp ]
+ [ compile sequence/deque_is_constructible.cpp ]
+ [ run sequence/deque_make.cpp ]
+ [ run sequence/deque_misc.cpp ]
+ [ run sequence/deque_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/deque_mutate.cpp ]
+ [ run sequence/deque_nest.cpp ]
+ [ run sequence/deque_tie.cpp ]
+ [ run sequence/deque_value_at.cpp ]
+ [ run sequence/front_extended_deque.cpp ]
+ [ run sequence/back_extended_deque.cpp ]
+ [ run sequence/make_list.cpp ]
+ [ run sequence/make_vector.cpp ]
+ [ run sequence/map.cpp ]
+ [ run sequence/map_comparison.cpp ]
+ [ run sequence/map_construction.cpp ]
+ [ run sequence/map_copy.cpp ]
+ [ run sequence/map_misc.cpp ]
+ [ run sequence/map_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/map_mutate.cpp ]
+ [ run sequence/map_tie.cpp ]
+ [ run sequence/nil.cpp ]
+ [ run sequence/nview.cpp ]
+ [ run sequence/reverse_view.cpp ]
+ [ run sequence/segmented_iterator_range.cpp ]
+ [ run sequence/set.cpp ]
+ [ run sequence/single_view.cpp ]
+ [ run sequence/std_pair.cpp ]
+ [ run sequence/boost_array.cpp ]
+ [ run sequence/array.cpp ]
+ [ run sequence/std_array.cpp : :
+ : [ requires cxx11_hdr_array ] ]
+ [ run sequence/tuple_comparison.cpp ]
+ [ run sequence/tuple_construction.cpp ]
+ [ run sequence/tuple_conversion.cpp ]
+ [ run sequence/tuple_copy.cpp ]
+ [ run sequence/tuple_element.cpp ]
+ [ run sequence/tuple_make.cpp ]
+ [ run sequence/tuple_misc.cpp ]
+ [ run sequence/tuple_mutate.cpp ]
+ [ run sequence/tuple_nest.cpp ]
+ [ run sequence/tuple_hash.cpp ]
+ [ run sequence/tuple_tie.cpp ]
+ [ run sequence/tuple_traits.cpp : :
+ :
+ : tuple_traits__maybe_variadic ]
+ [ run sequence/tuple_traits.cpp : :
+ : <define>BOOST_FUSION_DISABLE_VARIADIC_VECTOR
+ : tuple_traits__no_variadic ]
+ [ run sequence/transform_view.cpp ]
+ [ run sequence/vector_comparison.cpp ]
+ [ run sequence/vector_construction.cpp ]
+ [ run sequence/vector_conversion.cpp ]
+ [ run sequence/vector_copy.cpp ]
+ [ run sequence/vector_iterator.cpp ]
+ [ run sequence/vector_make.cpp ]
+ [ run sequence/vector_misc.cpp ]
+ [ run sequence/vector_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/vector_mutate.cpp ]
+ [ run sequence/vector_n.cpp ]
+ [ run sequence/vector_nest.cpp ]
+ [ run sequence/vector_hash.cpp ]
+ [ run sequence/vector_tie.cpp ]
+ [ run sequence/vector_traits.cpp : :
+ :
+ : vector_traits__maybe_variadic ]
+ [ run sequence/vector_traits.cpp : :
+ : <define>BOOST_FUSION_DISABLE_VARIADIC_VECTOR
+ : vector_traits__no_variadic ]
+ [ run sequence/vector_value_at.cpp ]
+ [ run sequence/zip_view.cpp ]
+ [ run sequence/zip_view2.cpp ]
+ [ run sequence/zip_view_ignore.cpp ]
+ [ run sequence/repetitive_view.cpp ]
+ [ run sequence/deduce_sequence.cpp ]
+ [ run sequence/adapt_adt_named.cpp ]
+ [ run sequence/adapt_adt_named_empty.cpp ]
+ [ run sequence/adapt_adt.cpp ]
+ [ run sequence/adapt_adt_empty.cpp ]
+ [ run sequence/adapt_assoc_adt_named.cpp ]
+ [ run sequence/adapt_assoc_adt_named_empty.cpp ]
+ [ run sequence/adapt_assoc_adt.cpp ]
+ [ run sequence/adapt_assoc_adt_empty.cpp ]
+ [ run sequence/adapt_assoc_struct_named.cpp ]
+ [ run sequence/adapt_assoc_struct_named_empty.cpp ]
+ [ run sequence/adapt_assoc_struct.cpp ]
+ [ run sequence/adapt_assoc_struct_empty.cpp ]
+ [ run sequence/adapt_assoc_tpl_adt.cpp ]
+ [ run sequence/adapt_assoc_tpl_adt_empty.cpp ]
+ [ run sequence/adapt_assoc_tpl_struct.cpp ]
+ [ run sequence/adapt_assoc_tpl_struct_empty.cpp ]
+ [ run sequence/adapt_struct_named.cpp ]
+ [ run sequence/adapt_struct_named_empty.cpp ]
+ [ run sequence/adapt_struct.cpp ]
+ [ run sequence/adapt_struct_empty.cpp ]
+ [ run sequence/adapt_tpl_adt.cpp ]
+ [ run sequence/adapt_tpl_adt_empty.cpp ]
+ [ run sequence/adapt_tpl_struct.cpp ]
+ [ run sequence/adapt_tpl_struct_empty.cpp ]
+ [ run sequence/adt_attribute_proxy.cpp ]
+ [ run sequence/define_struct.cpp ]
+ [ run sequence/define_struct_empty.cpp ]
+ [ run sequence/define_struct_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/define_struct_inline.cpp ]
+ [ run sequence/define_struct_inline_empty.cpp ]
+ [ run sequence/define_struct_inline_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/define_assoc_struct.cpp ]
+ [ run sequence/define_assoc_struct_empty.cpp ]
+ [ run sequence/define_assoc_struct_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/define_tpl_struct.cpp ]
+ [ run sequence/define_tpl_struct_empty.cpp ]
+ [ run sequence/define_tpl_struct_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/define_tpl_struct_inline.cpp ]
+ [ run sequence/define_tpl_struct_inline_empty.cpp ]
+ [ run sequence/define_tpl_struct_inline_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/define_assoc_tpl_struct.cpp ]
+ [ run sequence/define_assoc_tpl_struct_empty.cpp ]
+ [ run sequence/define_assoc_tpl_struct_move.cpp : :
+ : [ requires cxx11_rvalue_references ] ]
+ [ run sequence/std_tuple.cpp : :
+ : [ requires cxx11_variadic_templates cxx11_hdr_tuple ] ]
+ [ run sequence/std_tuple_iterator.cpp : :
+ : [ requires cxx11_variadic_templates cxx11_hdr_tuple ] ]
+ [ run sequence/ref_vector.cpp ]
+ [ run sequence/flatten_view.cpp ]
+ [ compile sequence/github-159.cpp ]
+ [ run sequence/github-176.cpp ]
+
+ [ compile sequence/size.cpp ]
+
+ [ run functional/fused.cpp ]
+ [ run functional/fused_function_object.cpp ]
+ [ run functional/fused_procedure.cpp ]
+ [ run functional/unfused.cpp ]
+ [ run functional/unfused_typed.cpp ]
+ [ run functional/make_fused.cpp ]
+ [ run functional/make_fused_function_object.cpp ]
+ [ run functional/make_fused_procedure.cpp ]
+ [ run functional/make_unfused.cpp ]
+ [ run functional/invoke.cpp ]
+ [ run functional/invoke_function_object.cpp ]
+ [ run functional/invoke_procedure.cpp ]
+ [ run sequence/swap.cpp ]
+
+ [ compile support/is_sequence.cpp ]
+ [ compile support/is_view.cpp ]
+ [ compile support/pair_deque.cpp ]
+ [ compile support/pair_list.cpp ]
+ [ compile support/pair_map.cpp ]
+ [ compile support/pair_set.cpp ]
+ [ compile support/pair_vector.cpp ]
+ [ compile support/pair_nest.cpp ]
+ [ compile support/index_sequence.cpp
+ : [ requires cxx11_variadic_templates ] ]
+ [ compile support/and.cpp
+ : [ requires cxx11_variadic_templates ] ]
+ [ compile support/tag_of.cpp ]
+ [ compile support/unused.cpp ]
+
+# [ compile-fail xxx.cpp ]
+
+ ;
+}
diff --git a/src/boost/libs/fusion/test/algorithm/all.cpp b/src/boost/libs/fusion/test/algorithm/all.cpp
new file mode 100644
index 000000000..7b5550732
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/all.cpp
@@ -0,0 +1,70 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/algorithm/query/all.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+namespace
+{
+ struct search_for
+ {
+ explicit search_for(int in_search)
+ : search(in_search)
+ {}
+
+ template<typename T>
+ bool operator()(T const& v) const
+ {
+ return v == search;
+ }
+
+ int search;
+ };
+}
+
+int
+main()
+{
+ {
+ boost::fusion::vector<> t;
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
+ }
+
+ {
+ boost::fusion::vector<int, short, double, long> t(1, 2, 3.3, 2);
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 < 4)));
+ BOOST_TEST((boost::fusion::all(t, boost::lambda::_1 > 0)));
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST((!boost::fusion::all(t, boost::lambda::_1 == 1)));
+ BOOST_TEST((!boost::fusion::all(t, boost::lambda::_1 < 3)));
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1> mpl_vec;
+ // We cannot use lambda here as mpl vec iterators return
+ // rvalues, and lambda needs lvalues.
+ BOOST_TEST(boost::fusion::all(mpl_vec(), search_for(1)));
+ BOOST_TEST(!boost::fusion::all(mpl_vec(), search_for(2)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/any.cpp b/src/boost/libs/fusion/test/algorithm/any.cpp
new file mode 100644
index 000000000..da0aa7933
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/any.cpp
@@ -0,0 +1,57 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005 Eric Niebler
+ Copyright (c) Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/algorithm/query/any.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+namespace
+{
+ struct search_for
+ {
+ explicit search_for(int in_search)
+ : search(in_search)
+ {}
+
+ template<typename T>
+ bool operator()(T const& v) const
+ {
+ return v == search;
+ }
+
+ int search;
+ };
+}
+
+int
+main()
+{
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST(boost::fusion::any(t, boost::lambda::_1 == 2));
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST(!boost::fusion::any(t, boost::lambda::_1 == 3));
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3> mpl_vec;
+ // We cannot use lambda here as mpl vec iterators return
+ // rvalues, and lambda needs lvalues.
+ BOOST_TEST(boost::fusion::any(mpl_vec(), search_for(2)));
+ BOOST_TEST(!boost::fusion::any(mpl_vec(), search_for(4)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/clear.cpp b/src/boost/libs/fusion/test/algorithm/clear.cpp
new file mode 100644
index 000000000..f90f5c0a6
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/clear.cpp
@@ -0,0 +1,45 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/clear.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing pop_back
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+
+ {
+ std::cout << clear(t1) << std::endl;
+ BOOST_TEST((clear(t1) == make_vector()));
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ std::cout << boost::fusion::clear(mpl_vec()) << std::endl;
+ BOOST_TEST((boost::fusion::clear(mpl_vec()) == make_vector()));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/copy.cpp b/src/boost/libs/fusion/test/algorithm/copy.cpp
new file mode 100644
index 000000000..330caca62
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/copy.cpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+#include <boost/fusion/algorithm/auxiliary/copy.hpp>
+
+int
+main()
+{
+ {
+ boost::fusion::vector<int, short, double> v(1, 2, 3);
+ boost::fusion::list<int, short, double> l;
+
+ boost::fusion::copy(v, l);
+ BOOST_TEST(v == l);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/count.cpp b/src/boost/libs/fusion/test/algorithm/count.cpp
new file mode 100644
index 000000000..13aaad1a6
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/count.cpp
@@ -0,0 +1,41 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005 Eric Niebler
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/algorithm/query/count.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <string>
+
+int
+main()
+{
+ {
+ boost::fusion::vector<int, short, double> t(1, 1, 1);
+ BOOST_TEST(boost::fusion::count(t, 1) == 3);
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST(boost::fusion::count(t, 3) == 0);
+ }
+
+ {
+ boost::fusion::vector<int, std::string, double> t(4, "hello", 4);
+ BOOST_TEST(boost::fusion::count(t, "hello") == 1);
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 2, 2, 3, 3> mpl_vec;
+ BOOST_TEST(boost::fusion::count(mpl_vec(), 2) == 3);
+ BOOST_TEST(boost::fusion::count(mpl_vec(), 3) == 2);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/count_if.cpp b/src/boost/libs/fusion/test/algorithm/count_if.cpp
new file mode 100644
index 000000000..7555f6fcb
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/count_if.cpp
@@ -0,0 +1,46 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005 Eric Niebler
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/algorithm/query/count_if.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <functional>
+
+template <typename F> struct bind1st;
+template <template <typename> class F, typename T>
+struct bind1st<F<T> > : public F<T>
+{
+ T n;
+ bind1st(T n) : n(n) { }
+ bool operator()(T v) const { return F<T>::operator()(n, v); }
+};
+
+int
+main()
+{
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST(boost::fusion::count_if(t, bind1st<std::equal_to<double> >(2)) == 1);
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST(boost::fusion::count_if(t, bind1st<std::equal_to<double> >(3)) == 0);
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3> mpl_vec;
+ // Cannot use lambda here as mpl iterators return rvalues and lambda needs lvalues
+ BOOST_TEST(boost::fusion::count_if(mpl_vec(), bind1st<std::greater_equal<int> >(2)) == 2);
+ BOOST_TEST(boost::fusion::count_if(mpl_vec(), bind1st<std::less<int> >(2)) == 1);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/erase.cpp b/src/boost/libs/fusion/test/algorithm/erase.cpp
new file mode 100644
index 000000000..f376ba2a5
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/erase.cpp
@@ -0,0 +1,63 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/vector/vector_iterator.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/erase.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/advance.hpp>
+#include <boost/mpl/int.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector_c;
+ using boost::mpl::begin;
+ using boost::mpl::advance;
+ using boost::mpl::int_;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing erase
+
+ {
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, "Ruby");
+ vector_iterator<vector_type, 2> pos(t1);
+
+ std::cout << erase(t1, pos) << std::endl;
+ BOOST_TEST((erase(t1, pos) == make_vector(1, 'x', std::string("Ruby"))));
+ BOOST_TEST((erase(t1, end(t1)) == make_vector(1, 'x', 3.3, std::string("Ruby"))));
+ }
+
+ {
+ typedef vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ typedef boost::mpl::begin<mpl_vec>::type mpl_vec_begin;
+ typedef boost::mpl::advance<mpl_vec_begin, int_<3> >::type mpl_vec_at3;
+ typedef boost::mpl::next<mpl_vec_begin>::type n1;
+ typedef boost::mpl::next<n1>::type n2;
+ typedef boost::mpl::next<n2>::type n3;
+
+ BOOST_STATIC_ASSERT((boost::is_same<mpl_vec_at3, n3>::value));
+
+
+ std::cout << erase(mpl_vec(), mpl_vec_at3()) << std::endl;
+ BOOST_TEST((erase(mpl_vec(), mpl_vec_at3())
+ == make_vector(1, 2, 3, 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/erase_key.cpp b/src/boost/libs/fusion/test/algorithm/erase_key.cpp
new file mode 100644
index 000000000..34f69248c
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/erase_key.cpp
@@ -0,0 +1,74 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/set/set.hpp>
+#include <boost/fusion/container/generation/make_set.hpp>
+#include <boost/fusion/container/map/map.hpp>
+#include <boost/fusion/container/generation/make_map.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/container/set/convert.hpp>
+#include <boost/fusion/container/map/convert.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/algorithm/transformation/erase_key.hpp>
+#include <boost/fusion/algorithm/query/find.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+template <typename Set>
+void test_set(Set const& set)
+{
+ using namespace boost::fusion;
+ std::cout << set << std::endl;
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Set>::value == 3);
+ BOOST_TEST((*find<int>(set) == 1));
+ BOOST_TEST((*find<double>(set) == 1.5));
+ BOOST_TEST((*find<std::string>(set) == "hello"));
+}
+
+typedef boost::mpl::int_<1> _1;
+typedef boost::mpl::int_<2> _2;
+typedef boost::mpl::int_<3> _3;
+typedef boost::mpl::int_<4> _4;
+
+template <typename Map>
+void test_map(Map const& map)
+{
+ using namespace boost::fusion;
+ std::cout << map << std::endl;
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Map>::value == 3);
+ BOOST_TEST(((*find<_1>(map)).second == 1));
+ BOOST_TEST(((*find<_3>(map)).second == 1.5));
+ BOOST_TEST(((*find<_4>(map)).second == std::string("hello")));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+ using namespace std;
+ using boost::fusion::pair;
+ using boost::fusion::make_pair;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ test_set(erase_key<char>(make_set(1, 'x', 1.5, std::string("hello"))));
+ test_map(erase_key<_2>(make_map<_1, _2, _3, _4>(1, 'x', 1.5, "hello")));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/filter.cpp b/src/boost/libs/fusion/test/algorithm/filter.cpp
new file mode 100644
index 000000000..e762e4322
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/filter.cpp
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/filter.hpp>
+#include <boost/mpl/vector.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ typedef boost::fusion::vector<char,double,char> vector_type;
+ vector_type t('a', 6.6, 'b');
+
+ {
+ std::cout << filter<char>(t) << std::endl;
+ BOOST_TEST((filter<char>(t)
+ == make_vector('a', 'b')));
+ }
+
+ {
+ typedef boost::mpl::vector<char,double,char> mpl_vec;
+ BOOST_TEST((filter<char>(mpl_vec())
+ == make_vector('\0', '\0')));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/filter_if.cpp b/src/boost/libs/fusion/test/algorithm/filter_if.cpp
new file mode 100644
index 000000000..830813de6
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/filter_if.cpp
@@ -0,0 +1,77 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/filter_if.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/not.hpp>
+
+struct X
+{
+ operator char const*() const
+ {
+ return "<X-object>";
+ }
+};
+
+struct Y
+{
+ operator char const*() const
+ {
+ return "<Y-object>";
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ using boost::mpl::_;
+ using boost::mpl::not_;
+ using boost::is_class;
+ using boost::is_same;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing filter_if
+
+ X x; Y y;
+ typedef boost::fusion::vector<Y, char, long, X, bool, double> vector_type;
+ vector_type t(y, '@', 987654, x, true, 6.6);
+
+ {
+ std::cout << filter_if<not_<is_class<_> > >(t) << std::endl;
+ BOOST_TEST((filter_if<not_<is_class<_> > >(t)
+ == make_vector('@', 987654, true, 6.6)));
+ }
+
+ {
+ std::cout << filter_if<is_class<_> >(t) << std::endl;
+ BOOST_TEST((filter_if<is_class<_> >(t)
+ == make_vector(y, x)));
+ }
+
+ {
+ typedef boost::mpl::vector<Y, char, long, X, bool> mpl_vec;
+ BOOST_TEST((filter_if<not_<is_class<_> > >(mpl_vec())
+ == make_vector(char(), long(), bool())));
+ BOOST_TEST((filter_if<is_class<_> >(mpl_vec())
+ == make_vector(y, x)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/find.cpp b/src/boost/libs/fusion/test/algorithm/find.cpp
new file mode 100644
index 000000000..83a86f1d9
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/find.cpp
@@ -0,0 +1,79 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/set/set.hpp>
+#include <boost/fusion/container/map/map.hpp>
+#include <boost/fusion/algorithm/query/find.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/mpl/vector.hpp>
+#include <string>
+
+struct X
+{
+ operator int() const
+ {
+ return 12345;
+ }
+};
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::identity;
+
+ {
+ typedef vector<int, char, int, double> seq_type;
+ seq_type seq(12345, 'x', 678910, 3.36);
+
+ std::cout << *boost::fusion::find<char>(seq) << std::endl;
+ BOOST_TEST(*boost::fusion::find<char>(seq) == 'x');
+
+ std::cout << *boost::fusion::find<int>(seq) << std::endl;
+ BOOST_TEST(*boost::fusion::find<int>(seq) == 12345);
+
+ std::cout << *boost::fusion::find<double>(seq) << std::endl;
+ BOOST_TEST(*boost::fusion::find<double>(seq) == 3.36);
+
+ BOOST_TEST(boost::fusion::find<bool>(seq) == boost::fusion::end(seq));
+ }
+
+ {
+ typedef set<int, char, double> seq_type;
+ seq_type seq(12345, 'x', 3.36);
+ std::cout << *boost::fusion::find<char>(seq) << std::endl;
+ BOOST_TEST(*boost::fusion::find<char>(seq) == 'x');
+ BOOST_TEST(boost::fusion::find<bool>(seq) == boost::fusion::end(seq));
+ }
+
+ {
+ typedef map<
+ pair<int, char>
+ , pair<double, std::string> >
+ map_type;
+
+ map_type seq(
+ make_pair<int>('X')
+ , make_pair<double>("Men"));
+
+ std::cout << *boost::fusion::find<int>(seq) << std::endl;
+ std::cout << *boost::fusion::find<double>(seq) << std::endl;
+ BOOST_TEST((*boost::fusion::find<int>(seq)).second == 'X');
+ BOOST_TEST((*boost::fusion::find<double>(seq)).second == "Men");
+ BOOST_TEST(boost::fusion::find<bool>(seq) == boost::fusion::end(seq));
+ }
+
+ {
+ typedef boost::mpl::vector<int, char, X, double> mpl_vec;
+ BOOST_TEST((*boost::fusion::find<X>(mpl_vec()) == 12345));
+ BOOST_TEST(boost::fusion::find<bool>(mpl_vec()) == boost::fusion::end(mpl_vec()));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/find_if.cpp b/src/boost/libs/fusion/test/algorithm/find_if.cpp
new file mode 100644
index 000000000..c4dfafa28
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/find_if.cpp
@@ -0,0 +1,69 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/algorithm/query/find_if.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct X
+{
+ operator int() const
+ {
+ return 12345;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ {
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector<int, char, int, double> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36);
+
+ std::cout << *find_if<is_same<_, char> >(v) << std::endl;
+ BOOST_TEST((*find_if<is_same<_, char> >(v) == 'x'));
+
+ std::cout << *find_if<is_same<_, int> >(v) << std::endl;
+ BOOST_TEST((*find_if<is_same<_, int> >(v) == 12345));
+
+ std::cout << *find_if<is_same<_, double> >(v) << std::endl;
+ BOOST_TEST((*find_if<is_same<_, double> >(v) == 3.36));
+ }
+
+ {
+ using boost::mpl::vector;
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector<int, char, X, double> mpl_vec;
+ BOOST_TEST((*find_if<is_same<_, X> >(mpl_vec()) == 12345));
+ }
+
+ {
+ using boost::mpl::vector_c;
+ using boost::mpl::less;
+ using boost::mpl::int_;
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector_c<int, 1, 2, 3, 4> mpl_vec;
+ BOOST_TEST((*find_if<less<_, int_<3> > >(mpl_vec()) == 1));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/flatten.cpp b/src/boost/libs/fusion/test/algorithm/flatten.cpp
new file mode 100644
index 000000000..ddc71006f
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/flatten.cpp
@@ -0,0 +1,57 @@
+/*==============================================================================
+ Copyright (c) 2013 Jamboree
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/fusion/algorithm/auxiliary/copy.hpp>
+#include <boost/fusion/algorithm/transformation/flatten.hpp>
+
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq(1, 2, make_vector(3, 4), 5);
+
+ BOOST_TEST((boost::fusion::size(flatten(seq)) == 5));
+ }
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq(1, 2, make_vector(3, 4), 5);
+ std::cout << flatten(seq) << std::endl;
+ BOOST_TEST((flatten(seq) == make_vector(1, 2, 3, 4, 5)));
+ }
+
+ {
+ std::cout << flatten(make_vector(1, 2, make_vector(3, 4), 5)) << std::endl;
+ BOOST_TEST((flatten(make_vector(1, 2, make_vector(3, 4), 5)) == make_vector(1, 2, 3, 4, 5)));
+ }
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq;
+ result_of::flatten<sequence_type>::type flat(flatten(seq));
+ copy(make_vector(1, 2, 3, 4, 5), flat);
+ std::cout << seq << std::endl;
+ BOOST_TEST((seq == make_vector(1, 2, make_vector(3, 4), 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/fold.cpp b/src/boost/libs/fusion/test/algorithm/fold.cpp
new file mode 100644
index 000000000..c441ceaf0
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/fold.cpp
@@ -0,0 +1,257 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/algorithm/iteration/accumulate.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/vector.hpp>
+
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_reference.hpp>
+
+#include <string>
+
+using boost::mpl::if_;
+using boost::mpl::int_;
+using boost::is_same;
+
+struct add_ints_only
+{
+ template<typename T>
+ struct result;
+
+ template <typename State, typename T>
+ struct result<add_ints_only(State, T)>
+ {
+ typedef typename boost::remove_const<
+ typename boost::remove_reference<State>::type>::type type;
+ };
+
+ template <typename State, typename T>
+ State
+ operator()(State const& state, T const& /*x*/) const
+ {
+ return state;
+ }
+
+ int
+ operator()(int state, int x) const
+ {
+ return x + state;
+ }
+};
+
+struct count_ints
+{
+ template<typename T>
+ struct result;
+
+ template <typename CountT, typename T>
+ struct result<count_ints(CountT, T)>
+ {
+ typedef typename boost::remove_const<
+ typename boost::remove_reference<CountT>::type>::type state;
+ typedef typename boost::remove_const<
+ typename boost::remove_reference<T>::type>::type elem;
+
+ typedef typename
+ if_<
+ is_same<elem, int>
+ , typename boost::mpl::next<state>::type
+ , state
+ >::type
+ type;
+ };
+
+ template <typename CountT, typename T>
+ typename result<count_ints(CountT, T)>::type
+ operator()(CountT const&, T const&) const
+ {
+ typedef typename result<count_ints(CountT, T)>::type result_;
+ return result_();
+ }
+};
+
+struct appender
+{
+ typedef std::string result_type;
+
+ std::string operator()(std::string const& str, char c) const
+ {
+ return str + c;
+ }
+};
+
+struct lvalue_adder
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename T0, typename T1>
+ struct result<lvalue_adder(T0, T1&)>
+ {
+ // Second argument still needs to support rvalues - see definition of fusion::fold
+ typedef T1 type;
+ };
+
+ template<typename T0, typename T1>
+ T1 operator()(T0 const& lhs, T1& rhs) const
+ {
+ return lhs + rhs;
+ }
+};
+
+int add(int lhs, int rhs)
+{
+ return lhs + rhs;
+}
+
+struct functor
+{
+ template<typename T>
+ int
+ operator() (int hitherho, T const& cur) const
+ {
+ return int(hitherho + cur);
+ }
+};
+
+struct visitor
+{
+ typedef int result_type;
+
+ int operator()(int sum, long&)
+ {
+ return sum;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ namespace fusion = boost::fusion;
+
+ {
+ typedef vector<int, char, int, double> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36);
+ int result = fold(v, 0, add_ints_only());
+ std::cout << result << std::endl;
+ BOOST_TEST(result == 12345+678910);
+ }
+
+ {
+ typedef vector<int> vector_type;
+ vector_type v(12345);
+
+ int n = fusion::fold(v, int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 1);
+ }
+
+ {
+ typedef vector<int, char, int, double, int> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36, 8756);
+
+ int n = fusion::fold(v, int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 3);
+ }
+
+ {
+ typedef boost::mpl::vector<int, char, int, double, int> mpl_vec;
+ int n = fusion::fold(mpl_vec(), int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 3);
+ }
+
+ {
+ BOOST_TEST(fusion::fold(fusion::make_vector('a','b','c','d','e'), std::string(""), appender())
+ == "abcde");
+ }
+
+ {
+ vector<int, int> vec(1,2);
+ BOOST_TEST(fusion::fold(vec, 0, lvalue_adder()) == 3);
+ }
+
+ {
+ vector<int, int> vec(1,2);
+ BOOST_TEST(fusion::fold(vec, 0, add) == 3);
+ }
+
+ {
+ typedef vector<int, char, int, double> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36);
+ int result = accumulate(v, 0, add_ints_only());
+ std::cout << result << std::endl;
+ BOOST_TEST(result == 12345+678910);
+ }
+
+ {
+ typedef vector<int> vector_type;
+ vector_type v(12345);
+
+ int n = fusion::accumulate(v, int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 1);
+ }
+
+ {
+ typedef vector<int, char, int, double, int> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36, 8756);
+
+ int n = fusion::accumulate(v, int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 3);
+ }
+
+ {
+ typedef boost::mpl::vector<int, char, int, double, int> mpl_vec;
+ int n = fusion::accumulate(mpl_vec(), int_<0>(), count_ints());
+ std::cout << n << std::endl;
+ BOOST_TEST(n == 3);
+ }
+
+ {
+ BOOST_TEST(fusion::accumulate(fusion::make_vector('a','b','c','d','e'), std::string(""), appender())
+ == "abcde");
+ }
+
+ {
+ vector<int, int> vec(1,2);
+ BOOST_TEST(fusion::accumulate(vec, 0, add) == 3);
+ }
+
+ {
+#if defined(BOOST_RESULT_OF_USE_DECLTYPE)
+ {
+ boost::fusion::vector<int, double, long> container{1, 2, 3};
+ functor f;
+ boost::fusion::fold(container, 0, f);
+ }
+#endif
+
+ {
+ boost::fusion::vector<long> vec;
+ visitor v;
+ boost::fusion::fold(vec, 0, v);
+ }
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/algorithm/fold.hpp b/src/boost/libs/fusion/test/algorithm/fold.hpp
new file mode 100644
index 000000000..997623ea8
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/fold.hpp
@@ -0,0 +1,212 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/algorithm/transformation/reverse.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/algorithm/iteration/reverse_fold.hpp>
+#include <boost/fusion/algorithm/iteration/iter_fold.hpp>
+#include <boost/fusion/algorithm/iteration/reverse_iter_fold.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/range_c.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/back_inserter.hpp>
+#include <boost/mpl/always.hpp>
+#include <boost/mpl/copy.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <iostream>
+
+namespace mpl=boost::mpl;
+namespace fusion=boost::fusion;
+
+#ifdef BOOST_FUSION_TEST_REVERSE_FOLD
+# ifdef BOOST_FUSION_TEST_ITER_FOLD
+# define BOOST_FUSION_TEST_FOLD_NAME reverse_iter_fold
+# else
+# define BOOST_FUSION_TEST_FOLD_NAME reverse_fold
+# endif
+#else
+# ifdef BOOST_FUSION_TEST_ITER_FOLD
+# define BOOST_FUSION_TEST_FOLD_NAME iter_fold
+# else
+# define BOOST_FUSION_TEST_FOLD_NAME fold
+# endif
+#endif
+
+struct sum
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename Self, typename State, typename T>
+ struct result<Self(State,T)>
+ : boost::fusion::result_of::make_pair<
+ mpl::int_<
+ boost::remove_reference<
+ State
+ >::type::first_type::value+1
+ >
+ , int
+ >
+ {
+ BOOST_MPL_ASSERT((typename boost::is_reference<State>::type));
+ BOOST_MPL_ASSERT((typename boost::is_reference<T>::type));
+ };
+
+#ifdef BOOST_FUSION_TEST_ITER_FOLD
+ template<typename State, typename It>
+ typename result<sum const&(State const&,It const&)>::type
+ operator()(State const& state, It const& it)const
+ {
+ static const int n=State::first_type::value;
+ return fusion::make_pair<mpl::int_<n+1> >(
+ state.second+fusion::deref(it)*n);
+ }
+#else
+ template<typename State>
+ typename result<sum const&(State const&, int const&)>::type
+ operator()(State const& state, int const& e)const
+ {
+ static const int n=State::first_type::value;
+ return fusion::make_pair<mpl::int_<n+1> >(state.second+e*n);
+ }
+#endif
+};
+
+struct meta_sum
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename Self, typename State, typename T>
+ struct result<Self(State,T)>
+ {
+ BOOST_MPL_ASSERT((typename boost::is_reference<State>::type));
+ BOOST_MPL_ASSERT((typename boost::is_reference<T>::type));
+
+ typedef typename boost::remove_reference<State>::type state;
+ static const int n=mpl::front<state>::type::value;
+
+#ifdef BOOST_FUSION_TEST_ITER_FOLD
+ typedef typename
+ boost::fusion::result_of::value_of<
+ typename boost::remove_reference<T>::type
+ >::type
+ t;
+#else
+ typedef typename boost::remove_reference<T>::type t;
+#endif
+
+ typedef
+ mpl::vector<
+ mpl::int_<n+1>
+ , mpl::int_<
+ mpl::back<state>::type::value+t::value*n
+ >
+ >
+ type;
+ };
+
+ template<typename State, typename T>
+ typename result<meta_sum const&(State const&,T const&)>::type
+ operator()(State const&, T const&)const;
+};
+
+struct fold_test_n
+{
+ template<typename I>
+ void
+ operator()(I)const
+ {
+ static const int n=I::value;
+ typedef mpl::range_c<int, 0, n> range;
+
+ static const int squares_sum=n*(n+1)*(2*n+1)/6;
+
+ {
+ mpl::range_c<int, 1, n+1> init_range;
+ typename boost::fusion::result_of::as_vector<
+ typename mpl::transform<
+ range
+ , mpl::always<int>
+ , mpl::back_inserter<mpl::vector<> >
+ >::type
+ >::type vec(
+#ifdef BOOST_FUSION_TEST_REVERSE_FOLD
+ fusion::reverse(init_range)
+#else
+ init_range
+#endif
+ );
+
+ int result=BOOST_FUSION_TEST_FOLD_NAME(
+ vec,
+ fusion::make_pair<mpl::int_<1> >(0),
+ sum()).second;
+ std::cout << n << ": " << result << std::endl;
+ BOOST_TEST(result==squares_sum);
+ }
+
+ {
+ typedef typename
+#ifdef BOOST_FUSION_TEST_REVERSE_FOLD
+ boost::fusion::result_of::as_vector<
+ typename mpl::copy<
+ mpl::range_c<int, 1, n+1>
+ , mpl::front_inserter<fusion::vector<> >
+ >::type
+ >::type
+#else
+ boost::fusion::result_of::as_vector<mpl::range_c<int, 1, n+1> >::type
+#endif
+ vec;
+
+ typedef
+ boost::is_same<
+ typename boost::fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME<
+ vec
+ , mpl::vector<mpl::int_<1>, mpl::int_<0> >
+ , meta_sum
+ >::type
+ , typename mpl::if_c<
+ !n
+ , mpl::vector<mpl::int_<1>, mpl::int_<0> >&
+ , mpl::vector<mpl::int_<n+1>, mpl::int_<squares_sum> >
+ >::type
+ >
+ result_test;
+
+ BOOST_MPL_ASSERT((result_test));
+ }
+ }
+};
+
+int
+main()
+{
+ mpl::for_each<mpl::range_c<int, 0, 10> >(fold_test_n());
+
+ return boost::report_errors();
+}
+
+#undef BOOST_FUSION_TEST_FOLD_NAME
+
diff --git a/src/boost/libs/fusion/test/algorithm/for_each.cpp b/src/boost/libs/fusion/test/algorithm/for_each.cpp
new file mode 100644
index 000000000..982cb3a12
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/for_each.cpp
@@ -0,0 +1,83 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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/core/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+struct print
+{
+ template <typename T>
+ void operator()(T const& v) const
+ {
+ std::cout << "[ " << v << " ] ";
+ }
+};
+
+struct increment
+{
+ template <typename T>
+ void operator()(T& v) const
+ {
+ ++v;
+ }
+};
+
+struct mutable_increment : increment
+{
+ template <typename T>
+ void operator()(T& v)
+ {
+ return increment::operator()(v);
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector_c;
+ namespace fusion = boost::fusion;
+
+ {
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type v(1, 'x', 3.3, "Ruby");
+ for_each(v, print());
+ std::cout << std::endl;
+ }
+
+ {
+ char const ruby[] = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type v(1, 'x', 3.3, ruby);
+ for_each(v, increment());
+ BOOST_TEST_EQ(v, vector_type(2, 'y', 4.3, ruby + 1));
+ std::cout << v << std::endl;
+ }
+
+ {
+ char const ruby[] = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type v(1, 'x', 3.3, ruby);
+ for_each(v, mutable_increment());
+ BOOST_TEST_EQ(v, vector_type(2, 'y', 4.3, ruby + 1));
+ std::cout << v << std::endl;
+ }
+
+ {
+ typedef vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ fusion::for_each(mpl_vec(), print());
+ std::cout << std::endl;
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/insert.cpp b/src/boost/libs/fusion/test/algorithm/insert.cpp
new file mode 100644
index 000000000..a4239a8de
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/insert.cpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/insert.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/advance.hpp>
+#include <boost/mpl/int.hpp>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector_c;
+ using boost::mpl::advance;
+ using boost::mpl::int_;
+ namespace fusion = boost::fusion;
+ namespace mpl = boost::mpl;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing insert
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+ vector_iterator<vector_type, 2> pos(t1);
+
+ std::cout << insert(t1, pos, 123456) << std::endl;
+ BOOST_TEST((insert(t1, pos, 123456)
+ == make_vector(1, 'x', 123456, 3.3, s)));
+
+ std::cout << insert(t1, end(t1), 123456) << std::endl;
+ BOOST_TEST((insert(t1, end(t1), 123456)
+ == make_vector(1, 'x', 3.3, s, 123456)));
+
+ std::cout << insert(t1, begin(t1), "glad") << std::endl;
+ BOOST_TEST((insert(t1, begin(t1), "glad")
+ == make_vector(std::string("glad"), 1, 'x', 3.3, s)));
+ }
+
+ {
+ typedef vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ typedef mpl::begin<mpl_vec>::type mpl_vec_begin;
+ typedef advance<mpl_vec_begin, int_<3> >::type mpl_vec_at3;
+
+ std::cout << fusion::insert(mpl_vec(), mpl_vec_at3(), int_<66>()) << std::endl;
+ BOOST_TEST((fusion::insert(mpl_vec(), mpl_vec_at3(), int_<66>())
+ == make_vector(1, 2, 3, 66, 4, 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/insert_range.cpp b/src/boost/libs/fusion/test/algorithm/insert_range.cpp
new file mode 100644
index 000000000..28a02219b
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/insert_range.cpp
@@ -0,0 +1,71 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/insert_range.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin_end.hpp>
+#include <boost/mpl/advance.hpp>
+#include <boost/mpl/int.hpp>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector_c;
+ using boost::mpl::advance;
+ using boost::mpl::int_;
+ namespace fusion = boost::fusion;
+ namespace mpl = boost::mpl;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing insert_range
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+ vector_iterator<vector_type, 2> pos(t1);
+
+ typedef vector<int, char> vector_type2;
+ vector_type2 t2(999, 'z');
+
+ std::cout << insert_range(t1, pos, t2) << std::endl;
+ BOOST_TEST((insert_range(t1, pos, t2)
+ == make_vector(1, 'x', 999, 'z', 3.3, s)));
+
+ std::cout << insert_range(t1, end(t1), t2) << std::endl;
+ BOOST_TEST((insert_range(t1, end(t1), t2)
+ == make_vector(1, 'x', 3.3, s, 999, 'z')));
+
+ std::cout << insert_range(t1, begin(t1), t2) << std::endl;
+ BOOST_TEST((insert_range(t1, begin(t1), t2)
+ == make_vector(999, 'z', 1, 'x', 3.3, s)));
+ }
+
+ {
+ typedef vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ typedef mpl::begin<mpl_vec>::type mpl_vec_begin;
+ typedef advance<mpl_vec_begin, int_<3> >::type mpl_vec_at3;
+ typedef vector_c<int, -1, -2> mpl_vec2;
+
+ std::cout << fusion::insert_range(mpl_vec(), mpl_vec_at3(), mpl_vec2()) << std::endl;
+ BOOST_TEST((fusion::insert_range(mpl_vec(), mpl_vec_at3(), mpl_vec2())
+ == make_vector(1, 2, 3, -1, -2, 4, 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/iter_fold.cpp b/src/boost/libs/fusion/test/algorithm/iter_fold.cpp
new file mode 100644
index 000000000..b37f90db5
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/iter_fold.cpp
@@ -0,0 +1,10 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#define BOOST_FUSION_TEST_ITER_FOLD
+#include "fold.hpp"
+#undef BOOST_FUSION_TEST_ITER_FOLD
diff --git a/src/boost/libs/fusion/test/algorithm/join.cpp b/src/boost/libs/fusion/test/algorithm/join.cpp
new file mode 100644
index 000000000..c0de1896a
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/join.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/algorithm/transformation/join.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/mpl/vector/vector10_c.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ BOOST_TEST(join(make_vector(1,2), make_vector('a','b')) == make_vector(1,2,'a','b'));
+ }
+ {
+ typedef boost::mpl::vector2_c<int,1,2> vec1;
+ typedef boost::mpl::vector2_c<int,3,4> vec2;
+ BOOST_TEST(join(vec1(), vec2()) == make_vector(1,2,3,4));
+
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/algorithm/move.cpp b/src/boost/libs/fusion/test/algorithm/move.cpp
new file mode 100644
index 000000000..d2f854030
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/move.cpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2014,2018 Kohei Takahashi
+
+ 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/core/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+#include <boost/fusion/algorithm/auxiliary/move.hpp>
+#include <utility>
+
+int main()
+{
+ {
+ boost::fusion::vector<int, short, double> v(1, 2, 3);
+ boost::fusion::list<int, short, double> l1 = v;
+ boost::fusion::list<int, short, double> l2;
+
+ boost::fusion::move(std::move(v), l2);
+ BOOST_TEST(l1 == l2);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/none.cpp b/src/boost/libs/fusion/test/algorithm/none.cpp
new file mode 100644
index 000000000..83dfa7528
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/none.cpp
@@ -0,0 +1,58 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/algorithm/query/none.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+namespace
+{
+ struct search_for
+ {
+ explicit search_for(int in_search)
+ : search(in_search)
+ {}
+
+ template<typename T>
+ bool operator()(T const& v) const
+ {
+ return v == search;
+ }
+
+ int search;
+ };
+}
+
+int
+main()
+{
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST((boost::fusion::none(t, boost::lambda::_1 > 4)));
+ BOOST_TEST((boost::fusion::none(t, boost::lambda::_1 < 0)));
+ }
+
+ {
+ boost::fusion::vector<int, short, double> t(1, 2, 3.3);
+ BOOST_TEST((!boost::fusion::none(t, boost::lambda::_1 == 1)));
+ BOOST_TEST((!boost::fusion::none(t, boost::lambda::_1 < 3)));
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3> mpl_vec;
+ // We cannot use lambda here as mpl vec iterators return
+ // rvalues, and lambda needs lvalues.
+ BOOST_TEST(boost::fusion::none(mpl_vec(), search_for(4)));
+ BOOST_TEST(!boost::fusion::none(mpl_vec(), search_for(3)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/pop_back.cpp b/src/boost/libs/fusion/test/algorithm/pop_back.cpp
new file mode 100644
index 000000000..fcb5b75cf
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/pop_back.cpp
@@ -0,0 +1,105 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/algorithm/transformation/pop_back.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/algorithm/query/find.hpp>
+#include <boost/fusion/include/back.hpp>
+#include <boost/fusion/include/array.hpp>
+#include <boost/array.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing pop_back
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+
+ {
+ std::cout << pop_back(t1) << std::endl;
+ BOOST_TEST((pop_back(t1) == make_vector(1, 'x', 3.3)));
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ std::cout << boost::fusion::pop_back(mpl_vec()) << std::endl;
+ BOOST_TEST((boost::fusion::pop_back(mpl_vec()) == make_vector(1, 2, 3, 4)));
+ }
+
+ {
+ list<int, int> l(1, 2);
+ std::cout << pop_back(l) << std::endl;
+ BOOST_TEST((pop_back(l) == make_list(1)));
+ }
+
+ { // make sure empty sequences are OK
+ list<int> l(1);
+ std::cout << pop_back(l) << std::endl;
+ BOOST_TEST((pop_back(l) == make_list()));
+ }
+
+ {
+ single_view<int> sv(1);
+ std::cout << pop_back(sv) << std::endl;
+
+ // Compile check only
+ (void)(begin(pop_back(sv)) == end(sv));
+ (void)(end(pop_back(sv)) == begin(sv));
+ }
+
+ // $$$ JDG: TODO add compile fail facility $$$
+ //~ { // compile fail check (Disabled for now)
+ //~ list<> l;
+ //~ std::cout << pop_back(l) << std::endl;
+ //~ }
+
+#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS
+ {
+ auto vec = make_vector(1, 3.14, "hello");
+
+ // Compile check only
+ auto popv = pop_back(vec);
+ std::cout << popv << std::endl;
+
+ auto push = push_back(vec, 42);
+ auto pop = pop_back(vec);
+ auto i1 = find<int>(popv);
+ auto i2 = find<double>(pop);
+
+ (void)push;
+ BOOST_TEST(i1 != end(pop));
+ BOOST_TEST(i2 != end(pop));
+ BOOST_TEST(i1 != i2);
+ }
+#endif
+
+ {
+ boost::array<std::size_t, 2> a = {{ 10, 50 }};
+ BOOST_TEST(back(pop_back(a)) == 10);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/pop_front.cpp b/src/boost/libs/fusion/test/algorithm/pop_front.cpp
new file mode 100644
index 000000000..df95b38c1
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/pop_front.cpp
@@ -0,0 +1,46 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/pop_front.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing pop_front
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+
+ {
+ std::cout << pop_front(t1) << std::endl;
+ BOOST_TEST((pop_front(t1) == make_vector('x', 3.3, s)));
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ std::cout << boost::fusion::pop_front(mpl_vec()) << std::endl;
+ BOOST_TEST((boost::fusion::pop_front(mpl_vec()) == make_vector(2, 3, 4, 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/push_back.cpp b/src/boost/libs/fusion/test/algorithm/push_back.cpp
new file mode 100644
index 000000000..b53007fcf
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/push_back.cpp
@@ -0,0 +1,72 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <string>
+
+struct plus_one
+{
+ template <typename T>
+ void operator()(T& v) const
+ {
+ v += 1;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing push_back
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+
+ {
+ std::cout << push_back(t1, 123456) << std::endl;
+ BOOST_TEST((push_back(t1, 123456)
+ == make_vector(1, 'x', 3.3, s, 123456)));
+ }
+
+ {
+ std::cout << push_back(t1, "funny") << std::endl;
+ BOOST_TEST((push_back(t1, "funny")
+ == make_vector(1, 'x', 3.3, s, std::string("funny"))));
+ }
+
+ {
+ std::cout << push_back(t1, t1) << std::endl;
+ BOOST_TEST((push_back(t1, t1)
+ == make_vector(1, 'x', 3.3, s, t1)));
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
+ std::cout << boost::fusion::push_back(mpl_vec(), boost::mpl::int_<6>()) << std::endl;
+ BOOST_TEST((boost::fusion::push_back(mpl_vec(), boost::mpl::int_<6>())
+ == make_vector(1, 2, 3, 4, 5, 6)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/push_front.cpp b/src/boost/libs/fusion/test/algorithm/push_front.cpp
new file mode 100644
index 000000000..8c63c5c3c
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/push_front.cpp
@@ -0,0 +1,55 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/push_front.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing push_front
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t1(1, 'x', 3.3, s);
+
+ {
+ std::cout << push_front(t1, 123456) << std::endl;
+ BOOST_TEST((push_front(t1, 123456)
+ == make_vector(123456, 1, 'x', 3.3, s)));
+ }
+
+ {
+ std::cout << push_front(t1, "lively") << std::endl;
+ BOOST_TEST((push_front(t1, "lively")
+ == make_vector(std::string("lively"), 1, 'x', 3.3, s)));
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ std::cout << boost::fusion::push_front(mpl_vec(), boost::mpl::int_<1>()) << std::endl;
+ BOOST_TEST((boost::fusion::push_front(mpl_vec(), boost::mpl::int_<1>())
+ == make_vector(1, 2, 3, 4, 5, 6)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/remove.cpp b/src/boost/libs/fusion/test/algorithm/remove.cpp
new file mode 100644
index 000000000..76e0c737c
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/remove.cpp
@@ -0,0 +1,80 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/remove.hpp>
+#include <boost/mpl/vector.hpp>
+
+struct X
+{
+ operator char const*() const
+ {
+ return "<X-object>";
+ }
+};
+
+struct Y
+{
+ operator char const*() const
+ {
+ return "<Y-object>";
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::identity;
+ using boost::mpl::vector;
+ namespace fusion = boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing remove
+
+ X x; Y y;
+ typedef fusion::vector<Y, char, long, X, bool, double> vector_type;
+ vector_type t(y, '@', 987654, x, true, 6.6);
+
+ {
+ std::cout << fusion::remove<X>(t) << std::endl;
+ BOOST_TEST((fusion::remove<X>(t)
+ == make_vector(y, '@', 987654, true, 6.6)));
+ }
+
+ {
+ std::cout << fusion::remove<Y>(t) << std::endl;
+ BOOST_TEST((fusion::remove<Y>(t)
+ == make_vector('@', 987654, x, true, 6.6)));
+ }
+
+ {
+ std::cout << fusion::remove<long>(t) << std::endl;
+ BOOST_TEST((fusion::remove<long>(t)
+ == make_vector(y, '@', x, true, 6.6)));
+ }
+
+ {
+ typedef vector<Y, char, long, X, bool> mpl_vec;
+ BOOST_TEST((fusion::remove<X>(mpl_vec())
+ == vector<Y, char, long, bool>()));
+ BOOST_TEST((fusion::remove<Y>(mpl_vec())
+ == vector<char, long, X, bool>()));
+ BOOST_TEST((fusion::remove<long>(mpl_vec())
+ == vector<Y, char, X, bool>()));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/remove_if.cpp b/src/boost/libs/fusion/test/algorithm/remove_if.cpp
new file mode 100644
index 000000000..62313d3a5
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/remove_if.cpp
@@ -0,0 +1,78 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/remove_if.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/vector.hpp>
+
+struct X
+{
+ operator char const*() const
+ {
+ return "<X-object>";
+ }
+};
+
+struct Y
+{
+ operator char const*() const
+ {
+ return "<Y-object>";
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector;
+ using boost::mpl::_;
+ using boost::mpl::not_;
+ using boost::is_class;
+ using boost::is_same;
+ namespace fusion = boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing remove_if
+
+ X x; Y y;
+ typedef fusion::vector<Y, char, long, X, bool, double> vector_type;
+ vector_type t(y, '@', 987654, x, true, 6.6);
+
+ {
+ std::cout << remove_if<not_<is_class<_> > >(t) << std::endl;
+ BOOST_TEST((remove_if<not_<is_class<_> > >(t)
+ == make_vector(y, x)));
+ }
+
+ {
+ std::cout << remove_if<is_class<_> >(t) << std::endl;
+ BOOST_TEST((remove_if<is_class<_> >(t)
+ == make_vector('@', 987654, true, 6.6)));
+ }
+
+ {
+ typedef vector<Y, char, long, X, bool> mpl_vec;
+ BOOST_TEST((remove_if<not_<is_class<_> > >(mpl_vec())
+ == vector<Y, X>()));
+ BOOST_TEST((remove_if<is_class<_> >(mpl_vec())
+ == vector<char, long, bool>()));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/replace.cpp b/src/boost/libs/fusion/test/algorithm/replace.cpp
new file mode 100644
index 000000000..ddd651301
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/replace.cpp
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/replace.hpp>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing replace
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, long, char const*> vector_type;
+ vector_type t1(1, 'x', 3, s);
+
+ {
+ std::cout << replace(t1, 'x', 'y') << std::endl;
+ BOOST_TEST((replace(t1, 'x', 'y')
+ == make_vector(1, 'y', 3, s)));
+ }
+
+ {
+ char const* s2 = "funny";
+ std::cout << replace(t1, s, s2) << std::endl;
+ BOOST_TEST((replace(t1, s, s2)
+ == make_vector(1, 'x', 3, s2)));
+ }
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/replace_if.cpp b/src/boost/libs/fusion/test/algorithm/replace_if.cpp
new file mode 100644
index 000000000..bad5905e1
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/replace_if.cpp
@@ -0,0 +1,52 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/transformation/replace_if.hpp>
+#include <string>
+
+struct gt3
+{
+ template <typename T>
+ bool operator()(T x) const
+ {
+ return x > 3;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing replace
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, short, double, long, char const*, float> vector_type;
+ vector_type t1(1, 2, 3.3, 4, s, 5.5f);
+
+ {
+ std::cout << replace_if(t1, gt3(), -456) << std::endl;
+ BOOST_TEST((replace_if(t1, gt3(), -456)
+ == make_vector(1, 2, -456, -456, s, -456)));
+ }
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/reverse.cpp b/src/boost/libs/fusion/test/algorithm/reverse.cpp
new file mode 100644
index 000000000..718d5b248
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/reverse.cpp
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/reverse.hpp>
+#include <boost/mpl/range_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing the reverse_view
+
+ {
+ typedef boost::mpl::range_c<int, 5, 9> mpl_list1;
+ mpl_list1 sequence;
+
+ std::cout << reverse(sequence) << std::endl;
+ BOOST_TEST((reverse(sequence) == make_vector(8, 7, 6, 5)));
+ }
+
+ {
+ char const* s = "Hi Kim";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type t(123, 'x', 3.36, s);
+
+ std::cout << reverse(t) << std::endl;
+ BOOST_TEST((reverse(t) == make_vector(s, 3.36, 'x', 123)));
+ std::cout << reverse(reverse(t)) << std::endl;
+ BOOST_TEST((reverse(reverse(t)) == t));
+ }
+
+ return boost::report_errors();
+}
+
+
diff --git a/src/boost/libs/fusion/test/algorithm/reverse_fold.cpp b/src/boost/libs/fusion/test/algorithm/reverse_fold.cpp
new file mode 100644
index 000000000..7742bca84
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/reverse_fold.cpp
@@ -0,0 +1,10 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#define BOOST_FUSION_TEST_REVERSE_FOLD
+#include "fold.hpp"
+#undef BOOST_FUSION_TEST_REVERSE_FOLD
diff --git a/src/boost/libs/fusion/test/algorithm/reverse_iter_fold.cpp b/src/boost/libs/fusion/test/algorithm/reverse_iter_fold.cpp
new file mode 100644
index 000000000..31e4cf265
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/reverse_iter_fold.cpp
@@ -0,0 +1,12 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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)
+==============================================================================*/
+
+#define BOOST_FUSION_TEST_REVERSE_FOLD
+#define BOOST_FUSION_TEST_ITER_FOLD
+#include "fold.hpp"
+#undef BOOST_FUSION_TEST_ITER_FOLD
+#undef BOOST_FUSION_TEST_REVERSE_FOLD
diff --git a/src/boost/libs/fusion/test/algorithm/segmented_find.cpp b/src/boost/libs/fusion/test/algorithm/segmented_find.cpp
new file mode 100644
index 000000000..8ce0b6d55
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/segmented_find.cpp
@@ -0,0 +1,62 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/algorithm/query/find.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include "../sequence/tree.hpp"
+
+struct not_there {};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+
+ typedef typename boost::fusion::result_of::find<Tree const, short>::type short_iter;
+ typedef typename boost::fusion::result_of::find<Tree const, float>::type float_iter;
+ typedef typename boost::fusion::result_of::find<Tree const, not_there>::type not_there_iter;
+
+ // find_if_s of a segmented data structure returns generic
+ // segmented iterators
+ short_iter si = fusion::find<short>(tree);
+ float_iter fi = fusion::find<float>(tree);
+
+ // they behave like ordinary Fusion iterators ...
+ BOOST_TEST((*si == short('d')));
+ BOOST_TEST((*fi == float(1)));
+
+ // Searching for something that's not there should return the end iterator.
+ not_there_iter nti = fusion::find<not_there>(tree);
+ BOOST_TEST((nti == fusion::end(tree)));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/segmented_find_if.cpp b/src/boost/libs/fusion/test/algorithm/segmented_find_if.cpp
new file mode 100644
index 000000000..98d963cff
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/segmented_find_if.cpp
@@ -0,0 +1,65 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/algorithm/query/find_if.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include "../sequence/tree.hpp"
+
+struct not_there {};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+ using mpl::_;
+
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,not_there> >::type not_there_iter;
+
+ // find_if of a segmented data structure returns generic
+ // segmented iterators
+ short_iter si = fusion::find_if<is_same<_,short> >(tree);
+ float_iter fi = fusion::find_if<is_same<_,float> >(tree);
+
+ // they behave like ordinary Fusion iterators ...
+ BOOST_TEST((*si == short('d')));
+ BOOST_TEST((*fi == float(1)));
+
+ // Searching for something that's not there should return the end iterator.
+ not_there_iter nti = fusion::find_if<is_same<_,not_there> >(tree);
+ BOOST_TEST((nti == fusion::end(tree)));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/segmented_fold.cpp b/src/boost/libs/fusion/test/algorithm/segmented_fold.cpp
new file mode 100644
index 000000000..af51ca89f
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/segmented_fold.cpp
@@ -0,0 +1,63 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+
+ 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 <string>
+#include <sstream>
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include "../sequence/tree.hpp"
+
+struct write_string
+{
+ typedef std::ostream* result_type;
+
+ template<typename T>
+ std::ostream* operator()(std::ostream* sout, T const& t) const
+ {
+ return &(*sout << t << " ");
+ }
+};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+
+ std::stringstream str;
+ fusion::fold(tree, &str, write_string());
+ std::string res = str.str();
+
+ BOOST_TEST_EQ(res, "a b c 1 2 3 100 e f 0 B 1 h i 4 5 6 j k l ");
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/segmented_for_each.cpp b/src/boost/libs/fusion/test/algorithm/segmented_for_each.cpp
new file mode 100644
index 000000000..d1f4fe6ad
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/segmented_for_each.cpp
@@ -0,0 +1,140 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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/core/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include "../sequence/tree.hpp"
+
+struct print
+{
+ template <typename T>
+ void operator()(T const& v) const
+ {
+ std::cout << "[ " << v << " ] ";
+ }
+};
+
+struct increment
+{
+ template <typename T>
+ void operator()(T& v) const
+ {
+ ++v;
+ }
+};
+
+struct mutable_increment : increment
+{
+ template <typename T>
+ void operator()(T& v)
+ {
+ return increment::operator()(v);
+ }
+};
+
+template <typename F, typename Tree>
+void test(Tree tree, Tree const& expected)
+{
+ boost::fusion::for_each(tree, F());
+ BOOST_TEST_EQ(tree, expected);
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ {
+ for_each(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ , print()
+ );
+ std::cout << std::endl;
+ }
+
+ {
+ test<increment>(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ , make_tree(
+ make_vector(double(1),'C')
+ , make_tree(
+ make_vector(2,3,long(4))
+ , make_tree(make_vector('b','c','d'))
+ , make_tree(make_vector(short('e'),'f','g'))
+ )
+ , make_tree(
+ make_vector(5,6,7)
+ , make_tree(make_vector(float(2),'i','j'))
+ , make_tree(make_vector('k','l','m'))
+ )
+ )
+ );
+ }
+
+ {
+ test<mutable_increment>(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ , make_tree(
+ make_vector(double(1),'C')
+ , make_tree(
+ make_vector(2,3,long(4))
+ , make_tree(make_vector('b','c','d'))
+ , make_tree(make_vector(short('e'),'f','g'))
+ )
+ , make_tree(
+ make_vector(5,6,7)
+ , make_tree(make_vector(float(2),'i','j'))
+ , make_tree(make_vector('k','l','m'))
+ )
+ )
+ );
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/ticket-5490.cpp b/src/boost/libs/fusion/test/algorithm/ticket-5490.cpp
new file mode 100644
index 000000000..fedf733a2
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/ticket-5490.cpp
@@ -0,0 +1,41 @@
+/*=============================================================================
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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/fusion/include/vector.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/mpl/quote.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/core/ignore_unused.hpp>
+
+using namespace boost::fusion;
+
+template <typename>
+struct predicate {};
+
+struct unique {};
+
+template <typename>
+struct meta_func
+{
+ typedef unique result_type;
+
+ template <typename T>
+ unique operator()(const T&) const;
+};
+
+int main()
+{
+ vector<int> v;
+
+ typedef predicate<boost::mpl::_1> lambda_t;
+ typedef boost::mpl::quote1<predicate> quote_t;
+
+ vector<unique> l = transform(v, meta_func<lambda_t>());
+
+ vector<unique> q = transform(v, meta_func<quote_t>());
+
+ boost::ignore_unused(l, q);
+}
diff --git a/src/boost/libs/fusion/test/algorithm/transform.cpp b/src/boost/libs/fusion/test/algorithm/transform.cpp
new file mode 100644
index 000000000..8609f61cd
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/transform.cpp
@@ -0,0 +1,157 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/algorithm/transformation/transform.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/range_c.hpp>
+#include <boost/type_traits/is_reference.hpp>
+
+struct square
+{
+ template<typename Sig>
+ struct result;
+
+ template <typename T>
+ struct result<square(T)>
+ {
+ typedef int type;
+ };
+
+ template <typename T>
+ int operator()(T x) const
+ {
+ return x * x;
+ }
+};
+
+struct add
+{
+ template<typename Sig>
+ struct result;
+
+ template <typename A, typename B>
+ struct result<add(A, B)>
+ {
+ typedef int type;
+ };
+
+ template <typename A, typename B>
+ int operator()(A a, B b) const
+ {
+ return a + b;
+ }
+};
+
+struct unary_lvalue_transform
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename T>
+ struct result<unary_lvalue_transform(T&)>
+ {
+ typedef T* type;
+ };
+
+ template<typename T>
+ T* operator()(T& t) const
+ {
+ return &t;
+ }
+};
+
+int twice(int v)
+{
+ return v*2;
+}
+
+struct binary_lvalue_transform
+{
+ template<typename Sig>
+ struct result;
+
+ template<typename T0, typename T1>
+ struct result<binary_lvalue_transform(T0&,T1&)>
+ {
+ typedef T0* type;
+ };
+
+ template<typename T0, typename T1>
+ T0* operator()(T0& t0, T1&) const
+ {
+ return &t0;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::range_c;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing the transform
+
+ {
+ typedef range_c<int, 5, 9> sequence_type;
+ sequence_type sequence;
+ std::cout << boost::fusion::transform(sequence, square()) << std::endl;
+ BOOST_TEST((boost::fusion::transform(sequence, square()) == make_vector(25, 36, 49, 64)));
+ }
+
+ {
+ typedef range_c<int, 5, 9> mpl_list1;
+ std::cout << boost::fusion::transform(mpl_list1(), square()) << std::endl;
+ BOOST_TEST((boost::fusion::transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64)));
+ }
+
+ {
+ vector<int, int, int> tup(1, 2, 3);
+ std::cout << boost::fusion::transform(tup, square()) << std::endl;
+ BOOST_TEST((boost::fusion::transform(tup, square()) == make_vector(1, 4, 9)));
+ }
+
+ {
+ vector<int, int, int> tup1(1, 2, 3);
+ vector<int, int, int> tup2(4, 5, 6);
+ std::cout << boost::fusion::transform(tup1, tup2, add()) << std::endl;
+ BOOST_TEST((boost::fusion::transform(tup1, tup2, add()) == make_vector(5, 7, 9)));
+ }
+
+ {
+ // Unary transform that requires lvalues, just check compilation
+ vector<int, int, int> tup1(1, 2, 3);
+ BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
+ BOOST_TEST(*begin(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
+ }
+
+ {
+ vector<int, int, int> tup1(1, 2, 3);
+ vector<int, int, int> tup2(4, 5, 6);
+ BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
+ BOOST_TEST(*begin(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
+ }
+
+ {
+ vector<int, int, int> tup1(1, 2, 3);
+ BOOST_TEST(boost::fusion::transform(tup1, twice) == make_vector(2,4,6));
+ }
+
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/algorithm/zip.cpp b/src/boost/libs/fusion/test/algorithm/zip.cpp
new file mode 100644
index 000000000..b6a4f097e
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/zip.cpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/mpl/vector.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ BOOST_TEST(zip(make_vector(1,2), make_vector('a','b')) == make_vector(make_vector(1,'a'), make_vector(2,'b')));
+ BOOST_TEST(
+ zip(
+ make_vector(1,2),
+ make_vector('a','b'),
+ make_vector(-1,-2))
+ == make_vector(
+ make_vector(1,'a',-1),
+ make_vector(2,'b',-2))); // Zip more than 2 sequences
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/algorithm/zip2.cpp b/src/boost/libs/fusion/test/algorithm/zip2.cpp
new file mode 100644
index 000000000..f35e4d5d8
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/zip2.cpp
@@ -0,0 +1,30 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/mpl/vector.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ const vector2<int,int> shorter(1,2);
+ const vector3<char,char,char> longer('a', 'b', 'c');
+ const vector2<vector2<int,char>, vector2<int,char> > result(vector2<int,char>(1,'a'), vector2<int,char>(2,'b'));
+ BOOST_TEST(zip(shorter, longer) == result);
+ }
+ {
+ const vector3<int,int,int> longer(1,2,3);
+ const vector2<char,char> shorter('a', 'b');
+ const vector2<vector2<int,char>, vector2<int,char> > result(vector2<int,char>(1,'a'), vector2<int,char>(2,'b'));
+ BOOST_TEST(zip(longer, shorter) == result);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/algorithm/zip_ignore.cpp b/src/boost/libs/fusion/test/algorithm/zip_ignore.cpp
new file mode 100644
index 000000000..a12b58201
--- /dev/null
+++ b/src/boost/libs/fusion/test/algorithm/zip_ignore.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/support/unused.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ vector<int, int> iv(1,2);
+ vector<char, char> cv('a', 'b');
+ BOOST_TEST(at_c<0>(at_c<0>(zip(iv, unused, cv))) == 1);
+ BOOST_TEST(at_c<2>(at_c<0>(zip(iv, unused, cv))) == 'a');
+
+ BOOST_TEST(at_c<0>(at_c<1>(zip(iv, unused, cv))) == 2);
+ BOOST_TEST(at_c<2>(at_c<1>(zip(iv, unused, cv))) == 'b');
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/compile_time/Makefile b/src/boost/libs/fusion/test/compile_time/Makefile
new file mode 100644
index 000000000..4887cf248
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/Makefile
@@ -0,0 +1,29 @@
+#=============================================================================
+# Copyright (c) 2008 Dan Marsden
+#
+# 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).
+#==============================================================================
+
+CXX=g++
+CXXFLAGS=-I$(BOOST_ROOT)
+
+TEST_SRCS=\
+ vector_construction.cpp\
+ vector_iteration.cpp\
+ vector_intrinsic.cpp\
+ fold.cpp\
+ transform.cpp
+
+TEST_OBJS=$(TEST_SRCS:.cpp=.o)
+
+TEST_TARGETS=$(TEST_SRCS:.cpp=.test)
+
+all: $(TEST_TARGETS)
+
+%.test : %.cpp
+ time $(CXX) $(CXXFLAGS) $< -o $@
+
+clean:
+ rm -f $(TEST_TARGETS) $(TEST_OBJS)
diff --git a/src/boost/libs/fusion/test/compile_time/driver.hpp b/src/boost/libs/fusion/test/compile_time/driver.hpp
new file mode 100644
index 000000000..8d06e6deb
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/driver.hpp
@@ -0,0 +1,75 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#if !defined(BOOST_FUSION_COMPILE_TIME_DRIVER)
+#define BOOST_FUSION_COMPILE_TIME_DRIVER
+
+int main()
+{
+ test<0>();
+ test<1>();
+ test<2>();
+ test<3>();
+ test<4>();
+
+ test<5>();
+ test<6>();
+ test<7>();
+ test<8>();
+ test<9>();
+
+ test<10>();
+ test<11>();
+ test<12>();
+ test<13>();
+ test<14>();
+
+ test<15>();
+ test<16>();
+ test<17>();
+ test<18>();
+ test<19>();
+
+ test<20>();
+ test<21>();
+ test<22>();
+ test<23>();
+ test<24>();
+
+ test<25>();
+ test<26>();
+ test<27>();
+ test<28>();
+ test<29>();
+
+ test<30>();
+ test<31>();
+ test<32>();
+ test<33>();
+ test<34>();
+
+ test<35>();
+ test<36>();
+ test<37>();
+ test<38>();
+ test<39>();
+
+ test<40>();
+ test<41>();
+ test<42>();
+ test<43>();
+ test<44>();
+
+ test<45>();
+ test<46>();
+ test<47>();
+ test<48>();
+ test<49>();
+}
+
+#endif
diff --git a/src/boost/libs/fusion/test/compile_time/fold.cpp b/src/boost/libs/fusion/test/compile_time/fold.cpp
new file mode 100644
index 000000000..5fb618dd4
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/fold.cpp
@@ -0,0 +1,42 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/fold.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {};
+
+ struct f
+ {
+ typedef int result_type;
+
+ template<int n, int batch>
+ int operator()(int state, distinct<n, batch> const& d) const
+ {
+ return state + n;
+ }
+ };
+
+ template<int batch>
+ void test()
+ {
+ fusion::vector<
+ distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+ distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+
+ fusion::fold(v, 0, f());
+ }
+}
+
+#include "./driver.hpp"
diff --git a/src/boost/libs/fusion/test/compile_time/sfinae_friendly.hpp b/src/boost/libs/fusion/test/compile_time/sfinae_friendly.hpp
new file mode 100644
index 000000000..9d0b866cc
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/sfinae_friendly.hpp
@@ -0,0 +1,53 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#ifndef FUSION_TEST_SFINAE_FRIENDLY_HPP
+#define FUSION_TEST_SFINAE_FRIENDLY_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/core/enable_if.hpp>
+
+#if !defined(BOOST_NO_SFINAE) && defined(BOOST_RESULT_OF_USE_DECLTYPE)
+
+#include <boost/fusion/container/vector.hpp>
+
+namespace sfinae_friendly
+{
+ template <typename> struct arg_;
+ template <typename R, typename T> struct arg_<R(T)> { typedef T type; };
+
+ template <typename Traits, typename = void>
+ struct check
+ : boost::mpl::true_ { };
+
+ template <typename Traits>
+ struct check<Traits, typename boost::enable_if_has_type<typename Traits::type>::type>
+ : boost::mpl::false_ { };
+
+ struct unspecified {};
+ typedef boost::fusion::vector<> v0;
+ typedef boost::fusion::vector<unspecified> v1;
+ typedef boost::fusion::vector<unspecified, unspecified> v2;
+ typedef boost::fusion::vector<unspecified, unspecified, unspecified> v3;
+}
+
+#define SFINAE_FRIENDLY_ASSERT(Traits) \
+ BOOST_MPL_ASSERT((::sfinae_friendly::check<typename ::sfinae_friendly::arg_<void Traits>::type>))
+
+#else
+
+#define SFINAE_FRIENDLY_ASSERT(Traits) \
+ BOOST_MPL_ASSERT((boost::mpl::true_))
+
+#endif
+
+#endif // FUSION_TEST_SFINAE_FRIENDLY_HPP
+
diff --git a/src/boost/libs/fusion/test/compile_time/transform.cpp b/src/boost/libs/fusion/test/compile_time/transform.cpp
new file mode 100644
index 000000000..04ad8ab24
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/transform.cpp
@@ -0,0 +1,55 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {
+ static const int value = n;
+ };
+
+ struct f
+ {
+ typedef int result_type;
+
+ template<typename T>
+ result_type operator()(T const& t) const
+ {
+ return T::value;
+ }
+ };
+
+ struct touch
+ {
+ template<typename T>
+ void operator()(T const&) const
+ {}
+ };
+
+ template<int batch>
+ void test()
+ {
+ fusion::vector<
+ distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+ distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+
+ // We're testing transform really
+ // for_each call is to force iteration through the lazy
+ // transform, otherwise very little will happen.
+ fusion::for_each(fusion::transform(v, f()), touch());
+ }
+}
+
+#include "./driver.hpp"
diff --git a/src/boost/libs/fusion/test/compile_time/vector_construction.cpp b/src/boost/libs/fusion/test/compile_time/vector_construction.cpp
new file mode 100644
index 000000000..18f9f16b4
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/vector_construction.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {};
+
+ template<int batch>
+ void test()
+ {
+ fusion::vector<
+ distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+ distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+ }
+}
+
+#include "./driver.hpp"
diff --git a/src/boost/libs/fusion/test/compile_time/vector_intrinsic.cpp b/src/boost/libs/fusion/test/compile_time/vector_intrinsic.cpp
new file mode 100644
index 000000000..3690a496b
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/vector_intrinsic.cpp
@@ -0,0 +1,59 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/intrinsic.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {};
+
+ template<int batch>
+ void test()
+ {
+ typedef fusion::vector<
+ distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+ distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v_type;
+
+ v_type v;
+
+ fusion::at_c<0>(v);
+ fusion::at_c<1>(v);
+ fusion::at_c<2>(v);
+ fusion::at_c<3>(v);
+ fusion::at_c<4>(v);
+
+ fusion::at_c<5>(v);
+ fusion::at_c<6>(v);
+ fusion::at_c<7>(v);
+ fusion::at_c<8>(v);
+ fusion::at_c<9>(v);
+
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 0>::type va0;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 1>::type va1;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 2>::type va2;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 3>::type va3;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 4>::type va4;
+
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 5>::type va5;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 6>::type va6;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 7>::type va7;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 8>::type va8;
+ typedef typename boost::fusion::result_of::value_at_c<v_type, 9>::type va9;
+
+ fusion::begin(v);
+ fusion::end(v);
+ fusion::size(v);
+ }
+}
+
+#include "./driver.hpp"
diff --git a/src/boost/libs/fusion/test/compile_time/vector_iteration.cpp b/src/boost/libs/fusion/test/compile_time/vector_iteration.cpp
new file mode 100644
index 000000000..ee63bee5a
--- /dev/null
+++ b/src/boost/libs/fusion/test/compile_time/vector_iteration.cpp
@@ -0,0 +1,38 @@
+/*=============================================================================
+ Copyright (c) 2008 Dan Marsden
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {};
+
+ struct null_op
+ {
+ template<typename T>
+ void operator()(T const& t) const
+ {}
+ };
+
+ template<int batch>
+ void test()
+ {
+ fusion::vector<
+ distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+ distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+
+ fusion::for_each(v, null_op());
+ }
+}
+
+#include "./driver.hpp"
diff --git a/src/boost/libs/fusion/test/functional/fused.cpp b/src/boost/libs/fusion/test/functional/fused.cpp
new file mode 100644
index 000000000..b2ce8dde9
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/fused.cpp
@@ -0,0 +1,97 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/adapter/fused.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ typedef int result_type;
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return 4+x-y;
+ }
+};
+
+int main()
+{
+ test_func<noncopyable> f;
+
+ typedef fusion::fused< test_func<> > ff;
+ ff fused_func;
+
+ typedef fusion::fused< test_func<noncopyable> & > ffr;
+ ffr fused_func_ref(f);
+
+ typedef fusion::fused< test_func<> const > ffc;
+ ffc fused_func_c;
+
+ typedef fusion::fused< test_func<> > const ffc2;
+ ffc2 fused_func_c2;
+
+ typedef fusion::fused< test_func<noncopyable> const & > ffcr;
+ ffcr fused_func_c_ref(f);
+
+ typedef fusion::vector<int,char> vec;
+ vec lv_vec(1,'\004');
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ff(vec)>::type, int>));
+ BOOST_TEST(fused_func(lv_vec) == 1);
+ BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffr(vec)>::type, int>));
+ BOOST_TEST(fused_func_c(lv_vec) == 0);
+ BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffc(vec)>::type, int>));
+ BOOST_TEST(fused_func_c2(lv_vec) == 0);
+ BOOST_TEST(fused_func_ref(lv_vec) == 1);
+ BOOST_MPL_ASSERT((boost::is_same<boost::result_of<ffcr(vec)>::type, int>));
+ BOOST_TEST(fused_func_c_ref(lv_vec) == 0);
+
+ BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fused_func_c(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fused_func_c2(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fused_func_ref(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fused_func_c_ref(fusion::make_vector(2,'\003')) == 0);
+
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/functional/fused_function_object.cpp b/src/boost/libs/fusion/test/functional/fused_function_object.cpp
new file mode 100644
index 000000000..399745a06
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/fused_function_object.cpp
@@ -0,0 +1,83 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/adapter/fused_function_object.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template<typename T>
+ struct result;
+
+ template<class Self, typename T0, typename T1>
+ struct result< Self(T0, T1) >
+ {
+ typedef int type;
+ };
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return 4+x-y;
+ }
+};
+
+int main()
+{
+ test_func<noncopyable> f;
+ fusion::fused_function_object< test_func<> > fused_func;
+ fusion::fused_function_object< test_func<noncopyable> & > fused_func_ref(f);
+ fusion::fused_function_object< test_func<> const > fused_func_c;
+ fusion::fused_function_object< test_func<> > const fused_func_c2;
+ fusion::fused_function_object< test_func<noncopyable> const & > fused_func_c_ref(f);
+
+ fusion::vector<int,char> lv_vec(1,'\004');
+ BOOST_TEST(fused_func(lv_vec) == 1);
+ BOOST_TEST(fused_func_c(lv_vec) == 0);
+ BOOST_TEST(fused_func_c2(lv_vec) == 0);
+ BOOST_TEST(fused_func_ref(lv_vec) == 1);
+ BOOST_TEST(fused_func_c_ref(lv_vec) == 0);
+
+ BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fused_func_c(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fused_func_c2(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fused_func_ref(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fused_func_c_ref(fusion::make_vector(2,'\003')) == 0);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/fused_procedure.cpp b/src/boost/libs/fusion/test/functional/fused_procedure.cpp
new file mode 100644
index 000000000..1ed0ddf73
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/fused_procedure.cpp
@@ -0,0 +1,82 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/adapter/fused_procedure.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+
+int effect;
+
+#define CHECK_EFFECT(t,e) \
+ { \
+ effect = 1234567; t; \
+ BOOST_TEST(effect == e); \
+ }
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return effect = 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return effect = 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return effect = 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return effect = 4+x-y;
+ }
+};
+
+int main()
+{
+ test_func<noncopyable> f;
+ fusion::fused_procedure< test_func<> > fused_proc;
+ fusion::fused_procedure< test_func<noncopyable> & > fused_proc_ref(f);
+ fusion::fused_procedure< test_func<> const > fused_proc_c;
+ fusion::fused_procedure< test_func<> > const fused_proc_c2;
+ fusion::fused_procedure< test_func<noncopyable> const & > fused_proc_c_ref(f);
+
+ fusion::vector<int,char> lv_vec(1,'\004');
+ CHECK_EFFECT(fused_proc(lv_vec), 1);
+ CHECK_EFFECT(fused_proc_c(lv_vec), 0);
+ CHECK_EFFECT(fused_proc_c2(lv_vec), 0);
+ CHECK_EFFECT(fused_proc_ref(lv_vec), 1);
+ CHECK_EFFECT(fused_proc_c_ref(lv_vec), 0);
+
+ CHECK_EFFECT(fused_proc(fusion::make_vector(2,'\003')), 1);
+ CHECK_EFFECT(fused_proc_c(fusion::make_vector(2,'\003')), 0);
+ CHECK_EFFECT(fused_proc_c2(fusion::make_vector(2,'\003')), 0);
+ CHECK_EFFECT(fused_proc_ref(fusion::make_vector(2,'\003')), 1);
+ CHECK_EFFECT(fused_proc_c_ref(fusion::make_vector(2,'\003')), 0);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/invoke.cpp b/src/boost/libs/fusion/test/functional/invoke.cpp
new file mode 100644
index 000000000..3117eb3f1
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/invoke.cpp
@@ -0,0 +1,562 @@
+/*=============================================================================
+ Copyright (c) 2005-2006 Joao Abecasis
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+#include <boost/fusion/functional/invocation/invoke.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#include <functional>
+#endif
+
+#include <memory>
+#include <boost/noncopyable.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/view/single_view.hpp>
+#include <boost/fusion/view/iterator_range.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/algorithm/transformation/join.hpp>
+
+#include "../compile_time/sfinae_friendly.hpp"
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+struct object {};
+struct object_nc : boost::noncopyable {};
+
+struct fobj
+{
+ // Handle nullary separately to exercise result_of support
+ template <typename Sig>
+ struct result;
+
+ template <class Self, typename T0>
+ struct result< Self(T0) >
+ {
+ typedef int type;
+ };
+
+ template <class Self, typename T0, typename T1>
+ struct result< Self(T0, T1) >
+ {
+ typedef int type;
+ };
+
+ template <class Self, typename T0, typename T1, typename T2>
+ struct result< Self(T0, T1, T2) >
+ {
+ typedef int type;
+ };
+
+ int operator()(int i) { return 2 + i; }
+ int operator()(int i) const { return 3 + i; }
+
+ int operator()(int i, object &) { return 4 + i; }
+ int operator()(int i, object &) const { return 5 + i; }
+ int operator()(int i, object const &) { return 6 + i; }
+ int operator()(int i, object const &) const { return 7 + i; }
+
+ int operator()(int i, object &, object_nc &) { return 10 + i; }
+ int operator()(int i, object &, object_nc &) const { return 11 + i; }
+ int operator()(int i, object const &, object_nc &);
+ int operator()(int i, object const &, object_nc &) const;
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj, sfinae_friendly::v0>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj, sfinae_friendly::v3>));
+
+
+struct nullary_fobj
+{
+ typedef int result_type;
+
+ int operator()() { return 0; }
+ int operator()() const { return 1; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj, sfinae_friendly::v3>));
+
+
+struct fobj_nc
+ : boost::noncopyable
+{
+ // Handle nullary separately to exercise result_of support
+ template <typename Sig>
+ struct result;
+
+ template <class Self, typename T0>
+ struct result< Self(T0)>
+ {
+ typedef int type;
+ };
+
+ int operator()(int i) { return 14 + i; }
+ int operator()(int i) const { return 15 + i; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj_nc, sfinae_friendly::v0>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj_nc, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj_nc, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<fobj_nc, sfinae_friendly::v3>));
+
+
+struct nullary_fobj_nc
+ : boost::noncopyable
+{
+ typedef int result_type;
+
+ int operator()() { return 12; }
+ int operator()() const { return 13; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj_nc, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj_nc, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<nullary_fobj_nc, sfinae_friendly::v3>));
+
+
+int nullary() { return 16; }
+int unary(int i) { return 17 + i; }
+int binary1(int i, object &) { return 18 + i; }
+int binary2(int i, object const &) { return 19 + i; }
+//FIXME
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object &), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object &), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object &), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object &), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object const &), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object const &), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object const &), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<int(*)(int, object const &), sfinae_friendly::v3>));
+
+typedef int (* func_ptr)(int);
+typedef int (* const c_func_ptr)(int);
+typedef int (* volatile v_func_ptr)(int);
+typedef int (* const volatile cv_func_ptr)(int);
+
+ func_ptr func_ptr1 = &unary;
+ c_func_ptr func_ptr2 = &unary;
+ v_func_ptr func_ptr3 = &unary;
+cv_func_ptr func_ptr4 = &unary;
+
+class members
+{
+ public:
+ int data;
+
+ members()
+ : data(20)
+ { }
+
+ int nullary() { return data + 1; }
+ int nullary_c() const { return data + 2; }
+ int unary(int i) { return data + 3 + i; }
+ int unary_c(int i) const { return data + 4 + i; }
+ int binary(int i, object) { return data + 5 + i; }
+ int binary_c(int i, object) const { return data + 6 + i; }
+};
+
+#ifdef BOOST_NO_CXX11_SMART_PTR
+typedef std::auto_ptr<members > members_ptr;
+typedef std::auto_ptr<members const> const_members_ptr;
+#else
+typedef std::unique_ptr<members > members_ptr;
+typedef std::unique_ptr<members const> const_members_ptr;
+#endif
+
+struct derived
+ : members
+{
+};
+
+#ifdef BOOST_NO_CXX11_SMART_PTR
+typedef std::auto_ptr<derived > derived_ptr;
+typedef std::auto_ptr<derived const> const_derived_ptr;
+#else
+typedef std::unique_ptr<derived > derived_ptr;
+typedef std::unique_ptr<derived const> const_derived_ptr;
+#endif
+
+
+typedef int element1_type;
+typedef object element2_type;
+typedef object_nc & element3_type;
+
+int element1 = 100;
+object element2 = object();
+object_nc element3;
+
+members that;
+
+members_ptr spt_that(new members);
+const_members_ptr spt_that_c(new members);
+
+typedef fusion::single_view<members > sv_obj;
+typedef fusion::single_view<members &> sv_ref;
+typedef fusion::single_view<members *> sv_ptr;
+typedef fusion::single_view<members const > sv_obj_c;
+typedef fusion::single_view<members const &> sv_ref_c;
+typedef fusion::single_view<members const *> sv_ptr_c;
+typedef fusion::single_view<members_ptr const &> sv_spt;
+typedef fusion::single_view<const_members_ptr const &> sv_spt_c;
+
+sv_obj sv_obj_ctx( that);
+sv_ref sv_ref_ctx( that);
+sv_ptr sv_ptr_ctx(& that);
+sv_obj_c sv_obj_c_ctx( that);
+sv_ref_c sv_ref_c_ctx( that);
+sv_ptr_c sv_ptr_c_ctx(& that);
+sv_spt sv_spt_ctx(spt_that);
+sv_spt_c sv_spt_c_ctx(spt_that_c);
+template <typename F, typename S>
+struct sv_helper
+{
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_obj , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ref , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ptr , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_obj_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ref_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ptr_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_spt , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_spt_c, S>::type>));
+};
+// FIXME:
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v3>;
+
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v3>;
+
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v3>;
+
+derived derived_that;
+
+derived_ptr spt_derived_that(new derived);
+const_derived_ptr spt_derived_that_c(new derived);
+
+typedef fusion::single_view<derived > sv_obj_d;
+typedef fusion::single_view<derived &> sv_ref_d;
+typedef fusion::single_view<derived *> sv_ptr_d;
+typedef fusion::single_view<derived const > sv_obj_c_d;
+typedef fusion::single_view<derived const &> sv_ref_c_d;
+typedef fusion::single_view<derived const *> sv_ptr_c_d;
+typedef fusion::single_view<derived_ptr const &> sv_spt_d;
+typedef fusion::single_view<const_derived_ptr const &> sv_spt_c_d;
+
+sv_obj_d sv_obj_d_ctx( derived_that);
+sv_ref_d sv_ref_d_ctx( derived_that);
+sv_ptr_d sv_ptr_d_ctx(& derived_that);
+sv_obj_c_d sv_obj_c_d_ctx( derived_that);
+sv_ref_c_d sv_ref_c_d_ctx( derived_that);
+sv_ptr_c_d sv_ptr_c_d_ctx(& derived_that);
+sv_spt_d sv_spt_d_ctx(spt_derived_that);
+sv_spt_c_d sv_spt_c_d_ctx(spt_derived_that_c);
+template <typename F, typename S>
+struct sv_d_helper
+{
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_obj_d , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ref_d , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ptr_d , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_obj_c_d, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ref_c_d, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_ptr_c_d, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_spt_d , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke<F, typename fusion::result_of::join<sv_spt_c_d, S>::type>));
+};
+// FIXME:
+//template struct sv_d_helper<int (members::*)() , sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)() , sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)() , sfinae_friendly::v3>;
+//template struct sv_d_helper<int (members::*)() const, sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)() const, sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)() const, sfinae_friendly::v3>;
+
+//template struct sv_d_helper<int (members::*)(int) , sfinae_friendly::v0>;
+//template struct sv_d_helper<int (members::*)(int) , sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)(int) , sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)(int) , sfinae_friendly::v3>;
+//template struct sv_d_helper<int (members::*)(int) const, sfinae_friendly::v0>;
+//template struct sv_d_helper<int (members::*)(int) const, sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)(int) const, sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)(int) const, sfinae_friendly::v3>;
+
+//template struct sv_d_helper<int (members::*)(int, object) , sfinae_friendly::v0>;
+//template struct sv_d_helper<int (members::*)(int, object) , sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)(int, object) , sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)(int, object) , sfinae_friendly::v3>;
+//template struct sv_d_helper<int (members::*)(int, object) const, sfinae_friendly::v0>;
+//template struct sv_d_helper<int (members::*)(int, object) const, sfinae_friendly::v1>;
+//template struct sv_d_helper<int (members::*)(int, object) const, sfinae_friendly::v2>;
+//template struct sv_d_helper<int (members::*)(int, object) const, sfinae_friendly::v3>;
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<0>)
+{
+ // Function Objects
+
+ nullary_fobj f;
+
+ BOOST_TEST(f () == fusion::invoke(f , seq ));
+ BOOST_TEST(f () == fusion::invoke(f , const_(seq)));
+
+ // Note: The function object is taken by value, so we request the copy
+ // to be const with an explicit template argument. We can also request
+ // the function object to be pased by reference...
+ BOOST_TEST(const_(f)() == fusion::invoke<nullary_fobj const >(const_(f), seq ));
+ BOOST_TEST(const_(f)() == fusion::invoke<nullary_fobj const &>(const_(f), const_(seq)));
+
+ nullary_fobj_nc nc_f;
+ // ...and we further ensure there is no copying in this case, using a
+ // noncopyable function object.
+ BOOST_TEST(nc_f () == fusion::invoke<nullary_fobj_nc &>(nc_f , seq ));
+ BOOST_TEST(nc_f () == fusion::invoke<nullary_fobj_nc &>(nc_f , const_(seq)));
+ BOOST_TEST(const_(nc_f)() == fusion::invoke<nullary_fobj_nc const &>(const_(nc_f), seq ));
+ BOOST_TEST(const_(nc_f)() == fusion::invoke<nullary_fobj_nc const &>(const_(nc_f), const_(seq)));
+
+ // Builtin Functions
+
+ // Call through ref/ptr to function
+ BOOST_TEST(nullary() == fusion::invoke<int (&)()>(nullary, seq));
+ BOOST_TEST(nullary() == fusion::invoke(& nullary, seq));
+
+ // Call through ptr to member function
+ // Note: The non-const function members::nullary can't be invoked with
+ // fusion::join(sv_obj_ctx,seq)), which is const and so is its first element
+ BOOST_TEST(that.nullary() == fusion::invoke(& members::nullary, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.nullary() == fusion::invoke(& members::nullary, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.nullary() == fusion::invoke(& members::nullary, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_obj_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_obj_c_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_ref_c_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ BOOST_TEST(that.nullary_c() == fusion::invoke(& members::nullary_c, fusion::join(sv_spt_c_ctx,seq)));
+
+ // Pointer to data member
+
+ // $$$ JDG $$$ disabling this test due to C++11 error: assignment of read-only location
+ //~ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ref_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ptr_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_spt_ctx,seq)) = that.data));
+ // disabling this test, since it tries to return local address which is undefined behavior
+ //~ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_obj_c_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_ref_c_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_ptr_c_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_spt_c_ctx,seq)));
+
+ // $$$ JDG $$$ disabling this test due to C++11 error: assignment of read-only location
+ //~ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_d_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ref_d_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ptr_d_ctx,seq)) = that.data));
+ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_spt_d_ctx,seq)) = that.data));
+ // disabling this test, since it tries to return local address which is undefined behavior
+ //~ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_obj_c_d_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_ref_c_d_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_ptr_c_d_ctx,seq)));
+ BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_spt_c_d_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<1>)
+{
+ fobj f;
+ BOOST_TEST(f(element1) == fusion::invoke(f , seq ));
+ BOOST_TEST(f(element1) == fusion::invoke(f , const_(seq)));
+ BOOST_TEST(const_(f)(element1) == fusion::invoke<fobj const >(const_(f), seq ));
+ BOOST_TEST(const_(f)(element1) == fusion::invoke<fobj const &>(const_(f), const_(seq)));
+
+ fobj_nc nc_f;
+ BOOST_TEST(nc_f(element1) == fusion::invoke<fobj_nc &>(nc_f, seq ));
+ BOOST_TEST(nc_f(element1) == fusion::invoke<fobj_nc &>(nc_f, const_(seq)));
+ BOOST_TEST(const_(nc_f)(element1) == fusion::invoke<fobj_nc const &>(const_(nc_f), seq ));
+ BOOST_TEST(const_(nc_f)(element1) == fusion::invoke<fobj_nc const &>(const_(nc_f), const_(seq)));
+
+ BOOST_TEST(unary(element1) == fusion::invoke<int (&)(int)>(unary, seq));
+ BOOST_TEST(func_ptr1(element1) == fusion::invoke(func_ptr1, seq));
+ BOOST_TEST(func_ptr2(element1) == fusion::invoke(func_ptr2, seq));
+ BOOST_TEST(func_ptr3(element1) == fusion::invoke(func_ptr3, seq));
+ BOOST_TEST(func_ptr4(element1) == fusion::invoke(func_ptr4, seq));
+
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_obj_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_obj_c_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ref_c_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_spt_c_ctx,seq)));
+
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_ref_d_ctx,seq)));
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_ptr_d_ctx,seq)));
+ BOOST_TEST(that.unary(element1) == fusion::invoke(& members::unary, fusion::join(sv_spt_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_obj_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ref_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ptr_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_spt_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_obj_c_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ref_c_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_ptr_c_d_ctx,seq)));
+ BOOST_TEST(that.unary_c(element1) == fusion::invoke(& members::unary_c, fusion::join(sv_spt_c_d_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<2>)
+{
+ fobj f;
+ BOOST_TEST(f (element1, element2) == fusion::invoke(f , seq));
+ BOOST_TEST(f (element1, const_(element2)) == fusion::invoke(f , const_(seq)));
+ BOOST_TEST(const_(f)(element1, element2) == fusion::invoke<fobj const>(const_(f), seq));
+ BOOST_TEST(const_(f)(element1, const_(element2)) == fusion::invoke<fobj const>(const_(f), const_(seq)));
+
+ BOOST_TEST(binary1(element1, element2) == fusion::invoke(binary1, seq));
+ BOOST_TEST(binary2(element1, element2) == fusion::invoke(binary2, seq));
+
+ BOOST_TEST(that.binary(element1,element2) == fusion::invoke(& members::binary, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.binary(element1,element2) == fusion::invoke(& members::binary, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.binary(element1,element2) == fusion::invoke(& members::binary, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_obj_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_ref_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_ptr_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_spt_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_obj_c_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_ref_c_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ BOOST_TEST(that.binary_c(element1,element2) == fusion::invoke(& members::binary_c, fusion::join(sv_spt_c_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<3>)
+{
+ fobj f;
+
+ BOOST_TEST(f(element1, element2, element3) == fusion::invoke(f, seq));
+ BOOST_TEST(const_(f)(element1, element2, element3) == fusion::invoke<fobj const>(const_(f), seq));
+}
+
+template <class Sequence>
+void test_sequence(Sequence & seq)
+{
+ test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
+}
+
+
+void result_type_tests()
+{
+ using boost::is_same;
+
+ BOOST_TEST(( is_same<
+ boost::fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
+ >::value ));
+// disabled until boost::result_of supports it
+// BOOST_TEST(( is_same<
+// boost::fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
+// >::value ));
+ BOOST_TEST(( is_same<
+ boost::fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
+ >::value ));
+// disabled until boost::result_of supports it
+// BOOST_TEST(( is_same<
+// boost::fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
+// >::value ));
+}
+
+int main()
+{
+ result_type_tests();
+
+ typedef fusion::vector<> vector0;
+ typedef fusion::vector<element1_type> vector1;
+ typedef fusion::vector<element1_type, element2_type> vector2;
+ typedef fusion::vector<element1_type, element2_type, element3_type> vector3;
+
+ vector0 v0;
+ vector1 v1(element1);
+ vector2 v2(element1, element2);
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ // Note: C++11 will pickup the rvalue overload for the d argument
+ // since we do not have all permutations (expensive!) for all const&
+ // and && arguments. We either have all && or all const& arguments only.
+ // For that matter, use std::ref to disambiguate the call.
+
+ vector3 v3(element1, element2, std::ref(element3));
+#else
+ vector3 v3(element1, element2, element3);
+#endif
+
+ test_sequence(v0);
+ test_sequence(v1);
+ test_sequence(v2);
+ test_sequence(v3);
+
+ typedef fusion::list<> list0;
+ typedef fusion::list<element1_type> list1;
+ typedef fusion::list<element1_type, element2_type> list2;
+ typedef fusion::list<element1_type, element2_type, element3_type> list3;
+
+ list0 l0;
+ list1 l1(element1);
+ list2 l2(element1, element2);
+ list3 l3(element1, element2, element3);
+
+ test_sequence(l0);
+ test_sequence(l1);
+ test_sequence(l2);
+ test_sequence(l3);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/invoke_function_object.cpp b/src/boost/libs/fusion/test/functional/invoke_function_object.cpp
new file mode 100644
index 000000000..7c75f06d1
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/invoke_function_object.cpp
@@ -0,0 +1,265 @@
+/*=============================================================================
+ Copyright (c) 2005-2006 Joao Abecasis
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#include <functional>
+#endif
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <memory>
+#include <boost/noncopyable.hpp>
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/view/single_view.hpp>
+#include <boost/fusion/view/iterator_range.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/algorithm/transformation/join.hpp>
+
+#include "../compile_time/sfinae_friendly.hpp"
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+struct object {};
+struct object_nc : boost::noncopyable {};
+
+struct fobj
+{
+ // Handle nullary separately to exercise result_of support
+ template <typename Sig>
+ struct result;
+
+ template <class Self, typename T0>
+ struct result< Self(T0) >
+ {
+ typedef int type;
+ };
+
+ template <class Self, typename T0, typename T1>
+ struct result< Self(T0, T1) >
+ {
+ typedef int type;
+ };
+
+ template <class Self, typename T0, typename T1, typename T2>
+ struct result< Self(T0, T1, T2) >
+ {
+ typedef int type;
+ };
+
+ int operator()() { return 0; }
+ int operator()() const { return 1; }
+
+ int operator()(int i) { return 2 + i; }
+ int operator()(int i) const { return 3 + i; }
+
+ int operator()(int i, object &) { return 4 + i; }
+ int operator()(int i, object &) const { return 5 + i; }
+ int operator()(int i, object const &) { return 6 + i; }
+ int operator()(int i, object const &) const { return 7 + i; }
+
+ int operator()(int i, object &, object_nc &) { return 10 + i; }
+ int operator()(int i, object &, object_nc &) const { return 11 + i; }
+ int operator()(int i, object const &, object_nc &);
+ int operator()(int i, object const &, object_nc &) const;
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj, sfinae_friendly::v3>));
+
+struct nullary_fobj
+{
+ typedef int result_type;
+
+ int operator()() { return 0; }
+ int operator()() const { return 1; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj, sfinae_friendly::v3>));
+
+struct fobj_nc
+ : boost::noncopyable
+{
+ // Handle nullary separately to exercise result_of support
+ template <typename T>
+ struct result;
+
+ template <class Self, typename T0>
+ struct result< Self(T0) >
+ {
+ typedef int type;
+ };
+
+ int operator()(int i) { return 14 + i; }
+ int operator()(int i) const { return 15 + i; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj_nc, sfinae_friendly::v0>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj_nc, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj_nc, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<fobj_nc, sfinae_friendly::v3>));
+
+struct nullary_fobj_nc
+ : boost::noncopyable
+{
+ typedef int result_type;
+
+ int operator()() { return 12; }
+ int operator()() const { return 13; }
+};
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj_nc, sfinae_friendly::v1>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj_nc, sfinae_friendly::v2>));
+SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_function_object<nullary_fobj_nc, sfinae_friendly::v3>));
+
+
+typedef int element1_type;
+typedef object element2_type;
+typedef object_nc & element3_type;
+
+int element1 = 100;
+object element2 = object();
+object_nc element3;
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<0>)
+{
+ // Function Objects
+
+ nullary_fobj f;
+ BOOST_TEST(f () == fusion::invoke_function_object(f , seq ));
+ BOOST_TEST(f () == fusion::invoke_function_object(f , const_(seq)));
+
+ // Note: The function object is taken by value, so we request the copy
+ // to be const with an explicit template argument. We can also request
+ // the function object to be pased by reference...
+ BOOST_TEST(const_(f)() == fusion::invoke_function_object<nullary_fobj const >(const_(f), seq ));
+ BOOST_TEST(const_(f)() == fusion::invoke_function_object<nullary_fobj const &>(const_(f), const_(seq)));
+
+ nullary_fobj_nc nc_f;
+ // ...and we further ensure there is no copying in this case, using a
+ // noncopyable function object.
+ BOOST_TEST(nc_f () == fusion::invoke_function_object<nullary_fobj_nc &>(nc_f , seq ));
+ BOOST_TEST(nc_f () == fusion::invoke_function_object<nullary_fobj_nc &>(nc_f , const_(seq)));
+ BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object<nullary_fobj_nc const &>(const_(nc_f), seq ));
+ BOOST_TEST(const_(nc_f)() == fusion::invoke_function_object<nullary_fobj_nc const &>(const_(nc_f), const_(seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<1>)
+{
+ fobj f;
+ BOOST_TEST(f(element1) == fusion::invoke_function_object(f , seq ));
+ BOOST_TEST(f(element1) == fusion::invoke_function_object(f , const_(seq)));
+ BOOST_TEST(const_(f)(element1) == fusion::invoke_function_object<fobj const >(const_(f), seq ));
+ BOOST_TEST(const_(f)(element1) == fusion::invoke_function_object<fobj const &>(const_(f), const_(seq)));
+
+ fobj_nc nc_f;
+ BOOST_TEST(nc_f(element1) == fusion::invoke_function_object<fobj_nc &>(nc_f, seq ));
+ BOOST_TEST(nc_f(element1) == fusion::invoke_function_object<fobj_nc &>(nc_f, const_(seq)));
+ BOOST_TEST(const_(nc_f)(element1) == fusion::invoke_function_object<fobj_nc const &>(const_(nc_f), seq ));
+ BOOST_TEST(const_(nc_f)(element1) == fusion::invoke_function_object<fobj_nc const &>(const_(nc_f), const_(seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<2>)
+{
+ fobj f;
+ BOOST_TEST(f (element1, element2) == fusion::invoke_function_object(f , seq));
+ BOOST_TEST(f (element1, const_(element2)) == fusion::invoke_function_object(f , const_(seq)));
+ BOOST_TEST(const_(f)(element1, element2) == fusion::invoke_function_object<fobj const>(const_(f), seq));
+ BOOST_TEST(const_(f)(element1, const_(element2)) == fusion::invoke_function_object<fobj const>(const_(f), const_(seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<3>)
+{
+ fobj f;
+
+ BOOST_TEST(f(element1, element2, element3) == fusion::invoke_function_object(f, seq));
+ BOOST_TEST(const_(f)(element1, element2, element3) == fusion::invoke_function_object<fobj const>(const_(f), seq));
+}
+
+template <class Sequence>
+void test_sequence(Sequence & seq)
+{
+ test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
+}
+
+void result_type_tests()
+{
+ using boost::is_same;
+
+ BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value ));
+ BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type> >::type, int >::value ));
+ BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type,element2_type> >::type, int >::value ));
+}
+
+
+int main()
+{
+ result_type_tests();
+
+ typedef fusion::vector<> vector0;
+ typedef fusion::vector<element1_type> vector1;
+ typedef fusion::vector<element1_type, element2_type> vector2;
+ typedef fusion::vector<element1_type, element2_type, element3_type> vector3;
+
+ vector0 v0;
+ vector1 v1(element1);
+ vector2 v2(element1, element2);
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ // Note: C++11 will pickup the rvalue overload for the d argument
+ // since we do not have all permutations (expensive!) for all const&
+ // and && arguments. We either have all && or all const& arguments only.
+ // For that matter, use std::ref to disambiguate the call.
+
+ vector3 v3(element1, element2, std::ref(element3));
+#else
+ vector3 v3(element1, element2, element3);
+#endif
+
+ test_sequence(v0);
+ test_sequence(v1);
+ test_sequence(v2);
+ test_sequence(v3);
+
+ typedef fusion::list<> list0;
+ typedef fusion::list<element1_type> list1;
+ typedef fusion::list<element1_type, element2_type> list2;
+ typedef fusion::list<element1_type, element2_type, element3_type> list3;
+
+ list0 l0;
+ list1 l1(element1);
+ list2 l2(element1, element2);
+ list3 l3(element1, element2, element3);
+
+ test_sequence(l0);
+ test_sequence(l1);
+ test_sequence(l2);
+ test_sequence(l3);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/invoke_procedure.cpp b/src/boost/libs/fusion/test/functional/invoke_procedure.cpp
new file mode 100644
index 000000000..3877ca30c
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/invoke_procedure.cpp
@@ -0,0 +1,385 @@
+/*=============================================================================
+ Copyright (c) 2005-2006 Joao Abecasis
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#include <functional>
+#endif
+
+#include <memory>
+#include <boost/noncopyable.hpp>
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/view/single_view.hpp>
+#include <boost/fusion/view/iterator_range.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/algorithm/transformation/join.hpp>
+
+#include "../compile_time/sfinae_friendly.hpp"
+
+namespace mpl = boost::mpl;
+namespace fusion = boost::fusion;
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+struct object {};
+struct object_nc : boost::noncopyable {};
+
+typedef int element1_type;
+typedef object element2_type;
+typedef object_nc & element3_type;
+
+int element1 = 100;
+object element2 = object();
+object_nc element3;
+
+class members
+{
+ public:
+ int data;
+
+ members()
+ : data(20)
+ { }
+
+ int nullary() { return element1 = data + 1; }
+ int nullary_c() const { return element1 = data + 2; }
+ int unary(int & i) { return i = data + 3; }
+ int unary_c(int & i) const { return i = data + 4; }
+ int binary(int & i, object) { return i = data + 5; }
+ int binary_c(int & i, object) const { return i = data + 6; }
+};
+
+#ifdef BOOST_NO_CXX11_SMART_PTR
+typedef std::auto_ptr<members > members_ptr;
+typedef std::auto_ptr<members const> const_members_ptr;
+#else
+typedef std::unique_ptr<members > members_ptr;
+typedef std::unique_ptr<members const> const_members_ptr;
+#endif
+
+members that;
+members_ptr spt_that(new members);
+const_members_ptr spt_that_c(new members);
+
+typedef fusion::single_view<members > sv_obj;
+typedef fusion::single_view<members &> sv_ref;
+typedef fusion::single_view<members *> sv_ptr;
+typedef fusion::single_view<members const > sv_obj_c;
+typedef fusion::single_view<members const &> sv_ref_c;
+typedef fusion::single_view<members const *> sv_ptr_c;
+typedef fusion::single_view<members_ptr const &> sv_spt;
+typedef fusion::single_view<const_members_ptr const &> sv_spt_c;
+
+sv_obj sv_obj_ctx( that);
+sv_ref sv_ref_ctx( that);
+sv_ptr sv_ptr_ctx(& that);
+sv_obj_c sv_obj_c_ctx( that);
+sv_ref_c sv_ref_c_ctx( that);
+sv_ptr_c sv_ptr_c_ctx(& that);
+sv_spt sv_spt_ctx(spt_that);
+sv_spt_c sv_spt_c_ctx(spt_that_c);
+template <typename F, typename S>
+struct sv_helper
+{
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_obj , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_ref , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_ptr , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_obj_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_ref_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_ptr_c, S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_spt , S>::type>));
+ SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<F, typename fusion::result_of::join<sv_spt_c, S>::type>));
+};
+// FIXME:
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)() , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)() const, sfinae_friendly::v3>;
+
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int) , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int) const, sfinae_friendly::v3>;
+
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int, object) , sfinae_friendly::v3>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v0>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v1>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v2>;
+//template struct sv_helper<int (members::*)(int, object) const, sfinae_friendly::v3>;
+
+struct fobj
+{
+ int operator()() { return element1 = 0; }
+ int operator()() const { return element1 = 1; }
+
+ int operator()(int & i) { return i = 2 ; }
+ int operator()(int & i) const { return i = 3; }
+
+ int operator()(int & i, object &) { return i = 4; }
+ int operator()(int & i, object &) const { return i = 5; }
+ int operator()(int & i, object const &) { return i = 6; }
+ int operator()(int & i, object const &) const { return i = 7; }
+
+ int operator()(int & i, object &, object_nc &) { return i = 10; }
+ int operator()(int & i, object &, object_nc &) const { return i = 11; }
+};
+// FIXME:
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj, sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj, sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj, sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj, sfinae_friendly::v3>));
+
+struct fobj_nc
+ : boost::noncopyable
+{
+ int operator()() { return element1 = 12; }
+ int operator()() const { return element1 = 13; }
+
+ int operator()(int & i) { return i = 14; }
+ int operator()(int & i) const { return i = 15; }
+};
+// FIXME:
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj_nc, sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj_nc, sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj_nc, sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<fobj_nc, sfinae_friendly::v3>));
+
+int nullary() { return element1 = 16; }
+int unary(int & i) { return i = 17; }
+int binary1(int & i, object &) { return i = 18; }
+int binary2(int & i, object const &) { return i = 19; }
+//FIXME
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object &), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object &), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object &), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object &), sfinae_friendly::v3>));
+//
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object const &), sfinae_friendly::v0>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object const &), sfinae_friendly::v1>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object const &), sfinae_friendly::v2>));
+//SFINAE_FRIENDLY_ASSERT((fusion::result_of::invoke_procedure<int(*)(int, object const &), sfinae_friendly::v3>));
+
+typedef int (* func_ptr)(int &);
+typedef int (* const c_func_ptr)(int &);
+typedef int (* volatile v_func_ptr)(int &);
+typedef int (* const volatile cv_func_ptr)(int &);
+
+ func_ptr func_ptr1 = &unary;
+ c_func_ptr func_ptr2 = &unary;
+ v_func_ptr func_ptr3 = &unary;
+cv_func_ptr func_ptr4 = &unary;
+
+
+
+#define COMPARE_EFFECT(e,t) \
+ { \
+ element1 = 1234567; e; \
+ int expected = element1; \
+ element1 = 1234567; t; \
+ BOOST_TEST(expected == element1 ); \
+ }
+
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<0>)
+{
+ // Function Objects
+
+ fobj f;
+
+ COMPARE_EFFECT(f (), fusion::invoke_procedure(f , seq ));
+ COMPARE_EFFECT(f (), fusion::invoke_procedure(f , const_(seq)));
+
+ // Note: The function object is taken by value, so we request the copy
+ // to be const with an explicit template argument. We can also request
+ // the function object to be pased by reference...
+ COMPARE_EFFECT(const_(f)(), fusion::invoke_procedure<fobj const >(const_(f), seq ));
+ COMPARE_EFFECT(const_(f)(), fusion::invoke_procedure<fobj const &>(const_(f), const_(seq)));
+
+ fobj_nc nc_f;
+ // ...and we further ensure there is no copying in this case, using a
+ // noncopyable function object.
+ COMPARE_EFFECT(nc_f (), fusion::invoke_procedure<fobj_nc &>(nc_f , seq ));
+ COMPARE_EFFECT(nc_f (), fusion::invoke_procedure<fobj_nc &>(nc_f , const_(seq)));
+ COMPARE_EFFECT(const_(nc_f)(), fusion::invoke_procedure<fobj_nc const &>(const_(nc_f), seq ));
+ COMPARE_EFFECT(const_(nc_f)(), fusion::invoke_procedure<fobj_nc const &>(const_(nc_f), const_(seq)));
+
+ // Builtin Functions
+
+ // Call through ref/ptr to function
+ COMPARE_EFFECT(nullary(), fusion::invoke_procedure<int (&)()>(nullary, seq));
+ COMPARE_EFFECT(nullary(), fusion::invoke_procedure(& nullary, seq));
+
+ // Call through ptr to member function
+ // Note: The non-const function members::nullary can't be invoked with
+ // fusion::join(sv_obj_ctx,seq)), which is const and so is its first element
+ COMPARE_EFFECT(that.nullary(), fusion::invoke_procedure(& members::nullary, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.nullary(), fusion::invoke_procedure(& members::nullary, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.nullary(), fusion::invoke_procedure(& members::nullary, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_obj_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_obj_c_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_ref_c_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ COMPARE_EFFECT(that.nullary_c(), fusion::invoke_procedure(& members::nullary_c, fusion::join(sv_spt_c_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<1>)
+{
+ fobj f;
+ COMPARE_EFFECT(f(element1), fusion::invoke_procedure(f , seq ));
+ COMPARE_EFFECT(f(element1), fusion::invoke_procedure(f , const_(seq)));
+ COMPARE_EFFECT(const_(f)(element1), fusion::invoke_procedure<fobj const >(const_(f), seq ));
+ COMPARE_EFFECT(const_(f)(element1), fusion::invoke_procedure<fobj const &>(const_(f), const_(seq)));
+
+ fobj_nc nc_f;
+ COMPARE_EFFECT(nc_f(element1), fusion::invoke_procedure<fobj_nc &>(nc_f, seq ));
+ COMPARE_EFFECT(nc_f(element1), fusion::invoke_procedure<fobj_nc &>(nc_f, const_(seq)));
+ COMPARE_EFFECT(const_(nc_f)(element1), fusion::invoke_procedure<fobj_nc const &>(const_(nc_f), seq ));
+ COMPARE_EFFECT(const_(nc_f)(element1), fusion::invoke_procedure<fobj_nc const &>(const_(nc_f), const_(seq)));
+
+ COMPARE_EFFECT(unary(element1), fusion::invoke_procedure<int (&)(int &)>(unary, seq));
+ COMPARE_EFFECT(func_ptr1(element1), fusion::invoke_procedure(func_ptr1, seq));
+ COMPARE_EFFECT(func_ptr2(element1), fusion::invoke_procedure(func_ptr2, seq));
+ COMPARE_EFFECT(func_ptr3(element1), fusion::invoke_procedure(func_ptr3, seq));
+ COMPARE_EFFECT(func_ptr4(element1), fusion::invoke_procedure(func_ptr4, seq));
+
+ COMPARE_EFFECT(that.unary(element1), fusion::invoke_procedure(& members::unary, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.unary(element1), fusion::invoke_procedure(& members::unary, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.unary(element1), fusion::invoke_procedure(& members::unary, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_obj_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_obj_c_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_ref_c_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ COMPARE_EFFECT(that.unary_c(element1), fusion::invoke_procedure(& members::unary_c, fusion::join(sv_spt_c_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<2>)
+{
+ fobj f;
+ COMPARE_EFFECT(f (element1, element2), fusion::invoke_procedure(f , seq));
+ COMPARE_EFFECT(f (element1, const_(element2)), fusion::invoke_procedure(f , const_(seq)));
+ COMPARE_EFFECT(const_(f)(element1, element2), fusion::invoke_procedure<fobj const>(const_(f), seq));
+ COMPARE_EFFECT(const_(f)(element1, const_(element2)), fusion::invoke_procedure<fobj const>(const_(f), const_(seq)));
+
+ COMPARE_EFFECT(binary1(element1, element2), fusion::invoke_procedure(binary1, seq));
+ COMPARE_EFFECT(binary2(element1, element2), fusion::invoke_procedure(binary2, seq));
+
+ COMPARE_EFFECT(that.binary(element1,element2), fusion::invoke_procedure(& members::binary, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.binary(element1,element2), fusion::invoke_procedure(& members::binary, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.binary(element1,element2), fusion::invoke_procedure(& members::binary, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_obj_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_ref_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_ptr_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_spt_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_obj_c_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_ref_c_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_ptr_c_ctx,seq)));
+ COMPARE_EFFECT(that.binary_c(element1,element2), fusion::invoke_procedure(& members::binary_c, fusion::join(sv_spt_c_ctx,seq)));
+}
+
+template <class Sequence>
+void test_sequence_n(Sequence & seq, mpl::int_<3>)
+{
+ fobj f;
+
+ COMPARE_EFFECT(f(element1, element2, element3), fusion::invoke_procedure(f, seq));
+ COMPARE_EFFECT(const_(f)(element1, element2, element3), fusion::invoke_procedure<fobj const>(const_(f), seq));
+}
+
+template <class Sequence>
+void test_sequence(Sequence & seq)
+{
+ test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
+}
+
+int main()
+{
+ typedef fusion::vector<> vector0;
+ typedef fusion::vector<element1_type &> vector1;
+ typedef fusion::vector<element1_type &, element2_type> vector2;
+ typedef fusion::vector<element1_type &, element2_type, element3_type> vector3;
+
+ vector0 v0;
+ vector1 v1(element1);
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ // Note: C++11 will pickup the rvalue overload for the d argument
+ // since we do not have all permutations (expensive!) for all const&
+ // and && arguments. We either have all && or all const& arguments only.
+ // For that matter, use std::ref to disambiguate the call.
+
+ vector2 v2(std::ref(element1), element2);
+ vector3 v3(std::ref(element1), element2, std::ref(element3));
+#else
+ vector2 v2(element1, element2);
+ vector3 v3(element1, element2, element3);
+#endif
+
+ test_sequence(v0);
+ test_sequence(v1);
+ test_sequence(v2);
+ test_sequence(v3);
+
+ typedef fusion::list<> list0;
+ typedef fusion::list<element1_type &> list1;
+ typedef fusion::list<element1_type &, element2_type> list2;
+ typedef fusion::list<element1_type &, element2_type, element3_type> list3;
+
+ list0 l0;
+ list1 l1(element1);
+ list2 l2(element1, element2);
+ list3 l3(element1, element2, element3);
+
+ test_sequence(l0);
+ test_sequence(l1);
+ test_sequence(l2);
+ test_sequence(l3);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/make_fused.cpp b/src/boost/libs/fusion/test/functional/make_fused.cpp
new file mode 100644
index 000000000..ceb82063e
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/make_fused.cpp
@@ -0,0 +1,85 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/generation/make_fused.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+using boost::cref;
+using boost::ref;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ typedef int result_type;
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return 4+x-y;
+ }
+};
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+int main()
+{
+ fusion::vector<int,char> lv_vec(1,'\004');
+ test_func<> f;
+ test_func<noncopyable> f_nc;
+
+ boost::fusion::result_of::make_fused< test_func<> >::type fused_func
+ = fusion::make_fused(f);
+
+ BOOST_TEST(fused_func(lv_vec) == 1);
+ BOOST_TEST(const_(fused_func)(lv_vec) == 0);
+ BOOST_TEST(fusion::make_fused(const_(f))(lv_vec) == 1);
+ BOOST_TEST(fusion::make_fused(ref(f_nc))(lv_vec) == 1);
+ BOOST_TEST(fusion::make_fused(cref(f_nc))(lv_vec) == 0);
+
+ BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(const_(fused_func)(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fusion::make_fused(const_(f))(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fusion::make_fused(ref(f_nc))(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fusion::make_fused(cref(f_nc))(fusion::make_vector(2,'\003')) == 0);
+
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/functional/make_fused_function_object.cpp b/src/boost/libs/fusion/test/functional/make_fused_function_object.cpp
new file mode 100644
index 000000000..79ea517ba
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/make_fused_function_object.cpp
@@ -0,0 +1,95 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/generation/make_fused_function_object.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+using boost::cref;
+using boost::ref;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template<typename T>
+ struct result
+ {
+ };
+
+
+ template<class Self, typename T0, typename T1>
+ struct result< Self(T0, T1) >
+ {
+ typedef int type;
+ };
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return 4+x-y;
+ }
+};
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+int main()
+{
+ fusion::vector<int,char> lv_vec(1,'\004');
+ test_func<> f;
+ test_func<noncopyable> f_nc;
+
+ boost::fusion::result_of::make_fused_function_object< test_func<> >::type fused_func
+ = fusion::make_fused_function_object(f);
+
+ BOOST_TEST(fused_func(lv_vec) == 1);
+ BOOST_TEST(const_(fused_func)(lv_vec) == 0);
+ BOOST_TEST(fusion::make_fused_function_object(const_(f))(lv_vec) == 1);
+ BOOST_TEST(fusion::make_fused_function_object(ref(f_nc))(lv_vec) == 1);
+ BOOST_TEST(fusion::make_fused_function_object(cref(f_nc))(lv_vec) == 0);
+
+ BOOST_TEST(fused_func(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(const_(fused_func)(fusion::make_vector(2,'\003')) == 0);
+ BOOST_TEST(fusion::make_fused_function_object(const_(f))(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fusion::make_fused_function_object(ref(f_nc))(fusion::make_vector(2,'\003')) == 1);
+ BOOST_TEST(fusion::make_fused_function_object(cref(f_nc))(fusion::make_vector(2,'\003')) == 0);
+
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/functional/make_fused_procedure.cpp b/src/boost/libs/fusion/test/functional/make_fused_procedure.cpp
new file mode 100644
index 000000000..2fa2762c5
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/make_fused_procedure.cpp
@@ -0,0 +1,91 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/generation/make_fused_procedure.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/mpl/empty_base.hpp>
+
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+namespace fusion = boost::fusion;
+using boost::noncopyable;
+using boost::cref;
+using boost::ref;
+
+int effect;
+
+#define CHECK_EFFECT(t,e) \
+ { \
+ effect = 1234567; t; \
+ BOOST_TEST(effect == e); \
+ }
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y) const
+ {
+ return effect = 1+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 const & x, T1 const & y)
+ {
+ return effect = 2+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y) const
+ {
+ return effect = 3+x-y;
+ }
+
+ template <typename T0, typename T1>
+ int operator()(T0 & x, T1 & y)
+ {
+ return effect = 4+x-y;
+ }
+};
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+int main()
+{
+ fusion::vector<int,char> lv_vec(1,'\004');
+ test_func<> f;
+ test_func<noncopyable> f_nc;
+
+ boost::fusion::result_of::make_fused_procedure< test_func<> >::type fused_func
+ = fusion::make_fused_procedure(f);
+
+ CHECK_EFFECT(fused_func(lv_vec), 1);
+ CHECK_EFFECT(const_(fused_func)(lv_vec), 0);
+ CHECK_EFFECT(fusion::make_fused_procedure(const_(f))(lv_vec), 1);
+ CHECK_EFFECT(fusion::make_fused_procedure(ref(f_nc))(lv_vec), 1);
+ CHECK_EFFECT(fusion::make_fused_procedure(cref(f_nc))(lv_vec), 0);
+
+ CHECK_EFFECT(fused_func(fusion::make_vector(2,'\003')), 1);
+ CHECK_EFFECT(const_(fused_func)(fusion::make_vector(2,'\003')), 0);
+ CHECK_EFFECT(fusion::make_fused_procedure(const_(f))(fusion::make_vector(2,'\003')), 1);
+ CHECK_EFFECT(fusion::make_fused_procedure(ref(f_nc))(fusion::make_vector(2,'\003')), 1);
+ CHECK_EFFECT(fusion::make_fused_procedure(cref(f_nc))(fusion::make_vector(2,'\003')), 0);
+
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/functional/make_unfused.cpp b/src/boost/libs/fusion/test/functional/make_unfused.cpp
new file mode 100644
index 000000000..73be142b4
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/make_unfused.cpp
@@ -0,0 +1,128 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/generation/make_unfused.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <boost/mpl/empty_base.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/bool.hpp>
+
+#include <boost/utility/result_of.hpp>
+#include <boost/core/enable_if.hpp>
+
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+
+#include <boost/ref.hpp>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+using boost::noncopyable;
+typedef mpl::true_ no_nullary_call;
+
+using boost::ref;
+using boost::cref;
+
+template <class Base = mpl::empty_base, class RemoveNullary = mpl::false_>
+struct test_func
+ : Base
+{
+ template <typename Sig>
+ struct result;
+
+ template <class Self, class Seq>
+ struct result< Self(Seq &) >
+ : boost::enable_if<
+ mpl::not_<mpl::and_<boost::fusion::result_of::empty<Seq>, RemoveNullary> >,
+ long>
+ { };
+
+ template <typename Seq>
+ long operator()(Seq const & seq) const
+ {
+ long state = 0;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ template < typename Seq >
+ long operator()(Seq const & seq)
+ {
+ long state = 100;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ private:
+
+ struct fold_op
+ {
+ typedef long result_type;
+
+ template <typename T>
+ long operator()(long value, T & elem) const
+ {
+ elem += sizeof(T);
+ return value + elem;
+ }
+ };
+};
+
+template <typename T>
+inline T const & const_(T const & t)
+{
+ return t;
+}
+
+int main()
+{
+ test_func<> f;
+ test_func<noncopyable> f_nc;
+
+ boost::fusion::result_of::make_unfused< test_func<> >::type unfused_func =
+ fusion::make_unfused(f);
+
+ boost::fusion::result_of::make_unfused< boost::reference_wrapper<
+ test_func<noncopyable> > >::type unfused_func_ref =
+ fusion::make_unfused(ref(f_nc));
+
+ boost::fusion::result_of::make_unfused< boost::reference_wrapper<
+ test_func<noncopyable> const> >::type unfused_func_c_ref =
+ fusion::make_unfused(cref(f_nc));
+
+ BOOST_TEST(unfused_func() == 100);
+ BOOST_TEST(const_(unfused_func)() == 0);
+ BOOST_TEST(unfused_func_ref() == 100);
+ BOOST_TEST(unfused_func_c_ref() == 0);
+
+ long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
+ long expected;
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
+ BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(const_(unfused_func)(lv1,lv2,lv3) == 0 + expected);
+ BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
+ BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
+ BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/unfused.cpp b/src/boost/libs/fusion/test/functional/unfused.cpp
new file mode 100644
index 000000000..1e30eabd3
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/unfused.cpp
@@ -0,0 +1,119 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/adapter/unfused.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <boost/mpl/empty_base.hpp>
+#include <boost/mpl/identity.hpp>
+
+#include <boost/utility/result_of.hpp>
+
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
+using boost::noncopyable;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template <typename Sig>
+ struct result;
+
+ template <class Self, class Seq>
+ struct result< Self(Seq) >
+ : mpl::identity<long>
+ { };
+
+ template <typename Seq>
+ long operator()(Seq const & seq) const
+ {
+ long state = 0;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ template <typename Seq>
+ long operator()(Seq const & seq)
+ {
+ long state = 100;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ private:
+
+ struct fold_op
+ {
+ typedef long result_type;
+
+ template <typename T>
+ long operator()(long value, T & elem) const
+ {
+ elem += sizeof(T);
+ return value + elem;
+ }
+ };
+};
+
+void result_type_tests()
+{
+ using boost::is_same;
+
+ typedef fusion::unfused< test_func<> > t;
+ BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
+ BOOST_TEST(( is_same< boost::result_of< t (int &) >::type, long >::value ));
+}
+
+int main()
+{
+ result_type_tests();
+
+ test_func<noncopyable> f;
+ fusion::unfused< test_func<> > unfused_func;
+ fusion::unfused< test_func<noncopyable> & > unfused_func_ref(f);
+ fusion::unfused< test_func<> const > unfused_func_c;
+ fusion::unfused< test_func<> > const unfused_func_c2;
+ fusion::unfused< test_func<noncopyable> const & > unfused_func_c_ref(f);
+
+ BOOST_TEST(unfused_func() == 100);
+ BOOST_TEST(unfused_func_ref() == 100);
+ BOOST_TEST(unfused_func_c() == 0);
+ BOOST_TEST(unfused_func_c2() == 0);
+ BOOST_TEST(unfused_func_c_ref() == 0);
+
+ long lv1 = 2; int lv2 = 3l; char lv3 = '\007';
+ long expected;
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func(lv1,lv2,lv3) == 100 + expected);
+ BOOST_TEST(lv1 == 2+1*sizeof(lv1) && lv2 == 3+1*sizeof(lv2) && lv3 == 7+1*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_ref(lv1,lv2,lv3) == 100 + expected);
+ BOOST_TEST(lv1 == 2+2*sizeof(lv1) && lv2 == 3+2*sizeof(lv2) && lv3 == 7+2*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_c(lv1,lv2,lv3) == 0 + expected);
+ BOOST_TEST(lv1 == 2+3*sizeof(lv1) && lv2 == 3+3*sizeof(lv2) && lv3 == 7+3*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_c2(lv1,lv2,lv3) == 0 + expected);
+ BOOST_TEST(lv1 == 2+4*sizeof(lv1) && lv2 == 3+4*sizeof(lv2) && lv3 == 7+4*sizeof(lv3));
+
+ expected = lv1+sizeof(lv1) + lv2+sizeof(lv2) + lv3+sizeof(lv3);
+ BOOST_TEST(unfused_func_c_ref(lv1,lv2,lv3) == 0 + expected);
+ BOOST_TEST(lv1 == 2+5*sizeof(lv1) && lv2 == 3+5*sizeof(lv2) && lv3 == 7+5*sizeof(lv3));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/functional/unfused_typed.cpp b/src/boost/libs/fusion/test/functional/unfused_typed.cpp
new file mode 100644
index 000000000..eaa03425f
--- /dev/null
+++ b/src/boost/libs/fusion/test/functional/unfused_typed.cpp
@@ -0,0 +1,165 @@
+/*=============================================================================
+ Copyright (c) 2006-2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/functional/adapter/unfused_typed.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <boost/mpl/empty_base.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/placeholders.hpp>
+
+#include <boost/utility/result_of.hpp>
+
+#include <boost/fusion/algorithm/iteration/fold.hpp>
+
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+using mpl::placeholders::_;
+
+using boost::noncopyable;
+
+typedef fusion::vector<> types0;
+typedef fusion::vector<long &> types1;
+typedef fusion::vector<long &,int,char> types3;
+
+template <class Base = boost::mpl::empty_base>
+struct test_func
+ : Base
+{
+ template<typename T>
+ struct result;
+
+ template <class Self, class Seq>
+ struct result< Self(Seq) >
+ : mpl::identity<long>
+ { };
+
+ template <typename Seq>
+ long operator()(Seq const & seq) const
+ {
+ long state = 0;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ template < typename Seq >
+ long operator()(Seq const & seq)
+ {
+ long state = 100;
+ return fusion::fold(seq, state, fold_op());
+ }
+
+ private:
+
+ struct fold_op
+ {
+ typedef long result_type;
+
+ template <typename T>
+ long operator()(long value, T const & elem) const
+ {
+ return value + sizeof(T) * elem;
+ }
+
+ template <typename T>
+ long operator()(long value, T & elem) const
+ {
+ elem += sizeof(T);
+ return value;
+ }
+ };
+};
+
+void result_type_tests()
+{
+ using boost::is_same;
+
+ typedef fusion::unfused_typed< test_func<>, types0 > t0;
+ BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value ));
+ typedef fusion::unfused_typed< test_func<>, types1 > t1;
+ BOOST_TEST(( is_same< boost::result_of< t1 (long &) >::type, long >::value ));
+}
+
+#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
+# define BOOST_TEST_NO_VC71(cond) (void)((cond)?0:1)
+#else
+# define BOOST_TEST_NO_VC71(cond) BOOST_TEST(cond)
+#endif
+
+void nullary_tests()
+{
+ test_func<noncopyable> f;
+ fusion::unfused_typed< test_func<>, types0 > unfused_func;
+ fusion::unfused_typed< test_func<noncopyable> &, types0 > unfused_func_ref(f);
+ fusion::unfused_typed< test_func<> const, types0 > unfused_func_c;
+ fusion::unfused_typed< test_func<>, types0 > const unfused_func_c2;
+ fusion::unfused_typed< test_func<noncopyable> const &, types0 > unfused_func_c_ref(f);
+
+ BOOST_TEST(unfused_func() == 100);
+ BOOST_TEST(unfused_func_ref() == 100);
+ BOOST_TEST(unfused_func_c() == 0);
+ BOOST_TEST(unfused_func_c2() == 0);
+ BOOST_TEST(unfused_func_c_ref() == 0);
+}
+
+void unary_tests()
+{
+ test_func<noncopyable> f;
+ fusion::unfused_typed< test_func<>, types1 > unfused_func;
+ fusion::unfused_typed< test_func<noncopyable> &, types1 > unfused_func_ref(f);
+ fusion::unfused_typed< test_func<> const, types1 > unfused_func_c;
+ fusion::unfused_typed< test_func<>, types1 > const unfused_func_c2;
+ fusion::unfused_typed< test_func<noncopyable> const &, types1 > unfused_func_c_ref(f);
+
+ long lvalue = 1;
+ BOOST_TEST_NO_VC71(unfused_func(lvalue) == 100);
+ BOOST_TEST(lvalue == 1 + 1*sizeof(lvalue));
+ BOOST_TEST(unfused_func_ref(lvalue) == 100);
+ BOOST_TEST(lvalue == 1 + 2*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c(lvalue) == 0);
+ BOOST_TEST(lvalue == 1 + 3*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c2(lvalue) == 0);
+ BOOST_TEST(lvalue == 1 + 4*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c_ref(lvalue) == 0);
+ BOOST_TEST(lvalue == 1 + 5*sizeof(lvalue));
+}
+
+void ternary_tests()
+{
+ test_func<noncopyable> f;
+ fusion::unfused_typed< test_func<>, types3 > unfused_func;
+ fusion::unfused_typed< test_func<noncopyable> &, types3 > unfused_func_ref(f);
+ fusion::unfused_typed< test_func<> const, types3 > unfused_func_c;
+ fusion::unfused_typed< test_func<>, types3 > const unfused_func_c2;
+ fusion::unfused_typed< test_func<noncopyable> const &, types3 > unfused_func_c_ref(f);
+
+ long lvalue = 1;
+ static const long expected = 2*sizeof(int) + 7*sizeof(char);
+ BOOST_TEST_NO_VC71(unfused_func(lvalue,2,'\007') == 100 + expected);
+ BOOST_TEST(lvalue == 1 + 1*sizeof(lvalue));
+ BOOST_TEST(unfused_func_ref(lvalue,2,'\007') == 100 + expected);
+ BOOST_TEST(lvalue == 1 + 2*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c(lvalue,2,'\007') == 0 + expected);
+ BOOST_TEST(lvalue == 1 + 3*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c2(lvalue,2,'\007') == 0 + expected);
+ BOOST_TEST(lvalue == 1 + 4*sizeof(lvalue));
+ BOOST_TEST(unfused_func_c_ref(lvalue,2,'\007') == 0 + expected);
+ BOOST_TEST(lvalue == 1 + 5*sizeof(lvalue));
+}
+
+int main()
+{
+ result_type_tests();
+ nullary_tests();
+ unary_tests();
+ ternary_tests();
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_adt.cpp b/src/boost/libs/fusion/test/sequence/adapt_adt.cpp
new file mode 100644
index 000000000..00a149b72
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_adt.cpp
@@ -0,0 +1,311 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ class point
+ {
+ public:
+
+ point() : x(0), y(0), z(0) {}
+ point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ int get_z() const { return z; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+ void set_z(int z_) { z = z_; }
+
+ private:
+
+ int x;
+ int y;
+ int z;
+ };
+
+#if !BOOST_WORKAROUND(__GNUC__,<4)
+ class point_with_private_members
+ {
+ friend struct boost::fusion::extension::access;
+
+ public:
+ point_with_private_members() : x(0), y(0), z(0) {}
+ point_with_private_members(int in_x, int in_y, int in_z)
+ : x(in_x), y(in_y), z(in_z) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ int get_z() const { return z; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+ void set_z(int z_) { z = z_; }
+
+ private:
+
+ int x;
+ int y;
+ int z;
+ };
+#endif
+
+ // A sequence that has data members defined in an unrelated namespace
+ // (std, in this case). This allows testing ADL issues.
+ class name
+ {
+ public:
+ name() {}
+ name(const std::string& last, const std::string& first)
+ : last(last), first(first) {}
+
+ const std::string& get_last() const { return last; }
+ const std::string& get_first() const { return first; }
+ void set_last(const std::string& last_) { last = last_; }
+ void set_first(const std::string& first_) { first = first_; }
+ private:
+ std::string last;
+ std::string first;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ADT(
+ ns::point,
+ (int, int, obj.get_x(), obj.set_x(val))
+ // Mixing auto & BOOST_FUSION_ADAPT_AUTO to test backward compatibility
+ (auto, BOOST_FUSION_ADAPT_AUTO, obj.get_y(), obj.set_y(val))
+ (obj.get_z(), obj.set_z(val))
+ )
+
+# if !BOOST_WORKAROUND(__GNUC__,<4)
+ BOOST_FUSION_ADAPT_ADT(
+ ns::point_with_private_members,
+ (obj.get_x(), obj.set_x(val))
+ (obj.get_y(), obj.set_y(val))
+ (obj.get_z(), obj.set_z(val))
+ )
+# endif
+
+
+ BOOST_FUSION_ADAPT_ADT(
+ ns::name,
+ (obj.get_last(), obj.set_last(val))
+ (obj.get_first(), obj.set_first(val))
+ )
+
+
+#else // BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ADT(
+ ns::point,
+ (int, int, obj.get_x(), obj.set_x(val))
+ (auto, auto, obj.get_y(), obj.set_y(val))
+ (auto, auto, obj.get_z(), obj.set_z(val))
+ )
+
+# if !BOOST_WORKAROUND(__GNUC__,<4)
+ BOOST_FUSION_ADAPT_ADT(
+ ns::point_with_private_members,
+ (auto, auto, obj.get_x(), obj.set_x(val))
+ (auto, auto, obj.get_y(), obj.set_y(val))
+ (auto, auto, obj.get_z(), obj.set_z(val))
+ )
+# endif
+
+ BOOST_FUSION_ADAPT_ADT(
+ ns::name,
+ (const std::string&, const std::string&, obj.get_last(), obj.set_last(val))
+ (BOOST_FUSION_ADAPT_AUTO, auto, obj.get_first(), obj.set_first(val))
+ )
+
+#endif
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ADT(empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point>::value);
+ ns::point p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ fusion::vector<int, float, int> v1(4, 2.f, 2);
+ ns::point v2(5, 3, 3);
+ fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ fusion::vector<std::string, std::string> v1("Lincoln", "Abraham");
+ ns::name v2("Roosevelt", "Franklin");
+ ns::name v3("Roosevelt", "Theodore");
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point p(5, 3, 3);
+ fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point p(5, 3, 3);
+ fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<ns::point,0>::type
+ , mpl::front<ns::point>::type>));
+ }
+
+#if !BOOST_WORKAROUND(__GNUC__,<4)
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point_with_private_members>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point_with_private_members>::value);
+ ns::point_with_private_members p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point_with_private_members>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+#endif
+
+ {
+ // Check types provided in case it's provided
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::front<ns::point>::type,
+ boost::fusion::extension::adt_attribute_proxy<ns::point,0,false>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::front<ns::point>::type::type,
+ int
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::front<ns::point const>::type,
+ boost::fusion::extension::adt_attribute_proxy<ns::point,0,true>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::front<ns::point const>::type::type,
+ int
+ >));
+
+ // Check types provided in case it's deduced
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::back<ns::point>::type,
+ boost::fusion::extension::adt_attribute_proxy<ns::point,2,false>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::back<ns::point>::type::type,
+ int
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::back<ns::point const>::type,
+ boost::fusion::extension::adt_attribute_proxy<ns::point,2,true>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::back<ns::point const>::type::type,
+ int
+ >));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_adt_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_adt_empty.cpp
new file mode 100644
index 000000000..03e786b7a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_adt_empty.cpp
@@ -0,0 +1,87 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ADT(empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_adt>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_adt>::value);
+ empty_adt e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_adt>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_adt>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_adt>::type,
+ fusion::result_of::end<empty_adt>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_adt e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_adt e;
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_adt>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_adt_named.cpp b/src/boost/libs/fusion/test/sequence/adapt_adt_named.cpp
new file mode 100644
index 000000000..19d2d8b11
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_adt_named.cpp
@@ -0,0 +1,161 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt_named.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ class point
+ {
+ public:
+
+ point() : x(0), y(0), z(0) {}
+ point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ int get_z() const { return z; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+ void set_z(int z_) { z = z_; }
+
+ private:
+
+ int x;
+ int y;
+ int z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+// this creates a fusion view: boost::fusion::adapted::point
+BOOST_FUSION_ADAPT_ADT_NAMED(
+ ns::point, point,
+ (int, int, obj.get_x(), obj.set_x(val))
+ (int, int, obj.get_y(), obj.set_y(val))
+ (obj.get_z(), obj.set_z(val))
+)
+
+#else // BOOST_PP_VARIADICS
+
+// this creates a fusion view: boost::fusion::adapted::point
+BOOST_FUSION_ADAPT_ADT_NAMED(
+ ns::point, point,
+ (int, int, obj.get_x(), obj.set_x(val))
+ (int, int, obj.get_y(), obj.set_y(val))
+ (auto, auto, obj.get_z(), obj.set_z(val))
+)
+
+#endif // BOOST_PP_VARIADICS
+
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ADT_NAMED(empty_adt,renamed_empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::point>::value);
+ ns::point basep(123, 456, 789);
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ fusion::vector<int, float, int> v1(4, 2.f, 2);
+ ns::point basep(5, 3, 3);
+ adapted::point v2(basep);
+
+ fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point basep(5, 3, 3);
+ adapted::point p(basep);
+
+ fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point basep(5, 3, 3);
+ adapted::point p(basep);
+
+ fusion::list<int, long, float> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<adapted::point,0>::type
+ , mpl::front<adapted::point>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_adt_named_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_adt_named_empty.cpp
new file mode 100644
index 000000000..c7fa20331
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_adt_named_empty.cpp
@@ -0,0 +1,88 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt_named.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ADT_NAMED(::empty_adt,empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ empty_adt empty;
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::empty_adt>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::empty_adt>::value);
+ adapted::empty_adt e(empty);
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<adapted::empty_adt>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<adapted::empty_adt>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<adapted::empty_adt>::type,
+ fusion::result_of::end<adapted::empty_adt>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ adapted::empty_adt e(empty);
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ adapted::empty_adt e(empty);
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::empty_adt>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_adt.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt.cpp
new file mode 100644
index 000000000..a0dc22326
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt.cpp
@@ -0,0 +1,164 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ struct non_member;
+
+ class point
+ {
+ public:
+
+ point() : x(0), y(0), z(0) {}
+ point(int in_x, int in_y, int in_z) : x(in_x), y(in_y), z(in_z) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ int get_z() const { return z; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+ void set_z(int z_) { z = z_; }
+
+ private:
+
+ int x;
+ int y;
+ int z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+BOOST_FUSION_ADAPT_ASSOC_ADT(
+ ns::point,
+ (int, int, obj.get_x(), obj.set_x(val), ns::x_member)
+ (int, int, obj.get_y(), obj.set_y(val), ns::y_member)
+ (obj.get_z(), obj.set_z(val), ns::z_member)
+)
+
+#else // BOOST_PP_VARIADICS
+
+BOOST_FUSION_ADAPT_ASSOC_ADT(
+ ns::point,
+ (int, int, obj.get_x(), obj.set_x(val), ns::x_member)
+ (int, int, obj.get_y(), obj.set_y(val), ns::y_member)
+ (auto, auto, obj.get_z(), obj.set_z(val), ns::z_member)
+)
+
+#endif
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ASSOC_ADT(empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point>::value);
+ ns::point p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ boost::fusion::vector<int, float, int> v1(4, 2.f, 2);
+ ns::point v2(5, 3, 3);
+ boost::fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point p(5, 3, 3);
+ boost::fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point p(5, 3, 3);
+ boost::fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<ns::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<ns::point,0>::type
+ , boost::mpl::front<ns::point>::type>));
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::z_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::non_member> >));
+
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::z_member>::type, int>));
+
+ ns::point p(5, 3, 1);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ BOOST_TEST(at_key<ns::z_member>(p) == 1);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_empty.cpp
new file mode 100644
index 000000000..26cd98573
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_empty.cpp
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ASSOC_ADT(empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_adt>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_adt>::value);
+ empty_adt e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_adt>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_adt>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_adt>::type,
+ fusion::result_of::end<empty_adt>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_adt e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(e != v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_adt e;
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_adt>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_adt, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_adt, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named.cpp
new file mode 100644
index 000000000..ecdd9028f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named.cpp
@@ -0,0 +1,159 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ class point
+ {
+ public:
+
+ point() : x(0), y(0) {}
+ point(int in_x, int in_y) : x(in_x), y(in_y) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+
+ private:
+
+ int x;
+ int y;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(
+ ns::point,
+ point,
+ (obj.get_x(), obj.set_x(val), ns::x_member)
+ (int, int, obj.get_y(), obj.set_y(val), ns::y_member)
+ )
+
+#else // BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(
+ ns::point,
+ point,
+ (auto, auto, obj.get_x(), obj.set_x(val), ns::x_member)
+ (int, int, obj.get_y(), obj.set_y(val), ns::y_member)
+ )
+
+#endif
+
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(empty_adt, renamed_empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::point>::value);
+ ns::point basep(123, 456);
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ boost::fusion::vector<int, float> v1(4, 2.f);
+ ns::point basev2(5, 3);
+ adapted::point v2(basev2);
+ boost::fusion::vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from adapted::point to vector
+ ns::point basep(5, 3);
+ adapted::point p(basep);
+ boost::fusion::vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from adated::point to list
+ ns::point basep(5, 3);
+ adapted::point p(basep);
+ boost::fusion::list<int, long> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<adapted::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<adapted::point,0>::type
+ , boost::mpl::front<adapted::point>::type>));
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
+
+ ns::point basep(5, 3);
+ adapted::point p(basep);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named_empty.cpp
new file mode 100644
index 000000000..e2e268001
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_adt_named_empty.cpp
@@ -0,0 +1,90 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_adt{};
+BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(::empty_adt,empty_adt,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ empty_adt empty;
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::empty_adt>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::empty_adt>::value);
+ adapted::empty_adt e(empty);
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<adapted::empty_adt>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<adapted::empty_adt>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<adapted::empty_adt>::type,
+ fusion::result_of::end<adapted::empty_adt>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ adapted::empty_adt e(empty);
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(e != v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ adapted::empty_adt e(empty);
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::empty_adt>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<adapted::empty_adt, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<adapted::empty_adt, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_struct.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct.cpp
new file mode 100644
index 000000000..6266e95f1
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct.cpp
@@ -0,0 +1,168 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2005-2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+ struct non_member;
+
+ struct point
+ {
+ int x;
+ int y;
+ int z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT(
+ ns::point,
+ (x, ns::x_member)
+ (auto, y, ns::y_member)
+ (int, z, ns::z_member)
+ )
+
+#else // BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT(
+ ns::point,
+ (auto, x, ns::x_member)
+ (auto, y, ns::y_member)
+ (int, z, ns::z_member)
+ )
+
+#endif
+
+struct empty_struct {};
+BOOST_FUSION_ADAPT_ASSOC_STRUCT(empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point>::value);
+ ns::point p = {123, 456, 789};
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ fusion::vector<int, float, int> v1(4, 2.f, 2);
+ ns::point v2 = {5, 3, 3};
+ fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point p = {5, 3, 3};
+ fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point p = {5, 3, 3};
+ fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::z_member>));
+ BOOST_MPL_ASSERT((mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::non_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::z_member>::type, int>));
+
+ ns::point p = {5, 3, 9};
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ BOOST_TEST(at_key<ns::z_member>(p) == 9);
+ }
+
+ {
+ BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<ns::point,0>::type
+ , mpl::front<ns::point>::type>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<ns::point,2>::type
+ , mpl::back<ns::point>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_empty.cpp
new file mode 100644
index 000000000..c7cadf947
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_empty.cpp
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_struct{};
+BOOST_FUSION_ADAPT_ASSOC_STRUCT(empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct>::value);
+ empty_struct e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_struct>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_struct>::type,
+ fusion::result_of::end<empty_struct>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_struct e;
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_struct e;
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named.cpp
new file mode 100644
index 000000000..966067871
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named.cpp
@@ -0,0 +1,139 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ struct point
+ {
+ int x;
+ int y;
+ };
+}
+
+
+#if BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
+ ns::point,
+ point,
+ (x, ns::x_member)
+ (auto, y, ns::y_member)
+ )
+
+#else // BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
+ ns::point,
+ point,
+ (int, x, ns::x_member)
+ (auto, y, ns::y_member)
+ )
+
+#endif
+
+struct empty_struct {};
+BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(empty_struct, renamed_empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::point>::value);
+ ns::point basep = {123, 456};
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ ns::point basev2 = {5, 3};
+ adapted::point v2(basev2);
+
+ vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from adapted::point to vector
+ ns::point basep = {5, 3};
+ adapted::point p(basep);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from adapted::point to list
+ ns::point basep = {5, 3};
+ adapted::point p(basep);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
+
+ ns::point basep = {5, 3};
+ adapted::point p(basep);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named_empty.cpp
new file mode 100644
index 000000000..a1783fd3b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_struct_named_empty.cpp
@@ -0,0 +1,90 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_struct{};
+BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(::empty_struct,empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ empty_struct empty;
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::empty_struct>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::empty_struct>::value);
+ adapted::empty_struct e(empty);
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<adapted::empty_struct>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<adapted::empty_struct>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<adapted::empty_struct>::type,
+ fusion::result_of::end<adapted::empty_struct>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ adapted::empty_struct e(empty);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ adapted::empty_struct e(empty);
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::empty_struct>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<adapted::empty_struct, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<adapted::empty_struct, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt.cpp
new file mode 100644
index 000000000..f416f46a8
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt.cpp
@@ -0,0 +1,177 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ struct non_member;
+
+ template<typename X, typename Y, typename Z>
+ class point
+ {
+ public:
+
+ point() : x(0), y(0), z(0) {}
+ point(X in_x, Y in_y, Z in_z) : x(in_x), y(in_y), z(in_z) {}
+
+ X get_x() const { return x; }
+ Y get_y() const { return y; }
+ Z get_z() const { return z; }
+ void set_x(X x_) { x = x_; }
+ void set_y(Y y_) { y = y_; }
+ void set_z(Z z_) { z = z_; }
+
+ private:
+
+ X x;
+ Y y;
+ Z z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
+ (X)(Y)(Z),
+ (ns::point)(X)(Y)(Z),
+ (X, X, obj.get_x(), obj.set_x(val), ns::x_member)
+ (Y, Y, obj.get_y(), obj.set_y(val), ns::y_member)
+ (obj.get_z(), obj.set_z(val), ns::z_member)
+)
+
+#else // BOOST_PP_VARIADICS
+BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
+ (X)(Y)(Z),
+ (ns::point)(X)(Y)(Z),
+ (X, X, obj.get_x(), obj.set_x(val), ns::x_member)
+ (Y, Y, obj.get_y(), obj.set_y(val), ns::y_member)
+ (auto, auto, obj.get_z(), obj.set_z(val), ns::z_member)
+)
+
+#endif
+
+template <typename TypeToConstruct>
+class empty_adt_templated_factory {
+
+ TypeToConstruct operator()() {
+ return TypeToConstruct();
+ }
+
+};
+
+BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
+ (TypeToConstruct),
+ (empty_adt_templated_factory)(TypeToConstruct),
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int,int,long> point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ boost::fusion::vector<int, float, long> v1(4, 2.f, 2);
+ point v2(5, 3, 3);
+ boost::fusion::vector<long, double, long> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p(5, 3, 3);
+ boost::fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p(5, 3, 3);
+ boost::fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<point,0>::type
+ , boost::mpl::front<point>::type>));
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::z_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::non_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::z_member>::type, long>));
+
+ point p(5, 3, 1);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ BOOST_TEST(at_key<ns::z_member>(p) == 1);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt_empty.cpp
new file mode 100644
index 000000000..f38ba7ac7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_adt_empty.cpp
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+template <typename T>
+class empty_adt{};
+BOOST_FUSION_ADAPT_ASSOC_TPL_ADT((T), (empty_adt)(T),)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_adt<void> >));
+ empty_adt<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_adt<void> >::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_adt<void> >));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_adt<void> >::type,
+ fusion::result_of::end<empty_adt<void> >::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_adt<void> e;
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_adt<void> e;
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_adt<void> >));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_adt<void>, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_adt<void>, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct.cpp
new file mode 100644
index 000000000..49f42c5d2
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct.cpp
@@ -0,0 +1,168 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ struct non_member;
+
+ template<typename X, typename Y, typename Z>
+ struct point
+ {
+ X x;
+ Y y;
+ Z z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
+ (X)(Y)(Z),
+ (ns::point)(X)(Y)(Z),
+ (int, x, ns::x_member)
+ (auto, y, ns::y_member)
+ (z, ns::z_member)
+ )
+
+#else // BOOST_PP_VARIADICS
+ BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
+ (X)(Y)(Z),
+ (ns::point)(X)(Y)(Z),
+ (int, x, ns::x_member)
+ (Y, y, ns::y_member)
+ (auto, z, ns::z_member)
+ )
+#endif
+
+template <typename TypeToConstruct>
+struct empty_struct_templated_factory {
+
+ TypeToConstruct operator()() {
+ return TypeToConstruct();
+ }
+
+};
+
+BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT(
+ (TypeToConstruct),
+ (empty_struct_templated_factory)(TypeToConstruct),
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int,int,float> point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p = {123, 456, 789.43f};
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789.43f));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ vector<int, float, int> v1(4, 2.f, 2);
+ point v2 = {5, 3, 3.f};
+ vector<long, double, float> v3(5, 4., 4.13f);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p = {5, 3, 3.f};
+ vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p = {5, 3, 3.f};
+ list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::z_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::non_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::z_member>::type, float>));
+
+ point p = {5, 3, 9.f};
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ BOOST_TEST(at_key<ns::z_member>(p) == 9);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct_empty.cpp
new file mode 100644
index 000000000..42795c419
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_assoc_tpl_struct_empty.cpp
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+template <typename T>
+class empty_struct{};
+BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT((T), (empty_struct)(T),)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
+ empty_struct<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_struct<void> >));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_struct<void> >::type,
+ fusion::result_of::end<empty_struct<void> >::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_struct<void> e;
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_struct<void> e;
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, int>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_struct.cpp b/src/boost/libs/fusion/test/sequence/adapt_struct.cpp
new file mode 100644
index 000000000..3518ff418
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_struct.cpp
@@ -0,0 +1,271 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace namespaced_type {
+ typedef int integer;
+}
+
+namespace ns
+{
+ struct point
+ {
+ int x;
+ int y;
+ namespaced_type::integer z;
+ };
+
+#if !BOOST_WORKAROUND(__GNUC__,<4)
+ struct point_with_private_attributes
+ {
+ friend struct boost::fusion::extension::access;
+
+ private:
+ int x;
+ int y;
+ int z;
+
+ public:
+ point_with_private_attributes(int x, int y, int z):x(x),y(y),z(z)
+ {}
+ };
+#endif
+
+ struct foo
+ {
+ int x;
+ };
+
+ struct bar
+ {
+ foo foo_;
+ int y;
+ };
+
+
+ // Testing non-constexpr compatible types
+ struct employee {
+ std::string name;
+ std::string nickname;
+
+ employee(std::string name, std::string nickname)
+ : name(name), nickname(nickname)
+ {}
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::point,
+ x,
+ y,
+ z
+ )
+
+# if !BOOST_WORKAROUND(__GNUC__,<4)
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::point_with_private_attributes,
+ x,
+ y,
+ z
+ )
+# endif
+
+ struct s { int m; };
+ BOOST_FUSION_ADAPT_STRUCT(s, m)
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::bar,
+ foo_.x, // test that adapted members can actually be expressions
+ (auto , y)
+ )
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::employee,
+ name,
+ nickname
+ )
+
+
+#else // BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::point,
+ (int, x)
+ (auto, y)
+ (namespaced_type::integer, z)
+ )
+
+# if !BOOST_WORKAROUND(__GNUC__,<4)
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::point_with_private_attributes,
+ (int, x)
+ (int, y)
+ (auto, z)
+ )
+# endif
+
+ struct s { int m; };
+ BOOST_FUSION_ADAPT_STRUCT(s, (auto, m))
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::bar,
+ (auto, foo_.x) // test that adapted members can actually be expressions
+ (BOOST_FUSION_ADAPT_AUTO, y) // Mixing auto & BOOST_FUSION_ADAPT_AUTO
+ // to test backward compatibility
+ )
+
+ BOOST_FUSION_ADAPT_STRUCT(
+ ns::employee,
+ (std::string, name)
+ (BOOST_FUSION_ADAPT_AUTO, nickname)
+ )
+
+#endif
+
+struct empty_struct {};
+BOOST_FUSION_ADAPT_STRUCT(empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+ using ns::point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p = {123, 456, 789};
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ vector<int, float, int> v1(4, 2.f, 2);
+ point v2 = {5, 3, 3};
+ vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p = {5, 3, 3};
+ vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p = {5, 3, 3};
+ list<int, long, int> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+ using boost::is_same;
+
+ typedef boost::fusion::result_of::begin<s>::type b;
+ typedef boost::fusion::result_of::end<s>::type e;
+ // this fails
+ BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+ {
+ BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<ns::point,0>::type
+ , mpl::front<ns::point>::type>));
+ }
+
+#if !BOOST_WORKAROUND(__GNUC__,<4)
+ {
+ ns::point_with_private_attributes p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+ }
+#endif
+
+ {
+ fusion::vector<int, float> v1(4, 2.f);
+ ns::bar v2 = {{5}, 3};
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ }
+
+ {
+ ns::employee emp("John Doe", "jdoe");
+ std::cout << at_c<0>(emp) << std::endl;
+ std::cout << at_c<1>(emp) << std::endl;
+
+ fusion::vector<std::string, std::string> v1("John Doe", "jdoe");
+ BOOST_TEST(emp == v1);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_struct_empty.cpp
new file mode 100644
index 000000000..202131d44
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_struct_empty.cpp
@@ -0,0 +1,87 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_struct{};
+BOOST_FUSION_ADAPT_STRUCT(empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct>::value);
+ empty_struct e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_struct>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_struct>::type,
+ fusion::result_of::end<empty_struct>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_struct e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(e != v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_struct e;
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_struct_named.cpp b/src/boost/libs/fusion/test/sequence/adapt_struct_named.cpp
new file mode 100644
index 000000000..ec5cf7bac
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_struct_named.cpp
@@ -0,0 +1,164 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct point
+ {
+ int x;
+ int y;
+ int z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+ // this creates a fusion view: boost::fusion::adapted::point
+ BOOST_FUSION_ADAPT_STRUCT_NAMED(
+ ns::point, point,
+ x,
+ y,
+ z
+ )
+
+ // this creates a fusion view: ns1::s1
+ struct s { int m; };
+ BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, m)
+
+#else // BOOST_PP_VARIADICS
+
+ // this creates a fusion view: boost::fusion::adapted::point
+ BOOST_FUSION_ADAPT_STRUCT_NAMED(
+ ns::point, point,
+ (int, x)
+ (BOOST_FUSION_ADAPT_AUTO, y)
+ (auto, z)
+ )
+
+ // this creates a fusion view: ns1::s1
+ struct s { int m; };
+ BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, (auto, m))
+
+#endif
+
+struct empty_struct {};
+BOOST_FUSION_ADAPT_STRUCT_NAMED(empty_struct, renamed_empty_struct, )
+BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(empty_struct, (ns1), renamed_empty_struct1, )
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::point>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::point>::value);
+ ns::point basep = {123, 456, 789};
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ fusion::vector<int, float, int> v1(4, 2.f, 2);
+ ns::point p = {5, 3, 3};
+ adapted::point v2(p);
+
+ fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from adapted::point to vector
+ ns::point basep = {5, 3, 3};
+ adapted::point p(basep);
+ fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from adapted::point to list
+ ns::point basep = {5, 3, 3};
+ adapted::point p(basep);
+ fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+ using boost::is_same;
+
+ typedef boost::fusion::result_of::begin<ns1::s1>::type b;
+ typedef boost::fusion::result_of::end<ns1::s1>::type e;
+ // this fails
+ BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+
+ {
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<adapted::point,0>::type
+ , mpl::front<adapted::point>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_struct_named_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_struct_named_empty.cpp
new file mode 100644
index 000000000..7272f6f61
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_struct_named_empty.cpp
@@ -0,0 +1,88 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+class empty_struct{};
+BOOST_FUSION_ADAPT_STRUCT_NAMED(::empty_struct,empty_struct,)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ empty_struct empty;
+ {
+ BOOST_MPL_ASSERT((traits::is_view<adapted::empty_struct>));
+ BOOST_STATIC_ASSERT(traits::is_view<adapted::empty_struct>::value);
+ adapted::empty_struct e(empty);
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<adapted::empty_struct>::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<adapted::empty_struct>));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<adapted::empty_struct>::type,
+ fusion::result_of::end<adapted::empty_struct>::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ adapted::empty_struct e(empty);
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(e != v);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ adapted::empty_struct e(empty);
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<adapted::empty_struct>));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_tpl_adt.cpp b/src/boost/libs/fusion/test/sequence/adapt_tpl_adt.cpp
new file mode 100644
index 000000000..d917134a7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_tpl_adt.cpp
@@ -0,0 +1,182 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ template<typename X, typename Y>
+ class point
+ {
+ public:
+
+ point() : x(0), y(0), z(0) {}
+ point(X x_, Y y_, int z_) : x(x_), y(y_), z(z_) {}
+
+ X get_x() const { return x; }
+ Y get_y() const { return y; }
+ int get_z() const { return z; }
+ void set_x(X x_) { x = x_; }
+ void set_y(Y y_) { y = y_; }
+ void set_z(int z_) { z = z_; }
+
+ private:
+
+ X x;
+ Y y;
+ int z;
+ };
+}
+
+
+#if BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_TPL_ADT(
+ (X)(Y),
+ (ns::point)(X)(Y),
+ (X, X, obj.get_x(), obj.set_x(val))
+ (Y, Y, obj.get_y(), obj.set_y(val))
+ (obj.get_z(), obj.set_z(val))
+ )
+
+#else // BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_TPL_ADT(
+ (X)(Y),
+ (ns::point)(X)(Y),
+ (X, X, obj.get_x(), obj.set_x(val))
+ (Y, Y, obj.get_y(), obj.set_y(val))
+ (auto, auto, obj.get_z(), obj.set_z(val))
+ )
+#endif
+
+template <typename TypeToConstruct>
+class empty_adt_templated_factory {
+
+ TypeToConstruct operator()() {
+ return TypeToConstruct();
+ }
+
+};
+
+BOOST_FUSION_ADAPT_TPL_ADT(
+ (TypeToConstruct),
+ (empty_adt_templated_factory)(TypeToConstruct),
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int, int> point;
+ typedef ns::point<std::string, std::string> name;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p(123, 456, 789);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ boost::fusion::vector<int, float, int> v1(4, 2.f, 2);
+ point v2(5, 3, 3);
+ boost::fusion::vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ boost::fusion::vector<std::string, std::string, int> v1("Lincoln", "Abraham", 3);
+ name v2("Roosevelt", "Franklin", 3);
+ name v3("Roosevelt", "Theodore", 3);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p(5, 3, 3);
+ boost::fusion::vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p(5, 3, 3);
+ boost::fusion::list<int, long, int> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_at_c<point,0>::type
+ , boost::mpl::front<point>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_tpl_adt_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_tpl_adt_empty.cpp
new file mode 100644
index 000000000..82bf21214
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_tpl_adt_empty.cpp
@@ -0,0 +1,87 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_adt.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+template <typename T>
+class empty_adt{};
+BOOST_FUSION_ADAPT_TPL_ADT((T), (empty_adt)(T),)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_adt<void> >));
+ empty_adt<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_adt<void> >::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_adt<void> >));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_adt<void> >::type,
+ fusion::result_of::end<empty_adt<void> >::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_adt<void> e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(e > v);
+ BOOST_TEST(e >= v);
+ }
+
+ {
+ empty_adt<void> e;
+
+ // conversion from empty_adt to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_adt to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_adt<void> >));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_tpl_struct.cpp b/src/boost/libs/fusion/test/sequence/adapt_tpl_struct.cpp
new file mode 100644
index 000000000..1776cd62a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_tpl_struct.cpp
@@ -0,0 +1,159 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ template<typename X, typename Y>
+ struct point
+ {
+ X x;
+ Y y;
+ int z;
+ };
+}
+
+#if BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_TPL_STRUCT(
+ (X)(Y),
+ (ns::point)(X)(Y),
+ x,
+ (auto, y)
+ (int, z)
+ )
+
+ template<typename M>
+ struct s { M m; };
+ BOOST_FUSION_ADAPT_TPL_STRUCT((M), (s)(M), m)
+
+#else // BOOST_PP_VARIADICS
+
+ BOOST_FUSION_ADAPT_TPL_STRUCT(
+ (X)(Y),
+ (ns::point)(X)(Y),
+ (X, x)
+ (Y, y)
+ (auto, z)
+ )
+
+ template<typename M>
+ struct s { M m; };
+ BOOST_FUSION_ADAPT_TPL_STRUCT((M), (s)(M), (auto, m))
+
+#endif
+
+template <typename TypeToConstruct>
+struct empty_struct_templated_factory {
+
+ TypeToConstruct operator()() {
+ return TypeToConstruct();
+ }
+
+};
+
+BOOST_FUSION_ADAPT_TPL_STRUCT(
+ (TypeToConstruct),
+ (empty_struct_templated_factory)(TypeToConstruct),
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int, int> point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p = {123, 456, 789};
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << at_c<2>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456, 789));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ at_c<2>(p) = 12;
+ BOOST_TEST(p == make_vector(6, 9, 12));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 3);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 12);
+ }
+
+ {
+ vector<int, float, int> v1(4, 2.f, 2);
+ point v2 = {5, 3, 3};
+ vector<long, double, int> v3(5, 4., 4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p = {5, 3, 3};
+ vector<int, long, int> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p = {5, 3, 3};
+ list<int, long> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+
+ typedef boost::fusion::result_of::begin<s<int> >::type b;
+ typedef boost::fusion::result_of::end<s<int> >::type e;
+ // this fails
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adapt_tpl_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/adapt_tpl_struct_empty.cpp
new file mode 100644
index 000000000..5cb1d442e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adapt_tpl_struct_empty.cpp
@@ -0,0 +1,87 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+
+template <typename T>
+class empty_struct{};
+BOOST_FUSION_ADAPT_TPL_STRUCT((T), (empty_struct)(T),)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
+ empty_struct<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
+ BOOST_MPL_ASSERT((fusion::result_of::empty<empty_struct<void> >));
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<
+ fusion::result_of::begin<empty_struct<void> >::type,
+ fusion::result_of::end<empty_struct<void> >::type>));
+ }
+
+ {
+ fusion::vector<> v;
+ empty_struct<void> e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct<void> e;
+
+ // conversion from empty_struct to vector
+ fusion::vector<> v(e);
+ v = e;
+
+ // FIXME
+ // conversion from empty_struct to list
+ //fusion::list<> l(e);
+ //l = e;
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/adt_attribute_proxy.cpp b/src/boost/libs/fusion/test/sequence/adt_attribute_proxy.cpp
new file mode 100644
index 000000000..eae4eb9a8
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/adt_attribute_proxy.cpp
@@ -0,0 +1,189 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/core/lightweight_test.hpp>
+#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <iostream>
+#include <string>
+
+namespace fusion=boost::fusion;
+
+template<typename Name, typename Age>
+struct employee
+{
+private:
+ Name name;
+ Age age;
+
+public:
+ template<typename OtherName>
+ void
+ set_name(OtherName const& n)
+ {
+ name=n;
+ }
+
+ template<typename OtherAge>
+ void
+ set_age(OtherAge const& a)
+ {
+ age=a;
+ }
+
+ Name& get_name()
+ {
+ return name;
+ }
+
+ Name const& get_name()const
+ {
+ return name;
+ }
+
+ Age& get_age()
+ {
+ return age;
+ }
+
+ Age const& get_age()const
+ {
+ return age;
+ }
+};
+
+namespace keys
+{
+ struct name;
+ struct age;
+}
+
+BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
+ (Name)(Age),
+ (employee) (Name)(Age),
+ (Name&, Name const&, obj.get_name(), obj.template set_name<Val>(val), keys::name)
+ (Age&, Age const&, obj.get_age(), obj.template set_age<Val>(val), keys::age))
+
+int main()
+{
+ typedef employee<std::string, int> et;
+ typedef et const etc;
+ et e;
+ etc& ec=e;
+
+ fusion::at_key<keys::name>(e)="marshall mathers";
+ fusion::at_key<keys::age>(e)=37;
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::value_at_key<et, keys::name>::type,
+ std::string
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::value_at_key<et, keys::name>::type,
+ boost::fusion::result_of::value_at_c<et, 0>::type
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::value_at_key<et, keys::age>::type,
+ int
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::value_at_key<et, keys::age>::type,
+ boost::fusion::result_of::value_at_c<et, 1>::type
+ >));
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<et, keys::name>::type,
+ fusion::extension::adt_attribute_proxy<et, 0, false>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<et, keys::age>::type,
+ fusion::extension::adt_attribute_proxy<et, 1, false>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<et, keys::name>::type,
+ boost::fusion::result_of::front<et>::type
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<et, keys::age>::type,
+ boost::fusion::result_of::back<et>::type
+ >));
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<etc, keys::name>::type,
+ fusion::extension::adt_attribute_proxy<et, 0, true>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<etc, keys::age>::type,
+ fusion::extension::adt_attribute_proxy<et, 1, true>
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<etc, keys::name>::type,
+ boost::fusion::result_of::front<etc>::type
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ boost::fusion::result_of::at_key<etc, keys::age>::type,
+ boost::fusion::result_of::back<etc>::type
+ >));
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ fusion::extension::adt_attribute_proxy<et, 0, false>::type,
+ std::string&
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ fusion::extension::adt_attribute_proxy<et, 0, true>::type,
+ std::string const&
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ fusion::extension::adt_attribute_proxy<et, 1, false>::type,
+ int&
+ >));
+ BOOST_MPL_ASSERT((
+ boost::is_same<
+ fusion::extension::adt_attribute_proxy<et, 1, true>::type,
+ int const&
+ >));
+
+ {
+ std::string& name=fusion::at_key<keys::name>(e);
+ int& age=fusion::at_key<keys::age>(e);
+ BOOST_TEST(name=="marshall mathers");
+ BOOST_TEST(age==37);
+ BOOST_TEST(fusion::at_key<keys::name>(e).get()=="marshall mathers");
+ BOOST_TEST(fusion::at_key<keys::age>(e).get()==37);
+ BOOST_TEST(fusion::front(e).get()=="marshall mathers");
+ BOOST_TEST(fusion::back(e).get()==37);
+ }
+
+ {
+ std::string const& name=fusion::at_key<keys::name>(ec);
+ int const& age=fusion::at_key<keys::age>(ec);
+ BOOST_TEST(name=="marshall mathers");
+ BOOST_TEST(age==37);
+ BOOST_TEST(fusion::at_key<keys::name>(ec).get()=="marshall mathers");
+ BOOST_TEST(fusion::at_key<keys::age>(ec).get()==37);
+ BOOST_TEST(fusion::front(ec).get()=="marshall mathers");
+ BOOST_TEST(fusion::back(ec).get()==37);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/array.cpp b/src/boost/libs/fusion/test/sequence/array.cpp
new file mode 100644
index 000000000..ca4a40ac9
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/array.cpp
@@ -0,0 +1,41 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/adapted/array.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/is_view.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ typedef int array_type[3];
+
+ BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
+ BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
+ BOOST_STATIC_ASSERT(traits::is_sequence<array_type>::value);
+ BOOST_STATIC_ASSERT(!traits::is_view<array_type>::value);
+
+ array_type arr = {1,2,3};
+
+ BOOST_TEST(*begin(arr) == 1);
+ BOOST_TEST(*next(begin(arr)) == 2);
+ BOOST_TEST(*advance_c<2>(begin(arr)) == 3);
+ BOOST_TEST(prior(next(begin(arr))) == begin(arr));
+ BOOST_TEST(*prior(end(arr)) == 3);
+ BOOST_TEST(at_c<2>(arr) == 3);
+ BOOST_TEST(size(arr) == 3);
+ BOOST_TEST(distance(begin(arr), end(arr)) == 3);
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/as_deque.cpp b/src/boost/libs/fusion/test/sequence/as_deque.cpp
new file mode 100644
index 000000000..c56c598dd
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_deque.cpp
@@ -0,0 +1,70 @@
+/*=============================================================================
+ Copyright (c) 2014 Louis Dionne
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/algorithm/transformation/push_front.hpp>
+#include <boost/fusion/container/deque/convert.hpp>
+#include <boost/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/generation/make_deque.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+
+#include <string>
+
+
+int main() {
+ using namespace boost::fusion;
+ using namespace boost;
+
+ BOOST_TEST(as_deque(make_vector()) == make_deque());
+ BOOST_TEST(as_deque(make_vector(1)) == make_deque(1));
+ BOOST_TEST(as_deque(make_vector(1, '2')) == make_deque(1, '2'));
+ BOOST_TEST(as_deque(make_vector(1, '2', 3.3f)) == make_deque(1, '2', 3.3f));
+
+ BOOST_TEST(as_deque(make_list()) == make_deque());
+ BOOST_TEST(as_deque(make_list(1)) == make_deque(1));
+ BOOST_TEST(as_deque(make_list(1, '2')) == make_deque(1, '2'));
+ BOOST_TEST(as_deque(make_list(1, '2', 3.3f)) == make_deque(1, '2', 3.3f));
+
+ {
+ deque<> xs;
+ BOOST_TEST(as_deque(push_back(xs, 1)) == make_deque(1));
+ }
+
+ {
+ deque<int> xs(1);
+ BOOST_TEST(as_deque(push_back(xs, '2')) == make_deque(1, '2'));
+ }
+
+ {
+ deque<int, char> xs(1, '2');
+ BOOST_TEST(as_deque(push_back(xs, 3.3f)) == make_deque(1, '2', 3.3f));
+ }
+
+ {
+ deque<> xs;
+ BOOST_TEST(
+ as_deque(push_front(xs, make_deque(1, '2', 3.3f))) ==
+ make_deque(make_deque(1, '2', 3.3f))
+ );
+
+ BOOST_TEST(as_deque(make_deque(make_deque(1))) == make_deque(make_deque(1)));
+ }
+
+/* Disabling test for now, see https://github.com/boostorg/fusion/pull/38 ($$$ FIXME $$$)
+
+ {
+ deque<> xs;
+ BOOST_TEST(
+ as_deque(push_front(xs, make_vector(1, '2', 3.3f))) ==
+ make_deque(make_vector(1, '2', 3.3f))
+ );
+ }
+*/
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/as_list.cpp b/src/boost/libs/fusion/test/sequence/as_list.cpp
new file mode 100644
index 000000000..8ee8bf128
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_list.cpp
@@ -0,0 +1,53 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/list/convert.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ vector0<> empty;
+ std::cout << as_list(make_vector(1, 1.23, "harru")) << std::endl;
+ std::cout << as_list(push_back(empty, 999)) << std::endl;
+
+ BOOST_TEST(as_list(make_vector(1, 1.23, "harru")) == make_vector(1, 1.23, std::string("harru")));
+ BOOST_TEST(as_list(push_back(empty, 999)) == push_back(empty, 999));
+ }
+
+ {
+ std::cout << as_list(mpl::vector_c<int, 1, 2, 3, 4, 5>()) << std::endl;
+ BOOST_TEST((as_list(mpl::vector_c<int, 1, 2, 3, 4, 5>())
+ == mpl::vector_c<int, 1, 2, 3, 4, 5>()));
+ }
+
+ {
+ // test conversion
+ list<int, std::string> l(make_vector(123, "harru"));
+ BOOST_TEST(l == make_vector(123, "harru"));
+ l = (make_vector(235, "hola")); // test assign
+ BOOST_TEST(l == make_vector(235, "hola"));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/as_map.cpp b/src/boost/libs/fusion/test/sequence/as_map.cpp
new file mode 100644
index 000000000..d2a89cc6c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_map.cpp
@@ -0,0 +1,61 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/map/convert.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/support/pair.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ vector0<> empty;
+ std::cout << as_map(make_list(make_pair<int>('X'), make_pair<double>("Men"))) << std::endl;
+ std::cout << as_map(push_back(empty, make_pair<int>(999))) << std::endl;
+ }
+
+ {
+ typedef pair<int, char> p1;
+ typedef pair<double, std::string> p2;
+ boost::fusion::result_of::as_map<list<p1, p2> >::type map(make_pair<int>('X'), make_pair<double>("Men"));
+ std::cout << at_key<int>(map) << std::endl;
+ std::cout << at_key<double>(map) << std::endl;
+ BOOST_TEST(at_key<int>(map) == 'X');
+ BOOST_TEST(at_key<double>(map) == "Men");
+ }
+
+ {
+ // test conversion
+ typedef map<
+ pair<int, char>
+ , pair<double, std::string> >
+ map_type;
+
+ map_type m(make_vector(make_pair<int>('X'), make_pair<double>("Men")));
+ BOOST_TEST(as_vector(m) == make_vector(make_pair<int>('X'), make_pair<double>("Men")));
+ m = (make_vector(make_pair<int>('X'), make_pair<double>("Men"))); // test assign
+ BOOST_TEST(as_vector(m) == make_vector(make_pair<int>('X'), make_pair<double>("Men")));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/as_map_assoc.cpp b/src/boost/libs/fusion/test/sequence/as_map_assoc.cpp
new file mode 100644
index 000000000..bc9a6951c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_map_assoc.cpp
@@ -0,0 +1,85 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/map/convert.hpp>
+#include <boost/fusion/container/generation/make_set.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/support/pair.hpp>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+
+ struct point
+ {
+ int x;
+ int y;
+ };
+}
+
+BOOST_FUSION_ADAPT_ASSOC_STRUCT(
+ ns::point,
+ (int, x, ns::x_member)
+ (int, y, ns::y_member)
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ ns::point p = {123, 456};
+ std::cout << as_map(p) << std::endl;
+ }
+
+ {
+ ns::point p = {123, 456};
+ boost::fusion::result_of::as_map<ns::point>::type map(p);
+ std::cout << at_key<ns::x_member>(map) << std::endl;
+ std::cout << at_key<ns::y_member>(map) << std::endl;
+ BOOST_TEST(at_key<ns::x_member>(map) == 123);
+ BOOST_TEST(at_key<ns::y_member>(map) == 456);
+ }
+
+ {
+ boost::fusion::result_of::as_map<set<int, char> >::type map(make_set(1, '2'));
+ BOOST_TEST(at_key<int>(map) == 1);
+ BOOST_TEST(at_key<char>(map) == '2');
+ }
+
+ {
+ // test conversion
+ typedef map<
+ pair<ns::x_member, int>
+ , pair<ns::y_member, int> >
+ map_type;
+
+ ns::point p = {123, 456};
+ map_type m(p);
+ BOOST_TEST(as_vector(m) == make_vector(make_pair<ns::x_member>(123), make_pair<ns::y_member>(456)));
+ m = (make_vector(make_pair<ns::x_member>(123), make_pair<ns::y_member>(456))); // test assign
+ BOOST_TEST(as_vector(m) == make_vector(make_pair<ns::x_member>(123), make_pair<ns::y_member>(456)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/as_set.cpp b/src/boost/libs/fusion/test/sequence/as_set.cpp
new file mode 100644
index 000000000..97dd89e87
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_set.cpp
@@ -0,0 +1,64 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/set/convert.hpp>
+#include <boost/fusion/container/list/convert.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ vector0<> empty;
+ std::cout << as_set(make_list(1, 1.23, "harru")) << std::endl;
+ std::cout << as_set(push_back(empty, 999)) << std::endl;
+
+ BOOST_TEST(as_list(as_set(make_list(1, 1.23, "harru")))
+ == make_list(1, 1.23, std::string("harru")));
+ BOOST_TEST(as_list(as_set(push_back(empty, 999)))
+ == push_back(empty, 999));
+ }
+
+ {
+ boost::fusion::result_of::as_set<list<int, double, std::string> >::type set(1, 1.23, "harru");
+ std::cout << at_key<int>(set) << std::endl;
+ BOOST_TEST(at_key<int>(set) == 1);
+ }
+
+ {
+ std::cout << as_set(mpl::vector_c<int, 1, 2, 3, 4, 5>()) << std::endl;
+ BOOST_TEST((as_list(as_set(mpl::vector_c<int, 1, 2, 3, 4, 5>()))
+ == mpl::vector_c<int, 1, 2, 3, 4, 5>()));
+ }
+
+ {
+ // test conversion
+ set<int, std::string> s(make_vector(123, "harru"));
+ BOOST_TEST(as_vector(s) == make_vector(123, "harru"));
+ s = (make_vector(235, "hola")); // test assign
+ BOOST_TEST(as_vector(s) == make_vector(235, "hola"));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/as_vector.cpp b/src/boost/libs/fusion/test/sequence/as_vector.cpp
new file mode 100644
index 000000000..af1aaffb8
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/as_vector.cpp
@@ -0,0 +1,54 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ vector0<> empty;
+ std::cout << as_vector(make_list(1, 1.23, "harru")) << std::endl;
+ std::cout << as_vector(push_back(empty, 999)) << std::endl;
+
+ BOOST_TEST(as_vector(make_list(1, 1.23, "harru")) == make_list(1, 1.23, std::string("harru")));
+ BOOST_TEST(as_vector(push_back(empty, 999)) == push_back(empty, 999));
+ }
+
+ {
+ std::cout << as_vector(mpl::vector_c<int, 1, 2, 3, 4, 5>()) << std::endl;
+ BOOST_TEST((as_vector(mpl::vector_c<int, 1, 2, 3, 4, 5>())
+ == mpl::vector_c<int, 1, 2, 3, 4, 5>()));
+ }
+
+ {
+ // test conversion
+ vector<int, std::string> v(make_list(123, "harru"));
+ BOOST_TEST(v == make_list(123, "harru"));
+ v = (make_list(235, "hola")); // test assign
+ BOOST_TEST(v == make_list(235, "hola"));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/back_extended_deque.cpp b/src/boost/libs/fusion/test/sequence/back_extended_deque.cpp
new file mode 100644
index 000000000..368ec0c26
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/back_extended_deque.cpp
@@ -0,0 +1,114 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/deque/back_extended_deque.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/mpl.hpp>
+
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/iterator.hpp>
+
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ typedef deque<> initial_deque_type;
+ initial_deque_type initial_deque;
+ typedef back_extended_deque<initial_deque_type, long> extended_type;
+ extended_type extended(initial_deque, 101L);
+
+ BOOST_TEST(size(extended) == 1);
+ BOOST_TEST(extended == make_vector(101L));
+ BOOST_TEST(*begin(extended) == 101L);
+ BOOST_TEST(*prior(end(extended)) == 101L);
+ BOOST_TEST(distance(begin(extended), end(extended)) == 1);
+ }
+ {
+ namespace mpl = boost::mpl;
+ typedef deque<> initial_deque_type;
+ typedef back_extended_deque<initial_deque_type, long> extended_type;
+
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 0>::type, long>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::deref<mpl::begin<extended_type>::type>::type, long>));
+ BOOST_MPL_ASSERT((mpl::equal_to<mpl::size<extended_type>::type, mpl::int_<1> >));
+ }
+ {
+ long l(101L);
+ typedef deque<> initial_deque_type;
+ initial_deque_type initial_deque;
+ typedef back_extended_deque<initial_deque_type, long&> extended_type;
+ extended_type extended(initial_deque, l);
+ BOOST_TEST(extended == make_vector(101L));
+
+ long l2(202L);
+ extended_type extended2(initial_deque_type(), l2);
+
+ extended = extended2;
+
+ BOOST_TEST(extended == make_vector(202L));
+
+ BOOST_TEST(l == l2);
+ }
+
+ {
+ typedef deque<int, char> initial_deque_type;
+ initial_deque_type initial_deque(1, 'a');
+ typedef back_extended_deque<initial_deque_type, long> extended_type;
+ extended_type extended(initial_deque, 101L);
+
+ BOOST_TEST(size(extended) == 3);
+ BOOST_TEST(extended == make_vector(1, 'a', 101L));
+ BOOST_TEST(*begin(extended) == 1);
+ BOOST_TEST(*next(begin(extended)) == 'a');
+ BOOST_TEST(*prior(end(extended)) == 101L);
+ BOOST_TEST(distance(begin(extended), end(extended)) == 3);
+ BOOST_TEST(*advance_c<2>(begin(extended)) == 101L);
+ }
+ {
+ namespace mpl = boost::mpl;
+ typedef deque<int, char> initial_deque_type;
+ typedef back_extended_deque<initial_deque_type, long> extended_type;
+
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 0>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 1>::type, char>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 2>::type, long>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::deref<mpl::begin<extended_type>::type>::type, int>));
+ BOOST_MPL_ASSERT((mpl::equal_to<mpl::size<extended_type>::type, mpl::int_<3> >));
+ }
+ {
+ char ch('a');
+ long l(101L);
+ int i(1);
+ typedef deque<int&, char&> initial_deque_type;
+ initial_deque_type initial_deque(i, ch);
+ typedef back_extended_deque<initial_deque_type, long&> extended_type;
+ extended_type extended(initial_deque, l);
+ BOOST_TEST(extended == make_vector(1, 'a', 101L));
+
+ char ch2('b');
+ long l2(202L);
+ int i2(2);
+ extended_type extended2(initial_deque_type(i2, ch2), l2);
+
+ extended = extended2;
+
+ BOOST_TEST(extended == make_vector(2, 'b', 202L));
+
+ BOOST_TEST(i == i2);
+ BOOST_TEST(ch == ch2);
+ BOOST_TEST(l == l2);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/boost_array.cpp b/src/boost/libs/fusion/test/sequence/boost_array.cpp
new file mode 100644
index 000000000..f3f714700
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/boost_array.cpp
@@ -0,0 +1,44 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005-2006 Dan Marsden
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/adapted/boost_array.hpp>
+#include <boost/array.hpp>
+
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/fusion/iterator.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ typedef boost::array<int,3> array_type;
+
+ BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
+ BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
+ BOOST_STATIC_ASSERT(traits::is_sequence<array_type>::value);
+ BOOST_STATIC_ASSERT(!traits::is_view<array_type>::value);
+
+ array_type arr = {{1,2,3}};
+
+ BOOST_TEST(*begin(arr) == 1);
+ BOOST_TEST(*next(begin(arr)) == 2);
+ BOOST_TEST(*advance_c<2>(begin(arr)) == 3);
+ BOOST_TEST(prior(next(begin(arr))) == begin(arr));
+ BOOST_TEST(*prior(end(arr)) == 3);
+ BOOST_TEST(at_c<2>(arr) == 3);
+ BOOST_TEST(size(arr) == 3);
+ BOOST_TEST(distance(begin(arr), end(arr)) == 3);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/boost_tuple.cpp b/src/boost/libs/fusion/test/sequence/boost_tuple.cpp
new file mode 100644
index 000000000..abe7d3c83
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/boost_tuple.cpp
@@ -0,0 +1,118 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/boost_tuple.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/sequence/convert.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ typedef boost::tuple<int, std::string> tuple_type;
+ BOOST_MPL_ASSERT_NOT((traits::is_view<tuple_type>));
+ BOOST_STATIC_ASSERT(!traits::is_view<tuple_type>::value);
+ tuple_type t(123, "Hola!!!");
+
+ std::cout << at_c<0>(t) << std::endl;
+ std::cout << at_c<1>(t) << std::endl;
+ std::cout << t << std::endl;
+ BOOST_TEST(t == make_vector(123, "Hola!!!"));
+
+ at_c<0>(t) = 6;
+ at_c<1>(t) = "mama mia";
+ BOOST_TEST(t == make_vector(6, "mama mia"));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<tuple_type>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<tuple_type>::value);
+
+ BOOST_TEST(front(t) == 6);
+ }
+
+ {
+ fusion::vector<int, float> v1(4, 3.3f);
+ boost::tuple<short, float> v2(5, 3.3f);
+ fusion::vector<long, double> v3(5, 4.4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from boost tuple to vector
+ fusion::vector<int, std::string> v(tuples::make_tuple(123, "Hola!!!"));
+ v = tuples::make_tuple(123, "Hola!!!");
+ }
+
+ {
+ // conversion from boost tuple to list
+ fusion::list<int, std::string> l(tuples::make_tuple(123, "Hola!!!"));
+ l = tuples::make_tuple(123, "Hola!!!");
+ }
+
+ {
+ // conversion vector to boost tuple
+ boost::tuple<int, std::string> t = convert<boost_tuple_tag>(make_vector(123, "Hola!!!"));
+ BOOST_TEST(get<0>(t) == 123);
+ BOOST_TEST(get<1>(t) == "Hola!!!");
+ }
+
+ {
+ // test from Ticket #1601, submitted by Shunsuke Sogame
+ // expanded by Stjepan Rajko
+ boost::tuple<int, char> t(3, 'a');
+
+ BOOST_TEST(0u == fusion::distance(fusion::begin(t), fusion::begin(t)));
+ BOOST_TEST(1u == fusion::distance(fusion::begin(t), fusion::next(fusion::begin(t))));
+ BOOST_TEST(2u == fusion::distance(fusion::begin(t), fusion::end(t)));
+ }
+
+ {
+ typedef boost::tuple<int, std::string> tuple_type;
+ BOOST_MPL_ASSERT((mpl::is_sequence<tuple_type>));
+ BOOST_MPL_ASSERT((boost::is_same<int, mpl::front<tuple_type>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/boost_tuple_iterator.cpp b/src/boost/libs/fusion/test/sequence/boost_tuple_iterator.cpp
new file mode 100644
index 000000000..3ab096b9b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/boost_tuple_iterator.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/adapted/boost_tuple.hpp>
+
+#define FUSION_SEQUENCE boost::tuple
+#define FUSION_TRAVERSAL_TAG forward_traversal_tag
+#define FUSION_NO_PRIOR
+#include "./iterator.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/comparison.hpp b/src/boost/libs/fusion/test/sequence/comparison.hpp
new file mode 100644
index 000000000..2c954d0a5
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/comparison.hpp
@@ -0,0 +1,79 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+
+struct not_a_fusion_container {};
+template <typename T>
+inline bool operator==(not_a_fusion_container, T const&) { return true; }
+template <typename T>
+inline bool operator!=(not_a_fusion_container, T const&) { return true; }
+template <typename T>
+inline bool operator<(not_a_fusion_container, T const&) { return true; }
+template <typename T>
+inline bool operator<=(not_a_fusion_container, T const&) { return true; }
+template <typename T>
+inline bool operator>(not_a_fusion_container, T const&) { return true; }
+template <typename T>
+inline bool operator>=(not_a_fusion_container, T const&) { return true; }
+
+void
+equality_test()
+{
+ using namespace boost::fusion;
+
+ FUSION_SEQUENCE<int, char> v1(5, 'a');
+ FUSION_SEQUENCE<int, char> v2(5, 'a');
+ BOOST_TEST(v1 == v2);
+
+ FUSION_SEQUENCE<int, char> v3(5, 'b');
+ FUSION_SEQUENCE<int, char> t4(2, 'a');
+ BOOST_TEST(v1 != v3);
+ BOOST_TEST(v1 != t4);
+ BOOST_TEST(!(v1 != v2));
+
+ FUSION_SEQUENCE<int, char, bool> v5(5, 'a', true);
+ BOOST_TEST(v1 != v5);
+ BOOST_TEST(!(v1 == v5));
+ BOOST_TEST(v5 != v1);
+ BOOST_TEST(!(v5 == v1));
+
+ BOOST_TEST(not_a_fusion_container() == v1);
+ BOOST_TEST(not_a_fusion_container() != v1);
+}
+
+void
+ordering_test()
+{
+ using namespace boost::fusion;
+
+ FUSION_SEQUENCE<int, float> v1(4, 3.3f);
+ FUSION_SEQUENCE<short, float> v2(5, 3.3f);
+ FUSION_SEQUENCE<long, double> v3(5, 4.4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+
+#if defined(FUSION_TEST_FAIL)
+ FUSION_SEQUENCE<int, char, bool> v5(5, 'a', true);
+ v1 >= v5;
+#endif
+
+ BOOST_TEST(not_a_fusion_container() > v1);
+ BOOST_TEST(not_a_fusion_container() >= v1);
+ BOOST_TEST(not_a_fusion_container() < v1);
+ BOOST_TEST(not_a_fusion_container() <= v1);
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/sequence/cons.cpp b/src/boost/libs/fusion/test/sequence/cons.cpp
new file mode 100644
index 000000000..88a04101c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/cons.cpp
@@ -0,0 +1,95 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2005 Eric Niebler
+
+ 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 <string>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/container/list/cons.hpp>
+#include <boost/fusion/container/generation/make_cons.hpp>
+#include <boost/fusion/container/generation/cons_tie.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/algorithm/transformation/filter_if.hpp>
+#include <boost/fusion/algorithm/transformation/push_front.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/lambda.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::is_same;
+ namespace fusion = boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing cons
+
+ {
+ std::string hello("hello");
+ cons<int, cons<std::string> > ns =
+ make_cons(1, make_cons(hello));
+
+ BOOST_TEST((*begin(ns) == 1));
+ BOOST_TEST((*fusion::next(begin(ns)) == hello));
+
+ *begin(ns) += 1;
+ *fusion::next(begin(ns)) += ' ';
+
+ BOOST_TEST((*begin(ns) == 2));
+ BOOST_TEST((*fusion::next(begin(ns)) == hello + ' '));
+
+ for_each(ns, boost::lambda::_1 += ' ');
+
+ BOOST_TEST((*begin(ns) == 2 + ' '));
+ BOOST_TEST((*fusion::next(begin(ns)) == hello + ' ' + ' '));
+ }
+
+ {
+ BOOST_TEST(
+ make_cons("hello") == make_vector(std::string("hello"))
+ );
+
+ BOOST_TEST(
+ make_cons(123, make_cons("hello")) ==
+ make_vector(123, std::string("hello"))
+ );
+ }
+
+ {
+ vector<int, float> t(1, 1.1f);
+ cons<int, cons<float> > nf =
+ make_cons(1, make_cons(1.1f));
+
+ BOOST_TEST((t == nf));
+ BOOST_TEST((vector<int>(1) == filter_if<is_same<boost::mpl::_, int> >(nf)));
+
+ std::cout << nf << std::endl;
+ std::cout << filter_if<is_same<boost::mpl::_, int> >(nf) << std::endl;
+ }
+
+ {
+ int i = 3;
+ cons<int&> tie(cons_tie(i));
+ BOOST_TEST((*begin(tie) == 3));
+ }
+
+ {
+ // This used to trigger a hard compilation error:
+ cons<cons<int> > xs;
+ begin(push_front(xs, 3));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/construction.hpp b/src/boost/libs/fusion/test/sequence/construction.hpp
new file mode 100644
index 000000000..94c7d1826
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/construction.hpp
@@ -0,0 +1,122 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/container/list/cons.hpp>
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+namespace test_detail
+{
+ // something to prevent warnings for unused variables
+ template<class T> void dummy(const T&) {}
+
+ // no public default constructor
+ class foo
+ {
+ public:
+
+ explicit foo(int v) : val(v) {}
+
+ bool operator==(const foo& other) const
+ {
+ return val == other.val;
+ }
+
+ private:
+
+ foo() {}
+ int val;
+ };
+
+ // another class without a public default constructor
+ class no_def_constructor
+ {
+ no_def_constructor() {}
+
+ public:
+
+ no_def_constructor(std::string) {}
+ };
+}
+
+inline void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ nil empty;
+ (void)empty;
+
+ FUSION_SEQUENCE<> empty0;
+ (void)empty0;
+
+#ifndef NO_CONSTRUCT_FROM_NIL
+ FUSION_SEQUENCE<> empty1(empty);
+ (void)empty1;
+#endif
+
+ FUSION_SEQUENCE<int> t1;
+ BOOST_TEST(FUSION_AT<0>(t1) == int());
+
+ FUSION_SEQUENCE<float> t2(5.5f);
+ BOOST_TEST(FUSION_AT<0>(t2) > 5.4f && FUSION_AT<0>(t2) < 5.6f);
+
+ FUSION_SEQUENCE<foo> t3(foo(12));
+ BOOST_TEST(FUSION_AT<0>(t3) == foo(12));
+
+ FUSION_SEQUENCE<double> t4(t2);
+ BOOST_TEST(FUSION_AT<0>(t4) > 5.4 && FUSION_AT<0>(t4) < 5.6);
+
+ FUSION_SEQUENCE<int, float> t5;
+ BOOST_TEST(FUSION_AT<0>(t5) == int());
+ BOOST_TEST(FUSION_AT<1>(t5) == float());
+
+ FUSION_SEQUENCE<int, float> t6(12, 5.5f);
+ BOOST_TEST(FUSION_AT<0>(t6) == 12);
+ BOOST_TEST(FUSION_AT<1>(t6) > 5.4f && FUSION_AT<1>(t6) < 5.6f);
+
+ FUSION_SEQUENCE<int, float> t7(t6);
+ BOOST_TEST(FUSION_AT<0>(t7) == 12);
+ BOOST_TEST(FUSION_AT<1>(t7) > 5.4f && FUSION_AT<1>(t7) < 5.6f);
+
+ FUSION_SEQUENCE<long, double> t8(t6);
+ BOOST_TEST(FUSION_AT<0>(t8) == 12);
+ BOOST_TEST(FUSION_AT<1>(t8) > 5.4f && FUSION_AT<1>(t8) < 5.6f);
+
+ dummy
+ (
+ FUSION_SEQUENCE<no_def_constructor, no_def_constructor, no_def_constructor>(
+ std::string("Jaba"), // ok, since the default
+ std::string("Daba"), // constructor is not used
+ std::string("Doo")
+ )
+ );
+
+ dummy(FUSION_SEQUENCE<int, double>());
+ dummy(FUSION_SEQUENCE<int, double>(1,3.14));
+
+#if defined(FUSION_TEST_FAIL)
+ dummy(FUSION_SEQUENCE<double&>()); // should fail, no defaults for references
+ dummy(FUSION_SEQUENCE<const double&>()); // likewise
+#endif
+
+ {
+ double dd = 5;
+ dummy(FUSION_SEQUENCE<double&>(dd)); // ok
+ dummy(FUSION_SEQUENCE<const double&>(dd+3.14)); // ok, but dangerous
+ }
+
+#if defined(FUSION_TEST_FAIL)
+ dummy(FUSION_SEQUENCE<double&>(dd+3.14)); // should fail,
+ // temporary to non-const reference
+#endif
+}
diff --git a/src/boost/libs/fusion/test/sequence/conversion.hpp b/src/boost/libs/fusion/test/sequence/conversion.hpp
new file mode 100644
index 000000000..f57207762
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/conversion.hpp
@@ -0,0 +1,322 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+
+ Use modification and distribution are subject to the Boost Software
+ License, Version 1.0. (See accompanyintg file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+==============================================================================*/
+
+#include <boost/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/boost_tuple.hpp>
+#include <boost/fusion/adapted/std_pair.hpp>
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) \
+ && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+# include <boost/fusion/adapted/std_tuple.hpp>
+#endif
+#include <boost/fusion/container/deque.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/tuple.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+#include "fixture.hpp"
+
+template <template <typename> class Scenario>
+void test()
+{
+ using namespace test_detail;
+
+ // Note the trunction conversion tests from each containter
+ // ... bug or feature?
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(FUSION_SEQUENCE<int>(300), 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::push_back(FUSION_SEQUENCE<int>(200), 400)
+ , FUSION_SEQUENCE<convertible>(200)
+ )
+ ));
+
+ BOOST_TEST((run<Scenario<FUSION_SEQUENCE<> > >(boost::fusion::vector<>())));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ boost::fusion::vector<int>(100), boost::fusion::vector<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::vector<int>(110)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::vector<int, int>(200, 100)
+ , boost::fusion::vector<convertible>(200)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::vector<int, int>(200, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::vector<int, int, int>(500, 400, 100)
+ , boost::fusion::vector<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::vector<int>(500), 400
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::vector<int, int>(500, 400), 100
+ )
+ , boost::fusion::vector<convertible, int>(500, 400)
+ )
+ ));
+
+ BOOST_TEST((run<Scenario< FUSION_SEQUENCE<> > >(boost::fusion::deque<>())));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ boost::fusion::deque<int>(100), boost::fusion::deque<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::deque<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::deque<int, int>(500, 100)
+ , boost::fusion::deque<convertible>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::deque<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::deque<int, int, int>(500, 400, 100)
+ , boost::fusion::deque<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::deque<int>(500), 400
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::deque<int, int>(500, 400), 100
+ )
+ , boost::fusion::deque<convertible, int>(500, 400)
+ )
+ ));
+
+ BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(boost::fusion::list<>())));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ boost::fusion::list<int>(100), boost::fusion::list<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::list<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::list<int, int>(500, 100)
+ , boost::fusion::list<convertible>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::list<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::list<int, int, int>(500, 400, 100)
+ , boost::fusion::list<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::list<int>(500), 400
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::list<int, int>(500, 400), 100
+ )
+ , boost::fusion::list<convertible, int>(500, 400)
+ )
+ ));
+
+ BOOST_TEST((run<Scenario< FUSION_SEQUENCE<> > >(boost::fusion::tuple<>())));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ boost::fusion::tuple<int>(100), boost::fusion::tuple<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::tuple<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::fusion::tuple<int, int>(500, 100)
+ , boost::fusion::tuple<convertible>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::tuple<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::tuple<int, int, int>(500, 400, 100)
+ , boost::fusion::tuple<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::tuple<int>(500), 400
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::fusion::tuple<int, int>(500, 400), 100
+ )
+ , boost::fusion::tuple<convertible, int>(500, 400)
+ )
+ ));
+
+ BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(boost::tuple<>())));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ boost::tuple<int>(100), boost::tuple<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::tuple<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ boost::tuple<int, int>(500, 100)
+ , boost::tuple<convertible>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::tuple<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::tuple<int, int, int>(500, 400, 100)
+ , boost::tuple<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(boost::tuple<int>(500), 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ boost::tuple<int, int>(500, 400), 100
+ )
+ , boost::tuple<convertible, int>(500, 400)
+ )
+ ));
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) \
+ && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(std::tuple<>())));
+ BOOST_TEST((
+ run<Scenario<FUSION_SEQUENCE<> > >(std::tuple<int>(100), std::tuple<>())
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ std::tuple<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ std::tuple<int, int>(500, 100)
+ , std::tuple<convertible>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ std::tuple<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ std::tuple<int, int, int>(500, 400, 100)
+ , std::tuple<convertible, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(std::tuple<int>(500), 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ boost::fusion::push_back(
+ std::tuple<int, int>(500, 400), 100
+ )
+ , std::tuple<convertible, int>(500, 400)
+ )
+ ));
+#endif
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ std::pair<int, int>(500, 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<> > >(
+ std::pair<int, int>(500, 400)
+ , boost::fusion::vector<>()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ std::pair<int, int>(500, 400)
+ , boost::fusion::vector<convertible>(500)
+ )
+ ));
+}
diff --git a/src/boost/libs/fusion/test/sequence/convert.hpp b/src/boost/libs/fusion/test/sequence/convert.hpp
new file mode 100644
index 000000000..233fabfb3
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert.hpp
@@ -0,0 +1,51 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <string>
+#include <boost/config.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/fusion/include/convert.hpp>
+#include <boost/fusion/include/at.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/deque.hpp>
+#include <boost/fusion/include/list.hpp>
+#include <boost/fusion/include/boost_tuple.hpp>
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include <boost/fusion/include/std_tuple.hpp>
+#endif
+
+template <typename Tag>
+void test(FUSION_SEQUENCE<int, std::string> const& seq)
+{
+ typedef typename
+ boost::fusion::result_of::convert<
+ Tag
+ , FUSION_SEQUENCE<int, std::string>
+ >::type
+ type;
+
+ type v = boost::fusion::convert<Tag>(seq);
+ BOOST_TEST((boost::fusion::at_c<0>(v) == 123));
+ BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!"));
+}
+
+int main()
+{
+ FUSION_SEQUENCE<int, std::string> seq(123, "Hola!!!");
+ test<boost::fusion::vector_tag>(seq);
+ test<boost::fusion::deque_tag>(seq);
+ test<boost::fusion::cons_tag>(seq);
+ test<boost::fusion::boost_tuple_tag>(seq);
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ test<boost::fusion::std_tuple_tag>(seq);
+#endif
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/convert_boost_tuple.cpp b/src/boost/libs/fusion/test/sequence/convert_boost_tuple.cpp
new file mode 100644
index 000000000..588ee4d7f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_boost_tuple.cpp
@@ -0,0 +1,14 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <boost/tuple/tuple.hpp>
+#include <boost/fusion/include/boost_tuple.hpp>
+
+#define FUSION_SEQUENCE boost::tuples::tuple
+#include "convert.hpp"
+
diff --git a/src/boost/libs/fusion/test/sequence/convert_deque.cpp b/src/boost/libs/fusion/test/sequence/convert_deque.cpp
new file mode 100644
index 000000000..5be34d3f6
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_deque.cpp
@@ -0,0 +1,13 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/deque.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::deque
+#include "convert.hpp"
+
diff --git a/src/boost/libs/fusion/test/sequence/convert_list.cpp b/src/boost/libs/fusion/test/sequence/convert_list.cpp
new file mode 100644
index 000000000..57ad05078
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_list.cpp
@@ -0,0 +1,13 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/list.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::list
+#include "convert.hpp"
+
diff --git a/src/boost/libs/fusion/test/sequence/convert_std_pair.cpp b/src/boost/libs/fusion/test/sequence/convert_std_pair.cpp
new file mode 100644
index 000000000..aa350025a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_std_pair.cpp
@@ -0,0 +1,14 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <utility>
+#include <boost/fusion/include/std_pair.hpp>
+
+#define FUSION_SEQUENCE std::pair
+#include "convert.hpp"
+
diff --git a/src/boost/libs/fusion/test/sequence/convert_std_tuple.cpp b/src/boost/libs/fusion/test/sequence/convert_std_tuple.cpp
new file mode 100644
index 000000000..643f01cfe
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_std_tuple.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_NO_CXX11_HDR_TUPLE) || \
+ defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+# error "does not meet requirements"
+#endif
+
+#include <tuple>
+#include <boost/fusion/include/std_tuple.hpp>
+
+#define FUSION_SEQUENCE std::tuple
+#include "convert.hpp"
diff --git a/src/boost/libs/fusion/test/sequence/convert_vector.cpp b/src/boost/libs/fusion/test/sequence/convert_vector.cpp
new file mode 100644
index 000000000..b39014df2
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/convert_vector.cpp
@@ -0,0 +1,13 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::vector
+#include "convert.hpp"
+
diff --git a/src/boost/libs/fusion/test/sequence/copy.hpp b/src/boost/libs/fusion/test/sequence/copy.hpp
new file mode 100644
index 000000000..566384cd6
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/copy.hpp
@@ -0,0 +1,154 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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 <string>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/static_assert.hpp>
+
+#include "fixture.hpp"
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+#if !defined(FUSION_MAKE)
+#define FUSION_MAKE BOOST_PP_CAT(make_, FUSION_SEQUENCE)
+#endif
+
+#if !defined(FUSION_TIE)
+#define FUSION_TIE BOOST_PP_CAT(FUSION_SEQUENCE, _tie)
+#endif
+
+namespace test_detail
+{
+ // classes with different kinds of conversions
+ class AA {};
+ class BB : public AA {};
+ struct CC { CC() {} CC(const BB&) {} };
+ struct DD { operator CC() const { return CC(); }; };
+}
+
+void test_mpl()
+{
+ using namespace boost::fusion;
+
+ typedef FUSION_SEQUENCE<int, char> seq;
+
+ typedef
+ boost::mpl::insert_range<
+ boost::mpl::vector<>
+ , boost::mpl::end< boost::mpl::vector<> >::type
+ , seq
+ >::type
+ sequence;
+
+ typedef boost::mpl::equal<sequence, boost::mpl::vector<int, char> > equal;
+ BOOST_STATIC_ASSERT(equal::value);
+}
+
+template <template <typename> class Scenario>
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ FUSION_SEQUENCE<int, char> t1(4, 'a');
+ FUSION_SEQUENCE<int, char> t2(5, 'b');
+ t2 = t1;
+ BOOST_TEST(FUSION_AT<0>(t1) == FUSION_AT<0>(t2));
+ BOOST_TEST(FUSION_AT<1>(t1) == FUSION_AT<1>(t2));
+
+ FUSION_SEQUENCE<long, std::string> t3(2, "a");
+ t3 = t1;
+ BOOST_TEST((double)FUSION_AT<0>(t1) == FUSION_AT<0>(t3));
+ BOOST_TEST(FUSION_AT<1>(t1) == FUSION_AT<1>(t3)[0]);
+
+ BOOST_TEST(FUSION_AT<0>(t1) == 4);
+ BOOST_TEST(FUSION_AT<1>(t1) == 'a');
+
+ // testing copy and assignment with implicit conversions
+ // between elements testing tie
+
+ FUSION_SEQUENCE<char, BB*, BB, DD> t;
+ FUSION_SEQUENCE<int, AA*, CC, CC> a(t);
+ a = t;
+
+ int i; char c; double d;
+ FUSION_TIE(i, c, d) = FUSION_MAKE(1, 'a', 5.5);
+
+ BOOST_TEST(i==1);
+ BOOST_TEST(c=='a');
+ BOOST_TEST(d>5.4 && d<5.6);
+
+ test_mpl();
+
+
+ BOOST_TEST((run< Scenario< FUSION_SEQUENCE<> > >(FUSION_SEQUENCE<>())));
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int> > >(FUSION_SEQUENCE<int>(500))
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ FUSION_SEQUENCE<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int> > >(
+ FUSION_SEQUENCE<int, int>(500, 100)
+ , FUSION_SEQUENCE<int>(500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible> > >(
+ FUSION_SEQUENCE<int, int>(500, 100)
+ , FUSION_SEQUENCE<convertible>(500)
+ )
+ ));
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, int> > >(
+ FUSION_SEQUENCE<int, int>(500, 600)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, int> > >(
+ FUSION_SEQUENCE<convertible, int>(100, 500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, convertible> > >(
+ FUSION_SEQUENCE<int, convertible>(500, 600)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, convertible> > >(
+ FUSION_SEQUENCE<int, int>(400, 500)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, int> > >(
+ FUSION_SEQUENCE<int, int, int>(500, 100, 323)
+ , FUSION_SEQUENCE<int, int>(500, 100)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<convertible, convertible> > >(
+ FUSION_SEQUENCE<int, int, int>(500, 600, 100)
+ , FUSION_SEQUENCE<convertible, convertible>(500, 600)
+ )
+ ));
+}
diff --git a/src/boost/libs/fusion/test/sequence/deduce_sequence.cpp b/src/boost/libs/fusion/test/sequence/deduce_sequence.cpp
new file mode 100644
index 000000000..a1569f46f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deduce_sequence.cpp
@@ -0,0 +1,91 @@
+/*=============================================================================
+ Copyright (c) 2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/config.hpp>
+#include <boost/fusion/support/deduce_sequence.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/mpl/equal.hpp>
+
+#include <boost/ref.hpp>
+#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
+#include <functional>
+#endif
+
+using boost::is_same;
+using boost::reference_wrapper;
+using boost::fusion::traits::deduce;
+using boost::fusion::traits::deduce_sequence;
+
+namespace fusion = boost::fusion;
+
+template <class Args>
+struct test_seq_ctor
+{
+ typename deduce_sequence<Args>::type fsq_args;
+
+ test_seq_ctor(Args const & args)
+ : fsq_args(args)
+ { }
+};
+
+#define TEST_SAME_TYPE(a,b) BOOST_TEST(( is_same< a, b >::value ))
+#define TEST_SAME_ELEMENTS(a,b) BOOST_TEST(( boost::mpl::equal< a, b >::type::value ))
+
+typedef fusion::vector<int, int const, int &, int const &> args1;
+typedef fusion::vector<int, int, int &, int> storable1;
+template struct test_seq_ctor<args1>;
+
+typedef fusion::vector< reference_wrapper<int> &, reference_wrapper<int const> &,
+ reference_wrapper<int> const &, reference_wrapper<int const> const & > args2;
+typedef fusion::vector<int &, int const &, int &, int const &> storable2;
+template struct test_seq_ctor<args2>;
+
+
+typedef fusion::vector<int *, int const *, int const * const, int const * &, int const * const &> args3;
+typedef fusion::vector<int *, int const *, int const *, int const * &, int const * > storable3;
+template struct test_seq_ctor<args3>;
+
+typedef fusion::vector<int(&)[2], int const(&)[2]> args4;
+typedef args4 storable4;
+template struct test_seq_ctor<args4>;
+
+int main()
+{
+ TEST_SAME_TYPE(deduce<int &>::type, int &);
+ TEST_SAME_TYPE(deduce<int volatile &>::type, int volatile &);
+
+ TEST_SAME_TYPE(deduce<int>::type, int);
+ TEST_SAME_TYPE(deduce<int const &>::type, int);
+ TEST_SAME_TYPE(deduce<int const volatile &>::type, int);
+
+ TEST_SAME_TYPE(deduce< reference_wrapper<int> & >::type, int &);
+ TEST_SAME_TYPE(deduce< reference_wrapper<int const> & >::type, int const &);
+ TEST_SAME_TYPE(deduce< reference_wrapper<int> const & >::type, int &);
+ TEST_SAME_TYPE(deduce< reference_wrapper<int const> const & >::type, int const &);
+
+#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL
+ TEST_SAME_TYPE(deduce< std::reference_wrapper<int> & >::type, int &);
+ TEST_SAME_TYPE(deduce< std::reference_wrapper<int const> & >::type, int const &);
+ TEST_SAME_TYPE(deduce< std::reference_wrapper<int> const & >::type, int &);
+ TEST_SAME_TYPE(deduce< std::reference_wrapper<int const> const & >::type, int const &);
+#endif
+
+ TEST_SAME_TYPE(deduce< int(&)[2] >::type, int(&)[2]);
+ TEST_SAME_TYPE(deduce< int const (&)[2] >::type, int const (&)[2]);
+ TEST_SAME_TYPE(deduce< int volatile (&)[2] >::type, int volatile (&)[2]);
+ TEST_SAME_TYPE(deduce< int const volatile (&)[2] >::type, int const volatile (&)[2]);
+
+ TEST_SAME_ELEMENTS(deduce_sequence<args1>::type,storable1);
+ TEST_SAME_ELEMENTS(deduce_sequence<args2>::type,storable2);
+ TEST_SAME_ELEMENTS(deduce_sequence<args3>::type,storable3);
+ TEST_SAME_ELEMENTS(deduce_sequence<args4>::type,storable4);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_struct.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_struct.cpp
new file mode 100644
index 000000000..231621f89
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_struct.cpp
@@ -0,0 +1,117 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <boost/preprocessor/empty.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+}
+
+BOOST_FUSION_DEFINE_ASSOC_STRUCT(
+ (ns),
+ point,
+ (int, x, ns::x_member)
+ (int, y, ns::y_member)
+)
+
+BOOST_FUSION_DEFINE_ASSOC_STRUCT(BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point>::value);
+ ns::point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ ns::point v2(5, 3);
+ vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
+
+ ns::point p(5, 3);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ }
+
+ {
+ ns::point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_struct_empty.cpp
new file mode 100644
index 000000000..91dd2f350
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_struct_empty.cpp
@@ -0,0 +1,78 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_ASSOC_STRUCT(BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct>::value);
+ empty_struct e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct>::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct>::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct>::type b;
+ typedef fusion::result_of::end<empty_struct>::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct, int>));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_struct_move.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_struct_move.cpp
new file mode 100644
index 000000000..07def389f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_struct_move.cpp
@@ -0,0 +1,67 @@
+/*=============================================================================
+ Copyright (c) 2016,2018 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <utility>
+
+struct key_type;
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+BOOST_FUSION_DEFINE_ASSOC_STRUCT((ns), value, (wrapper, w, key_type))
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value x;
+ ns::value y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ {
+ ns::value x;
+ ns::value y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct.cpp
new file mode 100644
index 000000000..bdbcfe470
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct.cpp
@@ -0,0 +1,121 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct x_member;
+ struct y_member;
+ struct z_member;
+}
+
+BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT(
+ (X)(Y),
+ (ns),
+ point,
+ (int, x, ns::x_member)
+ (int, y, ns::y_member)
+)
+
+BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT((M), BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int,int> point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ point v2(5, 3);
+ vector<long, double> v3(5, 4.0);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ {
+ // assoc stuff
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
+ BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
+
+ point p(5, 3);
+
+ BOOST_TEST(at_key<ns::x_member>(p) == 5);
+ BOOST_TEST(at_key<ns::y_member>(p) == 3);
+ }
+
+ {
+ point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_empty.cpp
new file mode 100644
index 000000000..70d6ca500
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_empty.cpp
@@ -0,0 +1,78 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT((M), BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct<void> >::value);
+ empty_struct<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct<void> >::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct<void> e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct<void> e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct<void> >::type b;
+ typedef fusion::result_of::end<empty_struct<void> >::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, void>));
+ BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, int>));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_move.cpp b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_move.cpp
new file mode 100644
index 000000000..dcffa5663
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_assoc_tpl_struct_move.cpp
@@ -0,0 +1,78 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/config.hpp>
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
+#include <utility>
+
+struct key_type;
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT((W), (ns), value, (W, w, key_type))
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+
+ return boost::report_errors();
+}
+
+#else
+
+int main()
+{
+}
+
+#endif
diff --git a/src/boost/libs/fusion/test/sequence/define_struct.cpp b/src/boost/libs/fusion/test/sequence/define_struct.cpp
new file mode 100644
index 000000000..1243b9fe1
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct.cpp
@@ -0,0 +1,130 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <boost/preprocessor/empty.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+BOOST_FUSION_DEFINE_STRUCT(
+ (ns),
+ point,
+ (int, x)
+ (int, y)
+)
+
+// Tutorial (compile test only)
+BOOST_FUSION_DEFINE_STRUCT(
+ (demo), employee,
+ (std::string, name)
+ (int, age)
+)
+
+BOOST_FUSION_DEFINE_STRUCT(BOOST_PP_EMPTY(), s, (int, m))
+
+BOOST_FUSION_DEFINE_STRUCT(BOOST_PP_EMPTY(), empty_struct, )
+
+// Testing non-constexpr compatible types
+BOOST_FUSION_DEFINE_STRUCT(
+ (ns),
+ employee,
+ (std::string, name)
+ (std::string, nickname)
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<ns::point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<ns::point>::value);
+ ns::point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ ns::point v2(5, 3);
+ vector<long, double> v3(5, 4.0);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from ns::point to vector
+ ns::point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+
+ typedef boost::fusion::result_of::begin<s>::type b;
+ typedef boost::fusion::result_of::end<s>::type e;
+ // this fails
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+ {
+ ns::point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+
+ {
+ ns::employee emp = make_list("John Doe", "jdoe");
+ std::cout << at_c<0>(emp) << std::endl;
+ std::cout << at_c<1>(emp) << std::endl;
+
+ BOOST_TEST(emp == make_vector("John Doe", "jdoe"));
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/define_struct_empty.cpp
new file mode 100644
index 000000000..1468b9174
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct_empty.cpp
@@ -0,0 +1,76 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_STRUCT(BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct>::value);
+ empty_struct e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct>::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct>::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct>::type b;
+ typedef fusion::result_of::end<empty_struct>::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct>));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_struct_inline.cpp b/src/boost/libs/fusion/test/sequence/define_struct_inline.cpp
new file mode 100644
index 000000000..4a3793b7e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct_inline.cpp
@@ -0,0 +1,153 @@
+/*=============================================================================
+ Copyright (c) 2010, 2012 Christopher Schmidt, Nathan Ridge
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <boost/preprocessor/empty.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+struct cls
+{
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(
+ point,
+ (int, x)
+ (int, y)
+ )
+};
+
+template <typename = int>
+struct tpl_cls
+{
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(
+ point,
+ (int, x)
+ (int, y)
+ )
+};
+
+namespace ns
+{
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(s, (int, m))
+
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(empty_struct, )
+
+ // Testing non-constexpr compatible types
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(
+ employee,
+ (std::string, name)
+ (std::string, nickname)
+ )
+}
+
+template <typename Point>
+void run_test()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::empty_struct>::value == 0);
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<ns::empty_struct>::value);
+ }
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<Point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<Point>::value);
+ Point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<Point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.0f);
+ Point v2(5, 3);
+ vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from Point to vector
+ Point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from Point to list
+ Point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+
+ typedef boost::fusion::result_of::begin<ns::s>::type b;
+ typedef boost::fusion::result_of::end<ns::s>::type e;
+ // this fails
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+ {
+ Point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+}
+
+int
+main()
+{
+ run_test<cls::point>(); // test with non-template enclosing class
+ run_test<tpl_cls<>::point>(); // test with template enclosing class
+
+ {
+ using namespace boost::fusion;
+
+ ns::employee emp = make_list("John Doe", "jdoe");
+ std::cout << at_c<0>(emp) << std::endl;
+ std::cout << at_c<1>(emp) << std::endl;
+
+ BOOST_TEST(emp == make_vector("John Doe", "jdoe"));
+ }
+
+ return boost::report_errors();
+
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_struct_inline_empty.cpp b/src/boost/libs/fusion/test/sequence/define_struct_inline_empty.cpp
new file mode 100644
index 000000000..4168770a9
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct_inline_empty.cpp
@@ -0,0 +1,76 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_STRUCT_INLINE(empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct>));
+ BOOST_STATIC_ASSERT(!traits::is_view<empty_struct>::value);
+ empty_struct e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct>::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct>::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct>::type b;
+ typedef fusion::result_of::end<empty_struct>::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct>));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_struct_inline_move.cpp b/src/boost/libs/fusion/test/sequence/define_struct_inline_move.cpp
new file mode 100644
index 000000000..3c7074042
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct_inline_move.cpp
@@ -0,0 +1,73 @@
+/*=============================================================================
+ Copyright (c) 2016-2018 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <utility>
+
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+
+namespace ns
+{
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(value, (wrapper, w))
+}
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value x;
+ ns::value y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ // Older MSVCs and gcc 4.4 don't generate move ctor by default.
+#if !(defined(CI_SKIP_KNOWN_FAILURE) && (BOOST_WORKAROUND(BOOST_MSVC, < 1900) || BOOST_WORKAROUND(BOOST_GCC, / 100 == 404)))
+ {
+ ns::value x;
+ ns::value y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+#endif // !(ci && (msvc < 14.0 || gcc 4.4.x))
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_struct_move.cpp b/src/boost/libs/fusion/test/sequence/define_struct_move.cpp
new file mode 100644
index 000000000..8732b59b1
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_struct_move.cpp
@@ -0,0 +1,66 @@
+/*=============================================================================
+ Copyright (c) 2016,2018 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <utility>
+
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+BOOST_FUSION_DEFINE_STRUCT((ns), value, (wrapper, w))
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value x;
+ ns::value y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ {
+ ns::value x;
+ ns::value y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct.cpp
new file mode 100644
index 000000000..b47ac6110
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct.cpp
@@ -0,0 +1,112 @@
+/*=============================================================================
+ Copyright (c) 2010 Christopher Schmidt
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <boost/preprocessor/empty.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+BOOST_FUSION_DEFINE_TPL_STRUCT(
+ (X)(Y),
+ (ns),
+ point,
+ (X, x)
+ (Y, y)
+)
+
+BOOST_FUSION_DEFINE_TPL_STRUCT((M), BOOST_PP_EMPTY(), s, (M, m))
+
+BOOST_FUSION_DEFINE_TPL_STRUCT((M), BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ typedef ns::point<int, int> point;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<point>::value);
+ point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ point v2(5, 3);
+ vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from point to vector
+ point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from point to list
+ point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+
+ typedef boost::fusion::result_of::begin<s<int> >::type b;
+ typedef boost::fusion::result_of::end<s<int> >::type e;
+ // this fails
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+
+ {
+ point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct_empty.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct_empty.cpp
new file mode 100644
index 000000000..d8cf47dec
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct_empty.cpp
@@ -0,0 +1,75 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_TPL_STRUCT((M), BOOST_PP_EMPTY(), empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
+ empty_struct<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct<void> >::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct<void> e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct<void> e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct<void> >::type b;
+ typedef fusion::result_of::end<empty_struct<void> >::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline.cpp
new file mode 100644
index 000000000..3a7c69e3e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline.cpp
@@ -0,0 +1,138 @@
+/*=============================================================================
+ Copyright (c) 2010, 2012 Christopher Schmidt, nathan Ridge
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/support.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <boost/preprocessor/empty.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+struct cls
+{
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(
+ (X)(Y),
+ point,
+ (X, x)
+ (Y, y)
+ )
+};
+
+template <typename = int>
+struct tpl_cls
+{
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(
+ (X)(Y),
+ point,
+ (X, x)
+ (Y, y)
+ )
+};
+
+namespace ns
+{
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), s, (M, m))
+
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, )
+}
+
+template <typename Point>
+void run_test()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::empty_struct<int> >::value == 0);
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<ns::empty_struct<int> >::value);
+ }
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<Point>));
+ BOOST_STATIC_ASSERT(!traits::is_view<Point>::value);
+ Point p(123, 456);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Point>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<Point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2.f);
+ Point v2(5, 3);
+ vector<long, double> v3(5, 4.);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from Point to vector
+ Point p(5, 3);
+ vector<int, long> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from Point to list
+ Point p(5, 3);
+ list<int, long> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+
+ typedef boost::fusion::result_of::begin<ns::s<int> >::type b;
+ typedef boost::fusion::result_of::end<ns::s<int> >::type e;
+ // this fails
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
+ }
+
+
+ {
+ Point p = make_list(5,3);
+ BOOST_TEST(p == make_vector(5,3));
+
+ p = make_list(3,5);
+ BOOST_TEST(p == make_vector(3,5));
+ }
+}
+
+int
+main()
+{
+ run_test<cls::point<int, int> >(); // test non-template enclosing class
+ run_test<tpl_cls<>::point<int, int> >(); // test template enclosing class
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_empty.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_empty.cpp
new file mode 100644
index 000000000..5cc0163fe
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_empty.cpp
@@ -0,0 +1,75 @@
+/*=============================================================================
+ Copyright (c) 2016 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container.hpp>
+#include <boost/fusion/sequence.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, )
+
+int
+main()
+{
+ using namespace boost;
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
+ empty_struct<void> e;
+
+ std::cout << e << std::endl;
+ BOOST_TEST(e == make_vector());
+
+ BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
+ BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct<void> >::value);
+ }
+
+ {
+ vector<> v;
+ empty_struct<void> e;
+ BOOST_TEST(v == e);
+ BOOST_TEST_NOT(v != e);
+ BOOST_TEST_NOT(v < e);
+ BOOST_TEST(v <= e);
+ BOOST_TEST_NOT(v > e);
+ BOOST_TEST(v >= e);
+ }
+
+ {
+ empty_struct<void> e;
+
+ // conversion from empty_struct to vector
+ vector<> v(e);
+ v = e;
+
+ // conversion from empty_struct to list
+ //list<> l(e);
+ //l = e;
+ }
+
+ { // begin/end
+ typedef fusion::result_of::begin<empty_struct<void> >::type b;
+ typedef fusion::result_of::end<empty_struct<void> >::type e;
+
+ BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
+ }
+
+ BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_move.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_move.cpp
new file mode 100644
index 000000000..39a00079a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_move.cpp
@@ -0,0 +1,73 @@
+/*=============================================================================
+ Copyright (c) 2016-2018 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+#include <utility>
+
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+
+namespace ns
+{
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((W), value, (W, w))
+}
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ // Older MSVCs and gcc 4.4 don't generate move ctor by default.
+#if !(defined(CI_SKIP_KNOWN_FAILURE) && (BOOST_WORKAROUND(BOOST_MSVC, < 1900) || BOOST_WORKAROUND(BOOST_GCC, / 100 == 404)))
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+#endif // !(ci && (msvc < 14.0 || gcc 4.4.x))
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/define_tpl_struct_move.cpp b/src/boost/libs/fusion/test/sequence/define_tpl_struct_move.cpp
new file mode 100644
index 000000000..c4dd9ab63
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/define_tpl_struct_move.cpp
@@ -0,0 +1,66 @@
+/*=============================================================================
+ Copyright (c) 2016,2018 Kohei Takahashi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/define_struct.hpp>
+#include <utility>
+
+struct wrapper
+{
+ int value;
+
+ wrapper() : value(42) {}
+ wrapper(wrapper&& other) : value(other.value) { other.value = 0; }
+ wrapper(wrapper const& other) : value(other.value) {}
+
+ wrapper& operator=(wrapper&& other) { value = other.value; other.value = 0; return *this; }
+ wrapper& operator=(wrapper const& other) { value = other.value; return *this; }
+};
+BOOST_FUSION_DEFINE_TPL_STRUCT((W), (ns), value, (W, w))
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(x); // copy
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 43);
+
+ y = x; // copy assign
+
+ BOOST_TEST(x.w.value == 42);
+ BOOST_TEST(y.w.value == 42);
+ }
+
+ {
+ ns::value<wrapper> x;
+ ns::value<wrapper> y(std::move(x)); // move
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 42);
+
+ ++y.w.value;
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 43);
+
+ y = std::move(x); // move assign
+
+ BOOST_TEST(x.w.value == 0);
+ BOOST_TEST(y.w.value == 0);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_comparison.cpp b/src/boost/libs/fusion/test/sequence/deque_comparison.cpp
new file mode 100644
index 000000000..9bbf4fd95
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_comparison.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "comparison.hpp"
+
+int
+main()
+{
+ equality_test();
+ ordering_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_construction.cpp b/src/boost/libs/fusion/test/sequence/deque_construction.cpp
new file mode 100644
index 000000000..4fc8c8830
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_construction.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "construction.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_copy.cpp b/src/boost/libs/fusion/test/sequence/deque_copy.cpp
new file mode 100644
index 000000000..5c48d5ecc
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_copy.cpp
@@ -0,0 +1,42 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/generation/make_deque.hpp>
+#include <boost/fusion/container/generation/deque_tie.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "copy.hpp"
+
+using namespace test_detail;
+
+// c++11 deque has bug, cannot properly copy-assign from a const value
+template <typename T>
+struct skip_const_lvalue_assignment
+{
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return
+ run< can_implicit_construct<T> >(source, expected) &&
+ run< can_construct<T> >(source, expected) &&
+ run< can_rvalue_assign<T> >(source, expected) &&
+ run< can_lvalue_assign<T> >(source, expected);
+ }
+};
+
+int
+main()
+{
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+ test<skip_const_lvalue_assignment>();
+#else
+ test<can_copy>();
+#endif
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_hash.cpp b/src/boost/libs/fusion/test/sequence/deque_hash.cpp
new file mode 100644
index 000000000..01b36660a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_hash.cpp
@@ -0,0 +1,16 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "hash.hpp"
+
+int main()
+{
+ hash_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_is_constructible.cpp b/src/boost/libs/fusion/test/sequence/deque_is_constructible.cpp
new file mode 100644
index 000000000..e08b4787e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_is_constructible.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 2015 Louis Dionne
+
+ 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/config.hpp>
+
+#ifndef BOOST_NO_CXX11_HDR_TYPE_TRAITS
+#include <type_traits>
+#include <boost/fusion/include/deque.hpp>
+
+
+struct Dummy { };
+
+// Make sure deque's constructor is SFINAE-friendly.
+static_assert(!std::is_constructible<boost::fusion::deque<int>, Dummy const&>::value, "");
+
+#endif
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_iterator.cpp b/src/boost/libs/fusion/test/sequence/deque_iterator.cpp
new file mode 100644
index 000000000..10ce27f8b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_iterator.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#define FUSION_TRAVERSAL_TAG bidirectional_traversal_tag
+#include "./iterator.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_make.cpp b/src/boost/libs/fusion/test/sequence/deque_make.cpp
new file mode 100644
index 000000000..fe5705335
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_make.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/generation/make_deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/deque_misc.cpp b/src/boost/libs/fusion/test/sequence/deque_misc.cpp
new file mode 100644
index 000000000..402afaccc
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_misc.cpp
@@ -0,0 +1,24 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/deque/convert.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+
+#define BOOST_FUSION_SEQUENCE_CONVERSION_IS_NOT_SEQUENCE__TYPE_PRESERVING
+
+#define FUSION_SEQUENCE deque
+#include "misc.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_move.cpp b/src/boost/libs/fusion/test/sequence/deque_move.cpp
new file mode 100644
index 000000000..b3bdf11b7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_move.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2012 Joel de Guzman
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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)
+==============================================================================*/
+#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+#include <boost/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::deque<std::vector<x>>
+#define FUSION_SEQUENCE2 boost::fusion::deque<std::vector<x>, x>
+
+#include "move.hpp"
+
+int main()
+{
+ test();
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_mutate.cpp b/src/boost/libs/fusion/test/sequence/deque_mutate.cpp
new file mode 100644
index 000000000..1564ade9a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_mutate.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 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)
+==============================================================================*/
+#include <boost/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "mutate.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_nest.cpp b/src/boost/libs/fusion/test/sequence/deque_nest.cpp
new file mode 100644
index 000000000..fd69d151f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_nest.cpp
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (C) 2015 Kohei Takahshi
+
+ 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/fusion/container/deque/deque.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::deque
+#include "nest.hpp"
+
+/* deque has a few issues:
+ - sequence conversion constructor is explicit
+ - assignment sequence conversion has bug in base class
+ - c++11 direct assignment from lvalue has bug */
+template <typename T>
+struct skip_issues
+{
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ using namespace test_detail;
+ return
+#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
+ run< can_construct<T> >(source, expected) &&
+ run< can_implicit_construct<T> >(source, expected) &&
+ run< can_rvalue_assign<T> >(source, expected) &&
+ run< can_convert_using<can_construct>::to<T> >(source, expected) &&
+#else
+ run< can_copy<T> >(source, expected) &&
+#endif
+ run< can_construct_from_elements<T> >(source, expected);
+ }
+};
+
+int
+main()
+{
+ test<skip_issues>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_tie.cpp b/src/boost/libs/fusion/test/sequence/deque_tie.cpp
new file mode 100644
index 000000000..f6ee91600
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_tie.cpp
@@ -0,0 +1,23 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/generation/deque_tie.hpp>
+#include <boost/fusion/container/generation/ignore.hpp>
+#include <boost/fusion/container/generation/make_deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "tie.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/deque_value_at.cpp b/src/boost/libs/fusion/test/sequence/deque_value_at.cpp
new file mode 100644
index 000000000..5b31504fb
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/deque_value_at.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#include "value_at.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/filter_view.cpp b/src/boost/libs/fusion/test/sequence/filter_view.cpp
new file mode 100644
index 000000000..8ebe14767
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/filter_view.cpp
@@ -0,0 +1,129 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/container/vector/vector_iterator.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/view/filter_view/filter_view.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/iterator/value_of_data.hpp>
+#include <boost/fusion/iterator/deref_data.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/arg.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+
+struct X
+{
+ operator char const*() const
+ {
+ return "<X-object>";
+ }
+};
+
+struct Y
+{
+ operator char const*() const
+ {
+ return "<Y-object>";
+ }
+};
+
+struct reject_all
+{
+ template<typename T>
+ struct apply : boost::mpl::false_
+ {};
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ using boost::mpl::int_;
+ using boost::mpl::_;
+ using boost::mpl::not_;
+ using boost::mpl::less;
+ using boost::mpl::vector_c;
+ using boost::is_class;
+ using boost::is_same;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ typedef vector<Y, char, long, X, bool, double> vector_type;
+
+ X x; Y y;
+ vector_type v(y, '@', 987654, x, true, 6.6);
+ typedef filter_view<vector_type const, not_<is_class<_> > > filter_view_type;
+ filter_view_type view(v);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector('@', 987654, true, 6.6)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
+ }
+
+ //cschmidt: This is illegal C++. ADL instantiates less<_, int_<3> > - which
+ //leads to compile errors.
+ /*{
+ // $$$ JDG $$$ For some obscure reason, EDG based compilers
+ // (e.g. comeau 4.3.3, intel) have problems with this.
+ // vc7.1 and g++ are ok. The errors from comeau are useless.
+
+#ifndef __EDG_VERSION__
+ typedef vector_c<int, 5, 1, 2, 3, 6, 0, -1> vector_type;
+ typedef filter_view<vector_type const, less<_, int_<3> > > filter_view_type;
+ vector_type v;
+ filter_view_type view(v);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(1, 2, 0, -1)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
+#endif
+ }*/
+
+ {
+ // Previous filtering out all values caused problems as begin<seq> was not equal to end<seq>
+ // Picked up by Andreas Pokorny
+ typedef vector<int> vec;
+ typedef filter_view<vec, reject_all> filter_view_type;
+
+ BOOST_MPL_ASSERT((boost::fusion::result_of::equal_to<boost::fusion::result_of::begin<filter_view_type>::type, boost::fusion::result_of::end<filter_view_type>::type>));
+ }
+
+ {
+ typedef map<pair<void, int>, pair<double, std::string> > map_type;
+ map_type m(make_pair<void>(0), make_pair<double>("Bond"));
+
+ typedef filter_view<map_type const, is_same<_, pair<double, std::string> > > filter_view_type;
+ filter_view_type f(m);
+
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<filter_view_type, double>::type));
+ BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::has_key<filter_view_type, void>::type));
+
+ BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<filter_view_type>::type>::type, double>));
+ BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<filter_view_type>::type>::type, std::string>));
+
+ std::cout << deref_data(begin(f)) << std::endl;
+ BOOST_TEST((deref_data(begin(f)) == "Bond"));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/fixture.hpp b/src/boost/libs/fusion/test/sequence/fixture.hpp
new file mode 100644
index 000000000..4cb05971e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/fixture.hpp
@@ -0,0 +1,216 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+
+ 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/fusion/sequence/comparison.hpp>
+#include <boost/mpl/identity.hpp>
+
+namespace test_detail
+{
+ struct convertible
+ {
+ convertible() : value_() {}
+ convertible(int value) : value_(value) {}
+ int value_;
+ };
+
+ bool operator==(convertible const& lhs, convertible const& rhs)
+ {
+ return lhs.value_ == rhs.value_;
+ }
+
+ bool operator!=(convertible const& lhs, convertible const& rhs)
+ {
+ return lhs.value_ != rhs.value_;
+ }
+
+ // Testing conversion at function call allows for testing mutable lvalue,
+ // const lvalue, and rvalue as the source. mpl::identity prevents deduction
+ template <typename T>
+ T implicit_construct(typename boost::mpl::identity<T>::type source)
+ {
+ return source;
+ }
+
+ template <typename F, typename Source, typename Expected>
+ bool run(Source const& source, Expected const& expected)
+ {
+ return F()(source, expected);
+ }
+
+ template <typename F, typename Source>
+ bool run(Source const& source)
+ {
+ return run<F>(source, source);
+ }
+
+ template <typename T>
+ struct can_rvalue_implicit_construct
+ {
+ template<typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return expected == implicit_construct<T>(implicit_construct<Source>(source));
+ }
+ };
+
+ template <typename T>
+ struct can_lvalue_implicit_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source source, Expected const& expected) const
+ {
+ return expected == implicit_construct<T>(source);
+ }
+ };
+
+ template <typename T>
+ struct can_const_lvalue_implicit_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return expected == implicit_construct<T>(source);
+ }
+ };
+
+ template <typename T>
+ struct can_implicit_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return
+ run< can_rvalue_implicit_construct<T> >(source, expected) &&
+ run< can_lvalue_implicit_construct<T> >(source, expected) &&
+ run< can_const_lvalue_implicit_construct<T> >(source, expected);
+ }
+ };
+
+ template <typename T>
+ struct can_rvalue_construct
+ {
+ template<typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return expected == T(implicit_construct<Source>(source));
+ }
+ };
+
+ template <typename T>
+ struct can_lvalue_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source source, Expected const& expected) const
+ {
+ return expected == T(source);
+ }
+ };
+
+ template <typename T>
+ struct can_const_lvalue_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return expected == T(source);
+ }
+ };
+
+ template <typename T>
+ struct can_construct
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return
+ run< can_rvalue_construct<T> >(source, expected) &&
+ run< can_lvalue_construct<T> >(source, expected) &&
+ run< can_const_lvalue_construct<T> >(source, expected);
+ }
+ };
+
+ template <typename T>
+ struct can_rvalue_assign
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ bool result = true;
+ {
+ T seq;
+ result &= (seq == expected || seq != expected);
+
+ seq = implicit_construct<Source>(source);
+ result &= (seq == expected);
+ }
+ return result;
+ }
+ };
+
+ template <typename T>
+ struct can_lvalue_assign
+ {
+
+ template <typename Source, typename Expected>
+ bool operator()(Source source, Expected const& expected) const
+ {
+ bool result = true;
+ {
+ T seq;
+ result &= (seq == expected || seq != expected);
+
+ seq = source;
+ result &= (seq == expected);
+ }
+ return result;
+ }
+ };
+
+ template <typename T>
+ struct can_const_lvalue_assign
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ bool result = true;
+ {
+ T seq;
+ result &= (seq == expected || seq != expected);
+
+ seq = source;
+ result &= (seq == expected);
+ }
+ return result;
+ }
+ };
+
+ template <typename T>
+ struct can_assign
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return
+ run< can_rvalue_assign<T> >(source, expected) &&
+ run< can_lvalue_assign<T> >(source, expected) &&
+ run< can_const_lvalue_assign<T> >(source, expected);
+ }
+ };
+
+ template <typename T>
+ struct can_copy
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ return
+ run< can_construct<T> >(source, expected) &&
+ run< can_implicit_construct<T> >(source, expected) &&
+ run< can_assign<T> >(source, expected);
+ }
+ };
+} // test_detail
diff --git a/src/boost/libs/fusion/test/sequence/flatten_view.cpp b/src/boost/libs/fusion/test/sequence/flatten_view.cpp
new file mode 100644
index 000000000..da8e65273
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/flatten_view.cpp
@@ -0,0 +1,56 @@
+/*==============================================================================
+ Copyright (c) 2013 Jamboree
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/view/flatten_view/flatten_view.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/fusion/algorithm/auxiliary/copy.hpp>
+
+
+int main()
+{
+ using namespace boost::fusion;
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq(1, 2, make_vector(3, 4), 5);
+ flatten_view<sequence_type> flattened(seq);
+
+ BOOST_TEST((boost::fusion::size(flattened) == 5));
+ BOOST_TEST((boost::fusion::distance(boost::fusion::begin(flattened), boost::fusion::end(flattened)) == 5));
+ }
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq(1, 2, make_vector(3, 4), 5);
+ flatten_view<sequence_type> flattened(seq);
+ std::cout << flattened << std::endl;
+ BOOST_TEST((flattened == make_vector(1, 2, 3, 4, 5)));
+ BOOST_TEST((*advance_c<2>(boost::fusion::begin(flattened)) == 3));
+ }
+
+ {
+ typedef vector<int, int, vector<int, int>, int> sequence_type;
+ sequence_type seq;
+ flatten_view<sequence_type> flattened(seq);
+ copy(make_vector(1, 2, 3, 4, 5), flattened);
+ std::cout << seq << std::endl;
+ BOOST_TEST((seq == make_vector(1, 2, make_vector(3, 4), 5)));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/front_extended_deque.cpp b/src/boost/libs/fusion/test/sequence/front_extended_deque.cpp
new file mode 100644
index 000000000..cdbedeb3b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/front_extended_deque.cpp
@@ -0,0 +1,114 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/container/deque/deque.hpp>
+#include <boost/fusion/container/deque/front_extended_deque.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/mpl.hpp>
+
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/iterator.hpp>
+
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ typedef deque<> initial_deque_type;
+ initial_deque_type initial_deque;
+ typedef front_extended_deque<initial_deque_type, int> extended_type;
+ extended_type extended(initial_deque, 1);
+
+ BOOST_TEST(size(extended) == 1);
+ BOOST_TEST(extended == make_vector(1));
+ BOOST_TEST(*begin(extended) == 1);
+ BOOST_TEST(*prior(end(extended)) == 1);
+ BOOST_TEST(distance(begin(extended), end(extended)) == 1);
+ }
+ {
+ namespace mpl = boost::mpl;
+ typedef deque<> initial_deque_type;
+ typedef front_extended_deque<initial_deque_type, int> extended_type;
+
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 0>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::deref<mpl::begin<extended_type>::type>::type, int>));
+ BOOST_MPL_ASSERT((mpl::equal_to<mpl::size<extended_type>::type, mpl::int_<1> >));
+ }
+ {
+ int i(1);
+ typedef deque<> initial_deque_type;
+ initial_deque_type initial_deque;
+ typedef front_extended_deque<initial_deque_type, int&> extended_type;
+ extended_type extended(initial_deque, i);
+ BOOST_TEST(extended == make_vector(1));
+
+ int i2(2);
+ extended_type extended2(initial_deque_type(), i2);
+
+ extended = extended2;
+
+ BOOST_TEST(extended == make_vector(2));
+
+ BOOST_TEST(i == i2);
+ }
+
+ {
+ typedef deque<char, long> initial_deque_type;
+ initial_deque_type initial_deque('a', 101L);
+ typedef front_extended_deque<initial_deque_type, int> extended_type;
+ extended_type extended(initial_deque, 1);
+
+ BOOST_TEST(size(extended) == 3);
+ BOOST_TEST(extended == make_vector(1, 'a', 101L));
+ BOOST_TEST(*begin(extended) == 1);
+ BOOST_TEST(*next(begin(extended)) == 'a');
+ BOOST_TEST(*prior(end(extended)) == 101L);
+ BOOST_TEST(distance(begin(extended), end(extended)) == 3);
+ BOOST_TEST(*advance_c<2>(begin(extended)) == 101L);
+ }
+ {
+ namespace mpl = boost::mpl;
+ typedef deque<char, long> initial_deque_type;
+ typedef front_extended_deque<initial_deque_type, int> extended_type;
+
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 0>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 1>::type, char>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::at_c<extended_type, 2>::type, long>));
+ BOOST_MPL_ASSERT((boost::is_same<mpl::deref<mpl::begin<extended_type>::type>::type, int>));
+ BOOST_MPL_ASSERT((mpl::equal_to<mpl::size<extended_type>::type, mpl::int_<3> >));
+ }
+ {
+ char ch('a');
+ long l(101L);
+ int i(1);
+ typedef deque<char&, long&> initial_deque_type;
+ initial_deque_type initial_deque(ch, l);
+ typedef front_extended_deque<initial_deque_type, int&> extended_type;
+ extended_type extended(initial_deque, i);
+ BOOST_TEST(extended == make_vector(1, 'a', 101L));
+
+ char ch2('b');
+ long l2(202L);
+ int i2(2);
+ extended_type extended2(initial_deque_type(ch2, l2), i2);
+
+ extended = extended2;
+
+ BOOST_TEST(extended == make_vector(2, 'b', 202L));
+
+ BOOST_TEST(i == i2);
+ BOOST_TEST(ch == ch2);
+ BOOST_TEST(l == l2);
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/github-159.cpp b/src/boost/libs/fusion/test/sequence/github-159.cpp
new file mode 100644
index 000000000..e21d80c5c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/github-159.cpp
@@ -0,0 +1,16 @@
+/*=============================================================================
+ Copyright (c) 2017 Kohei Takahashi
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/type.hpp>
+
+int main()
+{
+ boost::fusion::vector<int, float> v1;
+ boost::fusion::vector<int, float> v2(v1);
+ v1 = v2;
+}
diff --git a/src/boost/libs/fusion/test/sequence/github-176.cpp b/src/boost/libs/fusion/test/sequence/github-176.cpp
new file mode 100644
index 000000000..3f57df278
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/github-176.cpp
@@ -0,0 +1,90 @@
+/*=============================================================================
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/deque.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/container/set.hpp>
+#include <boost/fusion/tuple/tuple.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+template <typename Sequence>
+void test_at()
+{
+ Sequence seq;
+
+ // zero initialized
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[0] == 0);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[1] == 0);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[2] == 0);
+
+ int (&arr)[3] = boost::fusion::deref(boost::fusion::begin(seq));
+
+ arr[0] = 2;
+ arr[1] = 4;
+ arr[2] = 6;
+
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[0] == 2);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[1] == 4);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[2] == 6);
+
+ boost::fusion::at_c<0>(seq)[1] = 42;
+
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[0] == 2);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[1] == 42);
+ BOOST_TEST(boost::fusion::at_c<0>(seq)[2] == 6);
+}
+
+template <typename T> inline T& value(T& v) { return v; }
+template <typename K, typename T> inline T& value(boost::fusion::pair<K, T>& v) { return v.second; }
+
+template <typename Sequence>
+void test_at_key()
+{
+ Sequence seq;
+
+ // zero initialized
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[0] == 0);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[1] == 0);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[2] == 0);
+
+ int (&arr)[3] = value(boost::fusion::deref(boost::fusion::begin(seq)));
+
+ arr[0] = 2;
+ arr[1] = 4;
+ arr[2] = 6;
+
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[0] == 2);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[1] == 4);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[2] == 6);
+
+ boost::fusion::at_key<int[3]>(seq)[1] = 42;
+
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[0] == 2);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[1] == 42);
+ BOOST_TEST(boost::fusion::at_key<int[3]>(seq)[2] == 6);
+}
+
+int main()
+{
+ using namespace boost::fusion;
+
+ test_at<vector<int[3]> >();
+ test_at<deque<int[3]> >();
+ test_at<list<int[3]> >();
+ test_at<tuple<int[3]> >();
+
+#if !BOOST_WORKAROUND(BOOST_GCC, / 100 == 406) || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
+ // FIXME: gcc 4.6 w/ c++0x doesn't like set with array...
+ test_at_key<set<int[3]> >();
+#endif
+ test_at_key<map<pair<int[3], int[3]> > >();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/hash.cpp b/src/boost/libs/fusion/test/sequence/hash.cpp
new file mode 100644
index 000000000..30b44055a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/hash.cpp
@@ -0,0 +1,59 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+
+ 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 <string>
+
+#include <boost/core/lightweight_test.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/fusion/sequence/hash.hpp>
+
+struct test_struct
+{
+ test_struct(bool bb, int ii, char cc, std::string const& ss) :
+ b(bb),
+ i(ii),
+ c(cc),
+ s(ss) {}
+
+ bool b;
+ int i;
+ char c;
+ std::string s;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(
+ test_struct,
+ (bool, b)
+ (int, i)
+ (char, c)
+ (std::string, s)
+)
+
+int main()
+{
+ using boost::fusion::hash_value;
+
+ const test_struct a0(false, 1, 'c', "Hello Nurse"),
+ a1(false, 1, 'c', "Hello Nurse"),
+ b(true, 1, 'c', "Hello Nurse"),
+ c(false, 0, 'c', "Hello Nurse"),
+ d(false, 1, 'd', "Hello Nurse"),
+ e(false, 1, 'c', "Hello World");
+
+ BOOST_TEST(hash_value(a0) == hash_value(a1));
+ BOOST_TEST(hash_value(a0) != hash_value(b));
+ BOOST_TEST(hash_value(a0) != hash_value(c));
+ BOOST_TEST(hash_value(a0) != hash_value(d));
+ BOOST_TEST(hash_value(a0) != hash_value(e));
+ BOOST_TEST(hash_value(b) != hash_value(c));
+ BOOST_TEST(hash_value(b) != hash_value(d));
+ BOOST_TEST(hash_value(b) != hash_value(d));
+ BOOST_TEST(hash_value(c) != hash_value(d));
+ BOOST_TEST(hash_value(c) != hash_value(e));
+ BOOST_TEST(hash_value(d) != hash_value(e));
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/hash.hpp b/src/boost/libs/fusion/test/sequence/hash.hpp
new file mode 100644
index 000000000..b298f418c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/hash.hpp
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+ Copyright (c) 2017 Kohei Takahashi
+
+ 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 <string>
+#include <utility>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/hash.hpp>
+#include <boost/functional/hash.hpp>
+
+void hash_test()
+{
+ namespace fusion = boost::fusion;
+ using namespace fusion;
+
+ const FUSION_SEQUENCE<int, char, bool, std::string> v0(42, 'x', false, "Aurea prima");
+ const FUSION_SEQUENCE<int, char, bool, std::string> v1(42, 'x', false, "Aurea prima");
+ BOOST_TEST(fusion::hash_value(v0) == fusion::hash_value(v1));
+
+ const FUSION_SEQUENCE<int, char, bool, std::string> w(41, 'x', false, "Aurea prima");
+ BOOST_TEST(fusion::hash_value(w) != fusion::hash_value(v0));
+
+ const FUSION_SEQUENCE<int, char, bool, std::string> x(42, 'y', false, "Aurea prima");
+ BOOST_TEST(fusion::hash_value(x) != fusion::hash_value(v0));
+
+ const FUSION_SEQUENCE<int, char, bool, std::string> y(42, 'x', true, "Aurea prima");
+ BOOST_TEST(fusion::hash_value(y) != fusion::hash_value(v0));
+
+ const FUSION_SEQUENCE<int, char, bool, std::string> z(42, 'x', false, "quae vindice nullo");
+ BOOST_TEST(fusion::hash_value(z) != fusion::hash_value(v0));
+}
diff --git a/src/boost/libs/fusion/test/sequence/io.cpp b/src/boost/libs/fusion/test/sequence/io.cpp
new file mode 100644
index 000000000..d14f2af39
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/io.cpp
@@ -0,0 +1,131 @@
+/*=============================================================================
+ Copyright (C) 1999-2003 Jaakko Jarvi
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/io/in.hpp>
+
+#include <fstream>
+#include <iterator>
+#include <algorithm>
+#include <string>
+
+#if defined BOOST_NO_STRINGSTREAM
+# include <strstream>
+#else
+# include <sstream>
+#endif
+
+using boost::fusion::vector;
+using boost::fusion::make_vector;
+using boost::fusion::tuple_close;
+using boost::fusion::tuple_open;
+using boost::fusion::tuple_delimiter;
+
+#if defined BOOST_NO_STRINGSTREAM
+ using std::ostrstream;
+ using std::istrstream;
+ typedef ostrstream useThisOStringStream;
+ typedef istrstream useThisIStringStream;
+#else
+ using std::ostringstream;
+ using std::istringstream;
+ typedef ostringstream useThisOStringStream;
+ typedef istringstream useThisIStringStream;
+#endif
+
+using std::endl;
+using std::ofstream;
+using std::ifstream;
+using std::string;
+
+int
+main()
+{
+ using boost::fusion::tuple_close;
+ using boost::fusion::tuple_open;
+ using boost::fusion::tuple_delimiter;
+
+ useThisOStringStream os1;
+
+ // Set format [a, b, c] for os1
+ os1 << tuple_open('[');
+ os1 << tuple_close(']');
+ os1 << tuple_delimiter(',');
+ os1 << make_vector(1, 2, 3);
+
+ BOOST_TEST (os1.str() == std::string("[1,2,3]") );
+
+ {
+ useThisOStringStream os2;
+ // Set format (a:b:c) for os2;
+ os2 << tuple_open('(');
+ os2 << tuple_close(')');
+ os2 << tuple_delimiter(':');
+
+ os2 << make_vector("TUPU", "HUPU", "LUPU", 4.5);
+ BOOST_TEST (os2.str() == std::string("(TUPU:HUPU:LUPU:4.5)") );
+ }
+
+ {
+ useThisOStringStream os2;
+ // Set format (a:b:c) for os2;
+ os2 << tuple_open('(');
+ os2 << tuple_close(')');
+ os2 << tuple_delimiter(':');
+ // overwrite previous setting
+ os2 << tuple_open("< ");
+ os2 << tuple_close('>');
+ os2 << tuple_delimiter(", ");
+
+ os2 << make_vector("TUPU", "HUPU", "LUPU", 4.5);
+ BOOST_TEST (os2.str() == std::string("< TUPU, HUPU, LUPU, 4.5>") );
+ }
+
+ // The format is still [a, b, c] for os1
+ os1 << make_vector(1, 2, 3);
+ BOOST_TEST (os1.str() == std::string("[1,2,3][1,2,3]") );
+
+ std::ofstream tmp("temp.tmp");
+
+ tmp << make_vector("One", "Two", 3);
+ tmp << tuple_delimiter(':');
+ tmp << make_vector(1000, 2000, 3000) << endl;
+
+ tmp.close();
+
+ // When reading tuples from a stream, manipulators must be set correctly:
+ ifstream tmp3("temp.tmp");
+ vector<string, string, int> j;
+
+ tmp3 >> j;
+ BOOST_TEST (tmp3.good() );
+
+ tmp3 >> tuple_delimiter(':');
+ vector<int, int, int> i;
+ tmp3 >> i;
+ BOOST_TEST (tmp3.good() );
+
+ tmp3.close();
+
+ // reading vector<int, int, int> in format (a b c);
+ useThisIStringStream is("(100 200 300)");
+
+ vector<int, int, int> ti;
+ BOOST_TEST(!!(is >> ti));
+ BOOST_TEST(ti == make_vector(100, 200, 300));
+
+ // Note that strings are problematic:
+ // writing a tuple on a stream and reading it back doesn't work in
+ // general. If this is wanted, some kind of a parseable string class
+ // should be used.
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/iterator.hpp b/src/boost/libs/fusion/test/sequence/iterator.hpp
new file mode 100644
index 000000000..d543f8eb3
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/iterator.hpp
@@ -0,0 +1,200 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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 <string>
+#include <boost/static_assert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/value_of.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+
+void test()
+{
+ using boost::fusion::next;
+ using namespace boost::fusion;
+ using namespace boost;
+
+ { // Testing deref, next, prior, begin, end
+
+ char const* s = "Hello";
+ typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
+ seq_type v(1, 'x', 3.3, s);
+ boost::fusion::result_of::begin<seq_type>::type i(v);
+
+ BOOST_TEST(*i == 1);
+ BOOST_TEST(*next(i) == 'x');
+ BOOST_TEST(*next(next(i)) == 3.3);
+ BOOST_TEST(*next(next(next(i))) == s);
+ next(next(next(next(i)))); // end
+
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*prior(next(next(next(i)))) == 3.3);
+ BOOST_TEST(*prior(prior(next(next(next(i))))) == 'x');
+ BOOST_TEST(*prior(prior(prior(next(next(next(i)))))) == 1);
+#endif
+ BOOST_TEST(*begin(v) == 1);
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*prior(end(v)) == s);
+#endif
+
+ *i = 3;
+ BOOST_TEST(*i == 3);
+ BOOST_TEST(&*i == &at_c<0>(v));
+
+ // prove that it is mutable
+ *i = 987;
+ BOOST_TEST(*i == 987);
+ }
+
+ { // Testing const sequence and const iterator
+
+ char const* s = "Hello";
+ typedef FUSION_SEQUENCE<int, char, double, char const*> const seq_type;
+ seq_type t(1, 'x', 3.3, s);
+ boost::fusion::result_of::begin<seq_type>::type i(t);
+
+ BOOST_TEST(*i == 1);
+ BOOST_TEST(*next(i) == 'x');
+ BOOST_TEST(*begin(t) == 1);
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*prior(end(t)) == s);
+#endif
+
+#ifdef FUSION_TEST_FAIL
+ *i = 3; // must not compile
+#endif
+ }
+
+ { // Testing iterator equality
+
+ typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
+ typedef FUSION_SEQUENCE<int, char, double, char const*> const cseq_type;
+ typedef boost::fusion::result_of::begin<seq_type>::type vi1;
+ typedef boost::fusion::result_of::begin<cseq_type>::type vi2;
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi1>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi1 const>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2 const>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2 const>::value));
+ }
+
+ {
+ typedef FUSION_SEQUENCE<int, int> seq_type;
+ typedef boost::fusion::result_of::begin<seq_type>::type begin_type;
+ typedef boost::fusion::result_of::end<seq_type>::type end_type;
+ typedef boost::fusion::result_of::next<begin_type>::type i1;
+ typedef boost::fusion::result_of::next<i1>::type i2;
+
+ BOOST_STATIC_ASSERT((is_same<end_type, i2>::value));
+ }
+
+ { // testing deref, next, prior, begin, end
+
+ char const* s = "Hello";
+ typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
+ seq_type t(1, 'x', 3.3, s);
+ boost::fusion::result_of::begin<seq_type>::type i(t);
+
+ BOOST_TEST(*i == 1);
+ BOOST_TEST(*next(i) == 'x');
+ BOOST_TEST(*next(next(i)) == 3.3);
+ BOOST_TEST(*next(next(next(i))) == s);
+
+ next(next(next(next(i)))); // end
+
+#ifdef FUSION_TEST_FAIL
+ next(next(next(next(next(i))))); // past the end: must not compile
+#endif
+
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*prior(next(next(next(i)))) == 3.3);
+ BOOST_TEST(*prior(prior(next(next(next(i))))) == 'x');
+ BOOST_TEST(*prior(prior(prior(next(next(next(i)))))) == 1);
+#endif
+ BOOST_TEST(*begin(t) == 1);
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*prior(end(t)) == s);
+#endif
+
+ *i = 3;
+ BOOST_TEST(*i == 3);
+ BOOST_TEST(*i == at_c<0>(t));
+ }
+
+ { // Testing distance
+
+ typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
+ seq_type t(1, 'x', 3.3, "Hello");
+
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<
+ boost::fusion::result_of::begin<seq_type>::type
+ , boost::fusion::result_of::end<seq_type>::type >::value == 4));
+
+ BOOST_TEST(distance(begin(t), end(t)).value == 4);
+ }
+
+ { // Testing tuple iterator boost::fusion::result_of::value_of, boost::fusion::result_of::deref, boost::fusion::result_of::value_at
+
+ typedef FUSION_SEQUENCE<int, char&> seq_type;
+ typedef boost::fusion::result_of::begin<seq_type>::type i0;
+ typedef boost::fusion::result_of::next<i0>::type i1;
+ typedef boost::fusion::result_of::next<boost::fusion::result_of::begin<const seq_type>::type>::type i2;
+
+ BOOST_STATIC_ASSERT((
+ is_same<boost::fusion::result_of::value_at_c<seq_type, 0>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((
+ is_same<boost::fusion::result_of::value_at_c<seq_type, 1>::type, char&>::value));
+
+ BOOST_STATIC_ASSERT((
+ is_same<traits::category_of<i0>::type, FUSION_TRAVERSAL_TAG>::value));
+
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i0>::type, int&>::value));
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i1>::type, char&>::value));
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i2>::type, char&>::value));
+
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i0>::type, int>::value));
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i1>::type, char&>::value));
+ BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i2>::type, char&>::value));
+ }
+
+ { // Testing advance
+
+ typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
+ seq_type t(1, 'x', 3.3, "Hello");
+
+ BOOST_TEST(*advance_c<0>(begin(t)) == at_c<0>(t));
+ BOOST_TEST(*advance_c<1>(begin(t)) == at_c<1>(t));
+ BOOST_TEST(*advance_c<2>(begin(t)) == at_c<2>(t));
+ BOOST_TEST(*advance_c<3>(begin(t)) == at_c<3>(t));
+
+#if !defined(FUSION_NO_PRIOR)
+ BOOST_TEST(*advance_c<-1>(end(t)) == at_c<3>(t));
+ BOOST_TEST(*advance_c<-2>(end(t)) == at_c<2>(t));
+ BOOST_TEST(*advance_c<-3>(end(t)) == at_c<1>(t));
+ BOOST_TEST(*advance_c<-4>(end(t)) == at_c<0>(t));
+#endif
+
+ BOOST_TEST(&*advance_c<0>(begin(t)) == &at_c<0>(t));
+ BOOST_TEST(&*advance_c<1>(begin(t)) == &at_c<1>(t));
+ BOOST_TEST(&*advance_c<2>(begin(t)) == &at_c<2>(t));
+ BOOST_TEST(&*advance_c<3>(begin(t)) == &at_c<3>(t));
+ }
+}
+
+
+
+
diff --git a/src/boost/libs/fusion/test/sequence/iterator_range.cpp b/src/boost/libs/fusion/test/sequence/iterator_range.cpp
new file mode 100644
index 000000000..18f91af0a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/iterator_range.cpp
@@ -0,0 +1,115 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/view/iterator_range/iterator_range.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/iterator/value_of_data.hpp>
+#include <boost/fusion/iterator/deref_data.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ namespace fusion = boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type vec(1, 'x', 3.3, s);
+
+ {
+ typedef vector_iterator<vector_type, 1> i1t;
+ typedef vector_iterator<vector_type, 3> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector('x', 3.3)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ typedef vector_iterator<vector_type, 0> i1t;
+ typedef vector_iterator<vector_type, 0> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST(slice == make_vector());
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ typedef boost::mpl::begin<mpl_vec>::type it0;
+ typedef boost::mpl::next<it0>::type it1;
+ typedef boost::mpl::next<it1>::type it2;
+ typedef boost::mpl::next<it2>::type it3;
+
+ it1 f;
+ it3 l;
+
+ typedef iterator_range<it1, it3> slice_t;
+ slice_t slice(f, l);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector(3, 4)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ typedef map<pair<void,std::string>, pair<double,char>,pair<void*, int> > map_type;
+ map_type m(make_pair<void>("foo"), make_pair<double>('x'), make_pair<void*>(2));
+
+ typedef iterator_range<
+ boost::fusion::result_of::begin<map_type>::type
+ , boost::fusion::result_of::advance_c<boost::fusion::result_of::begin<map_type>::type,2>::type
+ > range_type;
+ range_type r(begin(m), advance_c<2>(begin(m)));
+
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, void>::type));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, double>::type));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<range_type>::type>::type, void>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, double>));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<range_type>::type>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, char>));
+
+ std::cout << deref_data(begin(r)) << std::endl;
+ std::cout << deref_data(fusion::next(begin(r))) << std::endl;
+ BOOST_TEST((deref_data(begin(r)) == "foo"));
+ BOOST_TEST((deref_data(fusion::next(begin(r))) == 'x'));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/joint_view.cpp b/src/boost/libs/fusion/test/sequence/joint_view.cpp
new file mode 100644
index 000000000..ba5659b74
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/joint_view.cpp
@@ -0,0 +1,188 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/container/set.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/view/joint_view/joint_view.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/iterator/value_of.hpp>
+#include <boost/fusion/iterator/deref_data.hpp>
+#include <boost/mpl/assert.hpp>
+#include <string>
+
+struct X
+{
+ operator char const*() const
+ {
+ return "<X-object>";
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ namespace fusion = boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing joint_view
+
+ {
+ vector<int> t1(3);
+ vector<X> t2;
+ typedef joint_view<vector<int>, vector<X> > view_type;
+ view_type view(t1, t2);
+
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(3, X())));
+ }
+
+ {
+ vector<int, char> t1(3, 'x');
+ vector<X> t2;
+ typedef joint_view<vector<int, char>, vector<X> > view_type;
+ view_type view(t1, t2);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(3, 'x', X())));
+
+ *begin(view) = 4;
+ BOOST_TEST(at_c<0>(t1) == 4);
+ }
+
+ {
+ vector<int, char> t1(3, 'x');
+ vector<X, int> t2;
+ typedef joint_view<vector<int, char>, vector<X, int> > view_type;
+ view_type view(t1, t2);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(3, 'x', X(), 0)));
+ }
+
+ {
+ typedef vector<int> t1_type;
+ t1_type t1(777);
+ typedef vector<int, char, double> t2_type;
+ t2_type t2(1, 'x', 3.3);
+
+ {
+ typedef joint_view<t1_type, t2_type> view_type;
+ view_type view(t1, t2);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(777, 1, 'x', 3.3)));
+ }
+
+ {
+ typedef joint_view<t2_type, t1_type> view_type;
+ view_type view(t2, t1);
+ std::cout << view << std::endl;
+ BOOST_TEST((view == make_vector(1, 'x', 3.3, 777)));
+ }
+
+ {
+ typedef joint_view<t2_type, t1_type> jv_type;
+ typedef joint_view<jv_type, jv_type> jv2_type;
+
+ jv_type jv(t2, t1);
+ jv2_type jv2(jv, jv);
+
+ std::cout << jv << std::endl;
+ std::cout << jv2 << std::endl;
+
+ BOOST_TEST(jv2
+ == make_vector(1, 'x', 3.3, 777, 1, 'x', 3.3, 777));
+ }
+
+ {
+ typedef joint_view<t2_type, t1_type> jt_type;
+ typedef joint_view<t1_type, t2_type> jv2_type;
+ typedef joint_view<jt_type, jv2_type> jv3_type;
+
+ jt_type jt(t2, t1);
+ jv2_type jv2(t1, t2);
+ jv3_type jv3(jt, jv2);
+
+ std::cout << jt << std::endl;
+ std::cout << jv2 << std::endl;
+ std::cout << jv3 << std::endl;
+
+ BOOST_TEST(jv3
+ == make_vector(1, 'x', 3.3, 777, 777, 1, 'x', 3.3));
+ }
+
+ {
+ typedef joint_view<vector<>, t1_type> jt_type;
+ vector<> empty;
+ jt_type jt(empty, t1);
+ std::cout << jt << std::endl;
+ BOOST_TEST(jt == make_vector(777));
+ }
+
+ {
+ typedef joint_view<t1_type, vector<> > jt_type;
+ vector<> empty;
+ jt_type jt(t1, empty);
+ std::cout << jt << std::endl;
+ BOOST_TEST(jt == make_vector(777));
+ }
+
+ {
+ typedef joint_view<vector<>, vector<> > jt_type;
+ vector<> empty;
+ jt_type jt(empty, empty);
+ std::cout << jt << std::endl;
+ BOOST_TEST(jt == make_vector());
+ }
+ }
+
+ {
+ typedef map<pair<void,int> > map_type;
+ map_type m(make_pair<void>(0));
+
+ typedef set<std::string, float> set_type;
+ set_type s("foo", 1.3f);
+
+ typedef joint_view<map_type, set_type> joint_view_type;
+ joint_view_type j(m,s);
+
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, void>::type));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, std::string>::type));
+ BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, float>::type));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<joint_view_type>::type>::type, void>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
+ , float>));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<joint_view_type>::type>::type, int>));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
+ , float>));
+
+ std::cout << deref_data(begin(j)) << std::endl;
+ std::cout << deref_data(fusion::next(begin(j))) << std::endl;
+ std::cout << deref_data(fusion::next(fusion::next(begin(j)))) << std::endl;
+ BOOST_TEST((deref_data(begin(j)) == 0));
+ BOOST_TEST((deref_data(fusion::next(begin(j))) == "foo"));
+ BOOST_TEST((deref_data(fusion::next(fusion::next(begin(j)))) == 1.3f));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_comparison.cpp b/src/boost/libs/fusion/test/sequence/list_comparison.cpp
new file mode 100644
index 000000000..2a02eba01
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_comparison.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "comparison.hpp"
+
+int
+main()
+{
+ equality_test();
+ ordering_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/list_construction.cpp b/src/boost/libs/fusion/test/sequence/list_construction.cpp
new file mode 100644
index 000000000..a10b1e1a9
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_construction.cpp
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "construction.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/list_copy.cpp b/src/boost/libs/fusion/test/sequence/list_copy.cpp
new file mode 100644
index 000000000..797089e9c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_copy.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/fusion/container/generation/list_tie.hpp>
+
+#define FUSION_SEQUENCE list
+#include "copy.hpp"
+
+int
+main()
+{
+ test<test_detail::can_copy>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_hash.cpp b/src/boost/libs/fusion/test/sequence/list_hash.cpp
new file mode 100644
index 000000000..51203b273
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_hash.cpp
@@ -0,0 +1,16 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "hash.hpp"
+
+int main()
+{
+ hash_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/list_iterator.cpp b/src/boost/libs/fusion/test/sequence/list_iterator.cpp
new file mode 100644
index 000000000..62d670878
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_iterator.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#define FUSION_NO_PRIOR
+#define FUSION_TRAVERSAL_TAG forward_traversal_tag
+#include "./iterator.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/sequence/list_make.cpp b/src/boost/libs/fusion/test/sequence/list_make.cpp
new file mode 100644
index 000000000..296b6063e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_make.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_misc.cpp b/src/boost/libs/fusion/test/sequence/list_misc.cpp
new file mode 100644
index 000000000..28d84854b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_misc.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/fusion/container/list/convert.hpp>
+
+#define FUSION_SEQUENCE list
+#define FUSION_FORWARD_ONLY
+#include "misc.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_mutate.cpp b/src/boost/libs/fusion/test/sequence/list_mutate.cpp
new file mode 100644
index 000000000..b2736679c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_mutate.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "mutate.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_nest.cpp b/src/boost/libs/fusion/test/sequence/list_nest.cpp
new file mode 100644
index 000000000..82df4864f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_nest.cpp
@@ -0,0 +1,36 @@
+/*=============================================================================
+ Copyright (C) 2015 Kohei Takahshi
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::list
+#include "nest.hpp"
+
+/* list has a few issues:
+ - sequence conversion constructor has bug when first element is a sequence
+ - assignment sequence conversion has bug in base class */
+template <typename T>
+struct skip_issues
+{
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ using namespace test_detail;
+ return
+ run< can_copy<T> >(source, expected) &&
+ run< can_construct_from_elements<T> >(source, expected);
+ }
+};
+
+
+int
+main()
+{
+ test<skip_issues>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_tie.cpp b/src/boost/libs/fusion/test/sequence/list_tie.cpp
new file mode 100644
index 000000000..30c8ed83d
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_tie.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/list_tie.hpp>
+#include <boost/fusion/container/generation/ignore.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "tie.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/list_value_at.cpp b/src/boost/libs/fusion/test/sequence/list_value_at.cpp
new file mode 100644
index 000000000..487968dae
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/list_value_at.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "value_at.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/make.hpp b/src/boost/libs/fusion/test/sequence/make.hpp
new file mode 100644
index 000000000..00eaed2cd
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/make.hpp
@@ -0,0 +1,88 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <string>
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+#if !defined(FUSION_MAKE)
+#define FUSION_MAKE BOOST_PP_CAT(make_, FUSION_SEQUENCE)
+#endif
+
+namespace test_detail
+{
+ // something to prevent warnings for unused variables
+ template<class T> void dummy(const T&) {}
+
+ class A {};
+ class B {};
+}
+
+void make_tuple_test() {}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ {
+ FUSION_SEQUENCE<int, char> t1 = FUSION_MAKE(5, 'a');
+ BOOST_TEST(FUSION_AT<0>(t1) == 5);
+ BOOST_TEST(FUSION_AT<1>(t1) == 'a');
+
+ FUSION_SEQUENCE<int, std::string> t2;
+ t2 = FUSION_MAKE((short int)2, std::string("Hi"));
+ BOOST_TEST(FUSION_AT<0>(t2) == 2);
+ BOOST_TEST(FUSION_AT<1>(t2) == "Hi");
+ }
+
+ { // This test was previously disallowed for non-PTS compilers.
+ A a = A(); B b;
+ const A ca = a;
+ FUSION_MAKE(boost::cref(a), b);
+ FUSION_MAKE(boost::ref(a), b);
+ FUSION_MAKE(boost::ref(a), boost::cref(b));
+ FUSION_MAKE(boost::ref(ca));
+ }
+
+ { // the result of make_xxx is assignable:
+ BOOST_TEST(FUSION_MAKE(2, 4, 6) ==
+ (FUSION_MAKE(1, 2, 3) = FUSION_MAKE(2, 4, 6)));
+ }
+
+ { // This test was previously disallowed for non-PTS compilers.
+ FUSION_MAKE("Donald", "Daisy"); // should work;
+ // std::make_pair("Doesn't","Work"); // fails
+ }
+
+ {
+ // You can store a reference to a function in a sequence
+ FUSION_SEQUENCE<void(&)()> adf(make_tuple_test);
+ dummy(adf); // avoid warning for unused variable
+ }
+
+#if defined(FUSION_TEST_FAIL)
+ {
+ // But make_xxx doesn't work
+ // with function references, since it creates a const
+ // qualified function type
+
+ FUSION_MAKE(make_tuple_test);
+ }
+#endif
+
+ {
+ // With function pointers, make_xxx works just fine
+ FUSION_MAKE(&make_tuple_test);
+ }
+}
diff --git a/src/boost/libs/fusion/test/sequence/make_list.cpp b/src/boost/libs/fusion/test/sequence/make_list.cpp
new file mode 100644
index 000000000..296b6063e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/make_list.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+
+#define FUSION_SEQUENCE list
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/make_vector.cpp b/src/boost/libs/fusion/test/sequence/make_vector.cpp
new file mode 100644
index 000000000..8a687354a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/make_vector.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map.cpp b/src/boost/libs/fusion/test/sequence/map.cpp
new file mode 100644
index 000000000..5a130f8b3
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map.cpp
@@ -0,0 +1,181 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/map/map.hpp>
+#include <boost/fusion/container/generation/make_map.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/iterator/deref_data.hpp>
+#include <boost/fusion/iterator/value_of_data.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <iostream>
+#include <string>
+
+
+struct copy_all
+{
+ copy_all() {}
+ copy_all(copy_all const&) {}
+
+ template <typename T>
+ copy_all(T const& x)
+ {
+ foo(x); // should fail!
+ }
+};
+
+struct abstract
+{
+ virtual void foo() = 0;
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+ namespace fusion = boost::fusion;
+ using boost::fusion::pair;
+ using boost::fusion::make_pair;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ typedef map<
+ pair<int, char>
+ , pair<double, std::string>
+ , pair<abstract, int> >
+ map_type;
+
+ BOOST_MPL_ASSERT((traits::is_associative<map_type>));
+ BOOST_MPL_ASSERT((traits::is_random_access<map_type>));
+
+ map_type m(
+ make_pair<int>('X')
+ , make_pair<double>("Men")
+ , make_pair<abstract>(2));
+
+ std::cout << at_key<int>(m) << std::endl;
+ std::cout << at_key<double>(m) << std::endl;
+ std::cout << at_key<abstract>(m) << std::endl;
+
+ BOOST_TEST(at_key<int>(m) == 'X');
+ BOOST_TEST(at_key<double>(m) == "Men");
+ BOOST_TEST(at_key<abstract>(m) == 2);
+
+ BOOST_STATIC_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_key<map_type, int>::type, char>::value));
+ BOOST_STATIC_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_key<map_type, double>::type, std::string>::value));
+ BOOST_STATIC_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_key<map_type, abstract>::type, int>::value));
+
+ std::cout << m << std::endl;
+
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, int>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, double>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, abstract>::value));
+ BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<map_type, std::string>::value));
+
+ std::cout << deref_data(begin(m)) << std::endl;
+ std::cout << deref_data(fusion::next(begin(m))) << std::endl;
+
+ BOOST_TEST(deref_data(begin(m)) == 'X');
+ BOOST_TEST(deref_data(fusion::next(begin(m))) == "Men");
+ BOOST_TEST(deref_data(fusion::next(next(begin(m)))) == 2);
+
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<map_type>::type>::type, int>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, double>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type>::type, abstract>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<map_type>::type>::type, char>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, std::string>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type>::type, int>::value));
+
+ // Test random access interface.
+ pair<int, char> a = at_c<0>(m); (void) a;
+ pair<double, std::string> b = at_c<1>(m);
+ pair<abstract, int> c = at_c<2>(m);
+ (void)c;
+ }
+
+ // iterators & random access interface.
+ {
+ typedef pair<boost::mpl::int_<0>, std::string> pair0;
+ typedef pair<boost::mpl::int_<1>, std::string> pair1;
+ typedef pair<boost::mpl::int_<2>, std::string> pair2;
+ typedef pair<boost::mpl::int_<3>, std::string> pair3;
+ typedef pair<boost::mpl::int_<4>, std::string> pair4;
+
+ typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
+ map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
+ BOOST_AUTO( it0, begin(m) );
+ BOOST_TEST((deref(it0) == pair0("zero")));
+ BOOST_AUTO( it1, fusion::next(it0) );
+ BOOST_TEST((deref(it1) == pair1("one")));
+ BOOST_AUTO( it2, fusion::next(it1) );
+ BOOST_TEST((deref(it2) == pair2("two")));
+ BOOST_AUTO( it3, fusion::next(it2) );
+ BOOST_TEST((deref(it3) == pair3("three")));
+ BOOST_AUTO( it4, fusion::next(it3) );
+ BOOST_TEST((deref(it4) == pair4("four")));
+
+ BOOST_TEST((deref(fusion::advance_c<4>(it0)) == deref(it4)));
+
+ // Bi-directional
+ BOOST_TEST((deref(fusion::prior(it4)) == deref(it3) ));
+ BOOST_TEST((deref(fusion::prior(it3)) == deref(it2) ));
+ BOOST_TEST((deref(fusion::prior(it2)) == deref(it1) ));
+ BOOST_TEST((deref(fusion::prior(it1)) == deref(it0) ));
+ }
+
+ {
+ std::cout << make_map<char, int>('X', 123) << std::endl;
+ BOOST_TEST(at_key<char>(make_map<char, int>('X', 123)) == 'X');
+ BOOST_TEST(at_key<int>(make_map<char, int>('X', 123)) == 123);
+ }
+
+ {
+ // test for copy construction of fusion pairs
+ // make sure that the correct constructor is called
+ pair<int, copy_all> p1;
+ pair<int, copy_all> p2 = p1;
+ (void)p2;
+ }
+
+ {
+ // compile test only
+ // make sure result_of::deref_data returns a reference
+ typedef map<pair<float, int> > map_type;
+ typedef boost::fusion::result_of::begin<map_type>::type i_type;
+ typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
+ BOOST_STATIC_ASSERT((boost::is_same<r_type, int&>::value));
+ }
+
+ {
+ // compile test only
+ // make sure result_of::deref_data is const correct
+ typedef map<pair<float, int> > const map_type;
+ typedef boost::fusion::result_of::begin<map_type>::type i_type;
+ typedef boost::fusion::result_of::deref_data<i_type>::type r_type;
+ BOOST_STATIC_ASSERT((boost::is_same<r_type, int const&>::value));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map_comparison.cpp b/src/boost/libs/fusion/test/sequence/map_comparison.cpp
new file mode 100644
index 000000000..63f395153
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_comparison.cpp
@@ -0,0 +1,68 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/map/map.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/comparison.hpp>
+
+struct key1 {};
+struct key2 {};
+struct key3 {};
+
+void
+equality_test()
+{
+ using namespace boost::fusion;
+
+ map<pair<key1, int>, pair<key2, char> > v1(5, 'a');
+ map<pair<key1, int>, pair<key2, char> > v2(5, 'a');
+ BOOST_TEST(v1 == v2);
+
+ map<pair<key1, int>, pair<key2, char> > v3(5, 'b');
+ map<pair<key1, int>, pair<key2, char> > t4(2, 'a');
+ BOOST_TEST(v1 != v3);
+ BOOST_TEST(v1 != t4);
+ BOOST_TEST(!(v1 != v2));
+
+ map<pair<key1, int>, pair<key2, char>, pair<key2, bool> > v5(5, 'a', true);
+ BOOST_TEST(v1 != v5);
+ BOOST_TEST(!(v1 == v5));
+ BOOST_TEST(v5 != v1);
+ BOOST_TEST(!(v5 == v1));
+}
+
+void
+ordering_test()
+{
+ using namespace boost::fusion;
+
+ map<pair<key1, int>, pair<key2, float> > v1(4, 3.3f);
+ map<pair<key1, short>, pair<key2, float> > v2(5, 3.3f);
+ map<pair<key1, long>, pair<key2, double> > v3(5, 4.4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+
+#if defined(FUSION_TEST_FAIL)
+ map<int, char, bool> v5(5, 'a', true);
+ v1 >= v5;
+#endif
+}
+
+int
+main()
+{
+ equality_test();
+ ordering_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/map_construction.cpp b/src/boost/libs/fusion/test/sequence/map_construction.cpp
new file mode 100644
index 000000000..9c03b4268
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_construction.cpp
@@ -0,0 +1,134 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/map/map.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+struct key1 {};
+struct key2 {};
+struct key3 {};
+
+namespace test_detail
+{
+ // something to prevent warnings for unused variables
+ template<class T> void dummy(const T&) {}
+
+ // no public default constructor
+ class foo
+ {
+ public:
+
+ explicit foo(int v) : val(v) {}
+
+ bool operator==(const foo& other) const
+ {
+ return val == other.val;
+ }
+
+ private:
+
+ foo() {}
+ int val;
+ };
+
+ // another class without a public default constructor
+ class no_def_constructor
+ {
+ no_def_constructor() {}
+
+ public:
+
+ no_def_constructor(std::string) {}
+ };
+}
+
+inline void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ nil empty;
+ (void)empty;
+
+ map<> empty0;
+ (void)empty0;
+
+#ifndef NO_CONSTRUCT_FROM_NIL
+ map<> empty1(empty);
+ (void)empty1;
+#endif
+
+ map<pair<key1, int> > t1;
+ BOOST_TEST(at_c<0>(t1).second == int());
+
+ map<pair<key1, float> > t2(5.5f);
+ BOOST_TEST(at_c<0>(t2).second > 5.4f && at_c<0>(t2).second < 5.6f);
+
+ map<pair<key1, foo> > t3(foo(12));
+ BOOST_TEST(at_c<0>(t3).second == foo(12));
+
+ map<pair<key1, double> > t4(t2);
+ BOOST_TEST(at_c<0>(t4).second > 5.4 && at_c<0>(t4).second < 5.6);
+
+ map<pair<key1, int>, pair<key2, float> > t5;
+ BOOST_TEST(at_c<0>(t5).second == int());
+ BOOST_TEST(at_c<1>(t5).second == float());
+
+ map<pair<key1, int>, pair<key2, float> > t6(12, 5.5f);
+ BOOST_TEST(at_c<0>(t6).second == 12);
+ BOOST_TEST(at_c<1>(t6).second > 5.4f && at_c<1>(t6).second < 5.6f);
+
+ map<pair<key1, int>, pair<key2, float> > t7(t6);
+ BOOST_TEST(at_c<0>(t7).second == 12);
+ BOOST_TEST(at_c<1>(t7).second > 5.4f && at_c<1>(t7).second < 5.6f);
+
+ map<pair<key1, long>, pair<key2, double> > t8(t6);
+ BOOST_TEST(at_c<0>(t8).second == 12);
+ BOOST_TEST(at_c<1>(t8).second > 5.4f && at_c<1>(t8).second < 5.6f);
+
+ dummy
+ (
+ map<
+ pair<key1, no_def_constructor>,
+ pair<key2, no_def_constructor>,
+ pair<key3, no_def_constructor> >
+ (
+ pair<key1, no_def_constructor>(std::string("Jaba")), // ok, since the default
+ pair<key2, no_def_constructor>(std::string("Daba")), // constructor is not used
+ pair<key3, no_def_constructor>(std::string("Doo"))
+ )
+ );
+
+ dummy(map<pair<key1, int>, pair<key2, double> >());
+ dummy(map<pair<key1, int>, pair<key2, double> >(1,3.14));
+
+#if defined(FUSION_TEST_FAIL)
+ dummy(map<pair<key1, double&> >()); // should fail, no defaults for references
+ dummy(map<pair<key1, const double&> >()); // likewise
+#endif
+
+ {
+ double dd = 5;
+ dummy(map<pair<key1, double&> >(pair<key1, double&>(dd))); // ok
+ dummy(map<pair<key1, const double&> >(pair<key1, const double&>(dd+3.14))); // ok, but dangerous
+ }
+
+#if defined(FUSION_TEST_FAIL)
+ dummy(map<pair<key1, double&> >(dd+3.14)); // should fail,
+ // temporary to non-const reference
+#endif
+}
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/map_copy.cpp b/src/boost/libs/fusion/test/sequence/map_copy.cpp
new file mode 100644
index 000000000..b8218bdf2
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_copy.cpp
@@ -0,0 +1,90 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/map/map.hpp>
+#include <boost/fusion/container/generation/make_map.hpp>
+#include <boost/fusion/container/generation/map_tie.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/mpl/insert_range.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/static_assert.hpp>
+#include <string>
+
+struct k1 {};
+struct k2 {};
+struct k3 {};
+struct k4 {};
+
+namespace test_detail
+{
+ // classes with different kinds of conversions
+ class AA {};
+ class BB : public AA {};
+ struct CC { CC() {} CC(const BB&) {} };
+ struct DD { operator CC() const { return CC(); }; };
+}
+
+boost::fusion::map<
+ boost::fusion::pair<k1, double>,
+ boost::fusion::pair<k2, double>,
+ boost::fusion::pair<k3, double>,
+ boost::fusion::pair<k4, double>
+>
+foo(int i)
+{
+ return boost::fusion::make_map<k1, k2, k3, k4>(i, i+1, i+2, i+3);
+}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ map<pair<k1, int>, pair<k2, char> > t1(4, 'a');
+ map<pair<k1, int>, pair<k2, char> > t2(5, 'b');
+ t2 = t1;
+ BOOST_TEST(at_c<0>(t1).second == at_c<0>(t2).second);
+ BOOST_TEST(at_c<1>(t1).second == at_c<1>(t2).second);
+
+ map<pair<k1, int>, pair<k2, char const*> > t4(4, "a");
+ map<pair<k1, long>, pair<k2, std::string> > t3(2, std::string("a"));
+ t3 = t4;
+ BOOST_TEST((double)at_c<0>(t4).second == at_c<0>(t3).second);
+ BOOST_TEST(at_c<1>(t4).second == at_c<1>(t3).second);
+
+ // testing copy and assignment with implicit conversions
+ // between elements testing tie
+
+ map<pair<k1, char>, pair<k2, BB*>, pair<k3, BB>, pair<k4, DD> > t;
+ map<pair<k1, int>, pair<k2, AA*>, pair<k3, CC>, pair<k4, CC> > a(t);
+ a = t;
+
+ int i; char c; double d;
+ map_tie<k1, k2, k3>(i, c, d) = make_map<k1, k2, k3>(1, 'a', 5.5);
+
+ BOOST_TEST(i==1);
+ BOOST_TEST(c=='a');
+ BOOST_TEST(d>5.4 && d<5.6);
+
+ // returning a map with conversion
+ foo(2);
+}
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map_misc.cpp b/src/boost/libs/fusion/test/sequence/map_misc.cpp
new file mode 100644
index 000000000..81da97539
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_misc.cpp
@@ -0,0 +1,179 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2013 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/container/map/map.hpp>
+#include <boost/fusion/container/map/convert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/mpl/find.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/integral_c.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <string>
+
+struct k1 {};
+struct k2 {};
+struct k3 {};
+struct k4 {};
+
+template <typename S1, typename S2>
+struct is_same
+{
+};
+
+namespace fn = boost::fusion;
+
+struct test_intrinsics1
+{
+ // test at, begin, end, next, prior, advance, size, deref, etc.
+
+ typedef fn::map<
+ fn::pair<k1, int>, fn::pair<k2, float>,
+ fn::pair<k3, bool>, fn::pair<k3, char> >
+ sequence;
+
+ typedef boost::mpl::begin<sequence>::type first;
+ typedef boost::mpl::next<first>::type second;
+ typedef boost::mpl::next<second>::type third;
+ typedef boost::mpl::next<third>::type fourth;
+ typedef boost::mpl::end<sequence>::type last;
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<first>::type, fn::pair<k1, int> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<second>::type, fn::pair<k2, float> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<third>::type, fn::pair<k3, bool> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<fourth>::type, fn::pair<k3, char> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::at_c<sequence, 2>::type, fn::pair<k3, bool> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::front<sequence>::type, fn::pair<k1, int> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<
+ boost::mpl::advance_c<second, 2>::type>::type, fn::pair<k3, char> >::value));
+
+ BOOST_STATIC_ASSERT((boost::mpl::size<sequence>::value == 4));
+ BOOST_STATIC_ASSERT(!(boost::mpl::empty<sequence>::value));
+ BOOST_STATIC_ASSERT((boost::mpl::distance<second, fourth>::value == 2));
+
+ typedef boost::mpl::prior<last>::type fourth_;
+ typedef boost::mpl::prior<fourth_>::type third_;
+ typedef boost::mpl::prior<third_>::type second_;
+ typedef boost::mpl::prior<second_>::type first_;
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<first_>::type, fn::pair<k1, int> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<second_>::type, fn::pair<k2, float> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<third_>::type, fn::pair<k3, bool> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<fourth_>::type, fn::pair<k3, char> >::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::back<sequence>::type, fn::pair<k3, char> >::value));
+
+};
+
+void
+test()
+{
+ using namespace boost::fusion;
+
+ { // testing const sequences
+
+ const map<pair<k1, int>, pair<k2, float> > t1(5, 3.3f);
+ BOOST_TEST(at_c<0>(t1).second == 5);
+ BOOST_TEST(at_c<1>(t1).second == 3.3f);
+ }
+
+ { // testing at<N> works with MPL integral constants
+ const map<pair<k1, int>, pair<k2, char> > t1(101, 'z');
+ BOOST_TEST(boost::fusion::at<boost::mpl::int_<0> >(t1).second == 101);
+ BOOST_TEST(boost::fusion::at<boost::mpl::int_<1> >(t1).second == 'z');
+ // explicitly try something other than mpl::int_
+ BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 0> >(t1).second == 101));
+ BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 1> >(t1).second == 'z'));
+ }
+
+ { // testing size & empty
+
+ typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
+ typedef map<> t2;
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<t1>::value == 3);
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<t2>::value == 0);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<t1>::value);
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<t2>::value);
+ }
+
+ { // testing front & back
+
+ typedef map<pair<k1, int>, pair<k2, float>, pair<k3, std::string> > tup;
+ tup t(1, 2.2f, std::string("Kimpo"));
+
+ BOOST_TEST(front(t).second == 1);
+ BOOST_TEST(back(t).second == "Kimpo");
+ }
+
+ { // testing is_sequence
+
+ typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
+ typedef map<> t2;
+ typedef map<pair<k1, char> > t3;
+
+ BOOST_STATIC_ASSERT(traits::is_sequence<t1>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t2>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t3>::value);
+ BOOST_STATIC_ASSERT(!traits::is_sequence<int>::value);
+ BOOST_STATIC_ASSERT(!traits::is_sequence<char>::value);
+ }
+
+ { // testing mpl::is_sequence
+
+ typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
+ typedef map<> t2;
+ typedef map<pair<k1, char> > t3;
+
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t1>::value);
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t2>::value);
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t3>::value);
+ }
+
+ { // testing mpl compatibility
+
+ // test an algorithm
+ typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
+ typedef boost::mpl::find<t1, pair<k2, float> >::type iter;
+ typedef boost::mpl::deref<iter>::type type;
+ BOOST_STATIC_ASSERT((boost::is_same<type, pair<k2, float> >::value));
+ }
+}
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map_move.cpp b/src/boost/libs/fusion/test/sequence/map_move.cpp
new file mode 100644
index 000000000..9f9dd004f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_move.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2012 Joel de Guzman
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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)
+==============================================================================*/
+#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+#include <boost/fusion/container/map/map.hpp>
+
+struct k1 {};
+struct k2 {};
+
+#define FUSION_SEQUENCE boost::fusion::map<boost::fusion::pair<k1, std::vector<x>>>
+
+#define FUSION_SEQUENCE2 boost::fusion::map< \
+ boost::fusion::pair<k1, std::vector<x>>, \
+ boost::fusion::pair<k2, x>>
+
+#include "move.hpp"
+
+int main()
+{
+ test();
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map_mutate.cpp b/src/boost/libs/fusion/test/sequence/map_mutate.cpp
new file mode 100644
index 000000000..afe78ad63
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_mutate.cpp
@@ -0,0 +1,69 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 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)
+==============================================================================*/
+#include <boost/fusion/container/map/map.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+struct k1 {};
+struct k2 {};
+struct k3 {};
+struct k4 {};
+
+namespace test_detail
+{
+ // no public default constructor
+ class foo
+ {
+ public:
+
+ explicit foo(int v) : val(v) {}
+
+ bool operator==(const foo& other) const
+ {
+ return val == other.val;
+ }
+
+ private:
+
+ foo() {}
+ int val;
+ };
+}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ map<
+ pair<k1, int>,
+ pair<k1, float>,
+ pair<k1, bool>,
+ pair<k1, foo>
+ > t1(5, 12.2f, true, foo(4));
+
+ at_c<0>(t1).second = 6;
+ at_c<1>(t1).second = 2.2f;
+ at_c<2>(t1).second = false;
+ at_c<3>(t1).second = foo(5);
+
+ BOOST_TEST(at_c<0>(t1).second == 6);
+ BOOST_TEST(at_c<1>(t1).second > 2.1f && at_c<1>(t1).second < 2.3f);
+ BOOST_TEST(at_c<2>(t1).second == false);
+ BOOST_TEST(at_c<3>(t1).second == foo(5));
+}
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/map_tie.cpp b/src/boost/libs/fusion/test/sequence/map_tie.cpp
new file mode 100644
index 000000000..a3547375f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/map_tie.cpp
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/container/generation/map_tie.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+
+struct key_zero;
+struct key_one;
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ int number = 101;
+ char letter = 'a';
+ BOOST_TEST(at_key<key_zero>(map_tie<key_zero, key_one>(number, letter)) == 101);
+ BOOST_TEST(at_key<key_one>(map_tie<key_zero, key_one>(number, letter)) == 'a');
+
+ BOOST_TEST(&at_key<key_zero>(map_tie<key_zero, key_one>(number, letter)) == &number);
+ BOOST_TEST(&at_key<key_one>(map_tie<key_zero, key_one>(number, letter)) == &letter);
+
+ at_key<key_zero>(map_tie<key_zero, key_one>(number, letter)) = 202;
+ at_key<key_one>(map_tie<key_zero, key_one>(number, letter)) = 'b';
+
+ BOOST_TEST(number == 202);
+ BOOST_TEST(letter == 'b');
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/misc.hpp b/src/boost/libs/fusion/test/sequence/misc.hpp
new file mode 100644
index 000000000..c426bba8a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/misc.hpp
@@ -0,0 +1,204 @@
+/*=============================================================================
+ Copyright (C) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/mpl/find.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/integral_c.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <string>
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+#if !defined(FUSION_SIZE)
+#define FUSION_SIZE boost::fusion::result_of::size
+#endif
+
+template <typename S1, typename S2>
+struct is_same
+{
+};
+
+struct test_intrinsics1
+{
+ // test at, begin, end, next, prior, advance, size, deref, etc.
+
+ typedef boost::fusion::FUSION_SEQUENCE<int, float, bool, char> sequence;
+ typedef boost::mpl::begin<sequence>::type first;
+ typedef boost::mpl::next<first>::type second;
+ typedef boost::mpl::next<second>::type third;
+ typedef boost::mpl::next<third>::type fourth;
+ typedef boost::mpl::end<sequence>::type last;
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<first>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<second>::type, float>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<third>::type, bool>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<fourth>::type, char>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::at_c<sequence, 2>::type, bool>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::front<sequence>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<
+ boost::mpl::advance_c<second, 2>::type>::type, char>::value));
+
+ BOOST_STATIC_ASSERT((boost::mpl::size<sequence>::value == 4));
+ BOOST_STATIC_ASSERT(!(boost::mpl::empty<sequence>::value));
+ BOOST_STATIC_ASSERT((boost::mpl::distance<second, fourth>::value == 2));
+
+#if !defined(FUSION_FORWARD_ONLY) // list has no back/prev
+
+ typedef boost::mpl::prior<last>::type fourth_;
+ typedef boost::mpl::prior<fourth_>::type third_;
+ typedef boost::mpl::prior<third_>::type second_;
+ typedef boost::mpl::prior<second_>::type first_;
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<first_>::type, int>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<second_>::type, float>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<third_>::type, bool>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::deref<fourth_>::type, char>::value));
+
+ BOOST_STATIC_ASSERT((boost::is_same<
+ boost::mpl::back<sequence>::type, char>::value));
+
+#endif
+};
+
+struct test_intrinsics2
+{
+ typedef boost::fusion::FUSION_SEQUENCE<> seq0;
+
+#if !defined(BOOST_FUSION_SEQUENCE_CONVERSION_IS_NOT_SEQUENCE__TYPE_PRESERVING)
+#if !defined(FUSION_FORWARD_ONLY) // list has no back/prev
+
+ typedef boost::fusion::FUSION_SEQUENCE<int> target1;
+ typedef boost::mpl::push_back<seq0, int>::type seq1;
+ BOOST_STATIC_ASSERT((boost::mpl::equal<seq1, target1>::value));
+
+ typedef boost::fusion::FUSION_SEQUENCE<int, double> target2;
+ typedef boost::mpl::push_back<seq1, double>::type seq2;
+ BOOST_STATIC_ASSERT((boost::mpl::equal<seq2, target2>::value));
+
+#endif
+
+ typedef boost::fusion::FUSION_SEQUENCE<int> target3;
+ typedef boost::mpl::push_front<seq0, int>::type seq3;
+ BOOST_STATIC_ASSERT((boost::mpl::equal<seq3, target3>::value));
+
+ typedef boost::fusion::FUSION_SEQUENCE<double, int> target4;
+ typedef boost::mpl::push_front<seq3, double>::type seq4;
+ BOOST_STATIC_ASSERT((boost::mpl::equal<seq4, target4>::value));
+
+#endif
+};
+
+void
+test()
+{
+ using namespace boost::fusion;
+
+ { // testing const sequences
+
+ const FUSION_SEQUENCE<int, float> t1(5, 3.3f);
+ BOOST_TEST(FUSION_AT<0>(t1) == 5);
+ BOOST_TEST(FUSION_AT<1>(t1) == 3.3f);
+ }
+
+ { // testing at<N> works with MPL integral constants
+ const FUSION_SEQUENCE<int, char> t1(101, 'z');
+ BOOST_TEST(boost::fusion::at<boost::mpl::int_<0> >(t1) == 101);
+ BOOST_TEST(boost::fusion::at<boost::mpl::int_<1> >(t1) == 'z');
+ // explicitly try something other than mpl::int_
+ BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 0> >(t1) == 101));
+ BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 1> >(t1) == 'z'));
+ }
+
+ { // testing size & empty
+
+ typedef FUSION_SEQUENCE<int, float, double> t1;
+ typedef FUSION_SEQUENCE<> t2;
+
+ BOOST_STATIC_ASSERT(FUSION_SIZE<t1>::value == 3);
+ BOOST_STATIC_ASSERT(FUSION_SIZE<t2>::value == 0);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<t1>::value);
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<t2>::value);
+ }
+
+ { // testing front & back
+
+ typedef FUSION_SEQUENCE<int, float, std::string> tup;
+ tup t(1, 2.2f, "Kimpo");
+
+ BOOST_TEST(front(t) == 1);
+#if !defined(FUSION_FORWARD_ONLY) // list has no back
+ BOOST_TEST(back(t) == "Kimpo");
+#endif
+ }
+
+ { // testing is_sequence
+
+ typedef FUSION_SEQUENCE<int, float, double> t1;
+ typedef FUSION_SEQUENCE<> t2;
+ typedef FUSION_SEQUENCE<char> t3;
+
+ BOOST_STATIC_ASSERT(traits::is_sequence<t1>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t2>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t3>::value);
+ BOOST_STATIC_ASSERT(!traits::is_sequence<int>::value);
+ BOOST_STATIC_ASSERT(!traits::is_sequence<char>::value);
+ }
+
+ { // testing mpl::is_sequence
+
+ typedef FUSION_SEQUENCE<int, float, double> t1;
+ typedef FUSION_SEQUENCE<> t2;
+ typedef FUSION_SEQUENCE<char> t3;
+
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t1>::value);
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t2>::value);
+ BOOST_STATIC_ASSERT(boost::mpl::is_sequence<t3>::value);
+ }
+
+ { // testing mpl compatibility
+
+ // test begin, end, next, prior, advance, size, deref, etc.
+ //~ typedef FUSION_SEQUENCE<int, float, bool, char> tuple_type;
+ //~ test_intrinsics1<tuple_type> test1;
+ //~ (void)test1; // prevent unused variable warning
+
+ // test an algorithm
+ typedef FUSION_SEQUENCE<int, float, double> t1;
+ typedef boost::mpl::find<t1, float>::type iter;
+ typedef boost::mpl::deref<iter>::type type;
+ BOOST_STATIC_ASSERT((boost::is_same<type, float>::value));
+
+ }
+}
diff --git a/src/boost/libs/fusion/test/sequence/move.hpp b/src/boost/libs/fusion/test/sequence/move.hpp
new file mode 100644
index 000000000..8636604f1
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/move.hpp
@@ -0,0 +1,120 @@
+/*=============================================================================
+ Copyright (c) 2012 Joel de Guzman
+
+ 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/config.hpp>
+
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#error "Valid only on compilers that support rvalues"
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/assert.hpp>
+#include <vector>
+
+
+namespace test_detail
+{
+ int copies = 0;
+
+ void incr_copy()
+ {
+ copies++;
+ }
+
+ struct x
+ {
+ int i;
+ x() : i(123) {}
+
+ x(x&& rhs) : i(rhs.i) {}
+
+ x& operator=(x&& rhs)
+ {
+ i = rhs.i;
+ return *this;
+ }
+
+ x(x const& /*rhs*/)
+ {
+ incr_copy();
+ }
+
+ x& operator=(x const& /*rhs*/)
+ {
+ incr_copy();
+ return *this;
+ }
+ };
+
+ typedef std::vector<x> vector_type;
+ extern bool disable_rvo; // to disable RVO
+
+ vector_type
+ generate_vec()
+ {
+ vector_type v;
+ v.push_back(x());
+ if (disable_rvo)
+ return v;
+ return vector_type();
+ }
+
+
+ template <typename T>
+ T move_me(T && val)
+ {
+ T r(std::move(val));
+ if (disable_rvo)
+ return r;
+ return T();
+ }
+
+ typedef FUSION_SEQUENCE return_type;
+
+ return_type
+ generate()
+ {
+ return_type r(generate_vec());
+ if (disable_rvo)
+ return r;
+ return return_type();
+ }
+
+ typedef FUSION_SEQUENCE2 return_type2;
+
+ return_type2
+ generate2()
+ {
+ return_type2 r(generate_vec(), x());
+ if (disable_rvo)
+ return r;
+ return return_type2();
+ }
+}
+
+void test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ return_type v = move_me(generate());
+ BOOST_TEST(copies == 0);
+
+ return_type2 v2 = move_me(generate2());
+ BOOST_TEST(copies == 0);
+
+ v2 = move_me(generate2());
+ BOOST_TEST(copies == 0);
+
+ std::cout << "Copies: " << copies << std::endl;
+}
+
+namespace test_detail
+{
+ bool disable_rvo = true;
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/mutate.hpp b/src/boost/libs/fusion/test/sequence/mutate.hpp
new file mode 100644
index 000000000..9bc9be8ac
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/mutate.hpp
@@ -0,0 +1,52 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+namespace test_detail
+{
+ // no public default constructor
+ class foo
+ {
+ public:
+
+ explicit foo(int v) : val(v) {}
+
+ bool operator==(const foo& other) const
+ {
+ return val == other.val;
+ }
+
+ private:
+
+ foo() {}
+ int val;
+ };
+}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ FUSION_SEQUENCE<int, float, bool, foo> t1(5, 12.2f, true, foo(4));
+ FUSION_AT<0>(t1) = 6;
+ FUSION_AT<1>(t1) = 2.2f;
+ FUSION_AT<2>(t1) = false;
+ FUSION_AT<3>(t1) = foo(5);
+
+ BOOST_TEST(FUSION_AT<0>(t1) == 6);
+ BOOST_TEST(FUSION_AT<1>(t1) > 2.1f && FUSION_AT<1>(t1) < 2.3f);
+ BOOST_TEST(FUSION_AT<2>(t1) == false);
+ BOOST_TEST(FUSION_AT<3>(t1) == foo(5));
+}
diff --git a/src/boost/libs/fusion/test/sequence/nest.hpp b/src/boost/libs/fusion/test/sequence/nest.hpp
new file mode 100644
index 000000000..76f3b4363
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/nest.hpp
@@ -0,0 +1,321 @@
+/*=============================================================================
+ Copyright (C) 2015 Kohei Takahshi
+
+ 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 <utility>
+#include <boost/config.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/fusion/include/as_deque.hpp>
+#include <boost/fusion/include/as_list.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/begin.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/value_of.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+#include "fixture.hpp"
+
+namespace test_detail
+{
+ struct adapted_sequence
+ {
+ adapted_sequence() : value_() {}
+ explicit adapted_sequence(int value) : value_(value) {}
+ int value_;
+ };
+
+ bool operator==(adapted_sequence const& lhs, adapted_sequence const& rhs)
+ {
+ return lhs.value_ == rhs.value_;
+ }
+
+ bool operator!=(adapted_sequence const& lhs, adapted_sequence const& rhs)
+ {
+ return lhs.value_ != rhs.value_;
+ }
+
+ template <template <typename> class Scenario>
+ struct can_convert_using
+ {
+ template <typename T>
+ struct to
+ {
+ static bool can_convert_(boost::true_type /* skip */)
+ {
+ return true;
+ }
+
+ static bool can_convert_(boost::false_type /* skip */)
+ {
+ using namespace boost::fusion;
+ return
+ run<Scenario<T> >(typename result_of::as_deque<T>::type()) &&
+ run<Scenario<T> >(typename result_of::as_list<T>::type()) &&
+ run<Scenario<T> >(typename result_of::as_vector<T>::type());
+ }
+
+ template <typename Source, typename Expected>
+ bool operator()(Source const&, Expected const&) const
+ {
+ // bug when converting single element sequences in C++03 and
+ // C++11...
+ // not_<not_<is_convertible<sequence<sequence<int>>, int >
+ // is invalid check
+ typedef typename ::boost::fusion::result_of::size<T>::type seq_size;
+ return can_convert_(
+ boost::integral_constant<bool, seq_size::value == 1>()
+ );
+ }
+ };
+ };
+
+ template <typename T>
+ struct can_construct_from_elements
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const&, Expected const&) const
+ {
+ // constructing a nested sequence of one is the complicated case to
+ // disambiguate from a conversion-copy, so focus on that
+ typedef typename boost::fusion::result_of::size<T>::type seq_size;
+ return can_construct_(
+ boost::integral_constant<int, seq_size::value>()
+ );
+ }
+
+ template <int Size>
+ static bool can_construct_(boost::integral_constant<int, Size>)
+ {
+ return Size == 0 || Size == 2 || Size == 3;
+ }
+
+ static bool can_construct_(boost::integral_constant<int, 1>)
+ {
+ typedef typename ::boost::remove_reference<
+ typename ::boost::remove_const<
+ typename ::boost::fusion::result_of::value_of<
+ typename ::boost::fusion::result_of::begin<T>::type
+ >::type
+ >::type
+ >::type element;
+
+ return run< can_construct<T> >(element(), T());
+ }
+ };
+
+ template <typename T>
+ struct can_nest
+ {
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected)
+ {
+ return
+ run< can_copy<T> >(source, expected) &&
+ run< can_convert_using<can_copy>::to<T> >(source, expected) &&
+ run< can_construct_from_elements<T> >(source, expected);
+ }
+ };
+} // test_detail
+
+
+BOOST_FUSION_ADAPT_STRUCT(test_detail::adapted_sequence, (int, data))
+
+template <template <typename> class Scenario>
+void
+test()
+{
+ using namespace test_detail;
+
+ BOOST_TEST(boost::fusion::traits::is_sequence<adapted_sequence>::value);
+ BOOST_TEST(boost::fusion::size(adapted_sequence()) == 1);
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE< FUSION_SEQUENCE<> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<> >()
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<>, int> > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<>, int>(FUSION_SEQUENCE<>(), 325)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, FUSION_SEQUENCE<> > > >(
+ FUSION_SEQUENCE< int, FUSION_SEQUENCE<> >(325, FUSION_SEQUENCE<>())
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<FUSION_SEQUENCE<int, FUSION_SEQUENCE<>, float> > >(
+ FUSION_SEQUENCE<int, FUSION_SEQUENCE<> , float>(
+ 325, FUSION_SEQUENCE<>(), 2.0f
+ )
+ )
+ ));
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE< FUSION_SEQUENCE<int> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int> >(FUSION_SEQUENCE<int>(400))
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<adapted_sequence> > >(
+ FUSION_SEQUENCE<adapted_sequence>(adapted_sequence(400))
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<int>, int> > >(
+ FUSION_SEQUENCE<FUSION_SEQUENCE<int>, int>(
+ FUSION_SEQUENCE<int>(325), 400
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<FUSION_SEQUENCE<adapted_sequence, int> > >(
+ FUSION_SEQUENCE<adapted_sequence, int>(adapted_sequence(325), 400)
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE< int, FUSION_SEQUENCE<int> > > >(
+ FUSION_SEQUENCE< int, FUSION_SEQUENCE<int> >(
+ 325, FUSION_SEQUENCE<int>(400)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, adapted_sequence> > >(
+ FUSION_SEQUENCE<int, adapted_sequence>(325, adapted_sequence(450))
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, FUSION_SEQUENCE<int>, int> > >(
+ FUSION_SEQUENCE<int, FUSION_SEQUENCE<int>, int>(
+ 500, FUSION_SEQUENCE<int>(350), 200
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<int, adapted_sequence, int> > >(
+ FUSION_SEQUENCE<int, adapted_sequence, int>(
+ 300, adapted_sequence(500), 400)
+ )
+ ));
+
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE< FUSION_SEQUENCE<int, int> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int, int> >(
+ FUSION_SEQUENCE<int, int>(450, 500)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE<FUSION_SEQUENCE<int, int>, int> > >(
+ FUSION_SEQUENCE<FUSION_SEQUENCE<int, int>, int>(
+ FUSION_SEQUENCE<int, int>(450, 500), 150
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario< FUSION_SEQUENCE< int, FUSION_SEQUENCE<int, int> > > >(
+ FUSION_SEQUENCE< int, FUSION_SEQUENCE<int, int> >(
+ 450, FUSION_SEQUENCE<int, int>(500, 150)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run<Scenario< FUSION_SEQUENCE<int, FUSION_SEQUENCE<int, int>, int> > >(
+ FUSION_SEQUENCE<int, FUSION_SEQUENCE<int, int>, int>(
+ 150, FUSION_SEQUENCE<int, int>(250, 350), 450
+ )
+ )
+ ));
+
+ BOOST_TEST((
+ run<Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<>, FUSION_SEQUENCE<> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<>, FUSION_SEQUENCE<> >(
+ FUSION_SEQUENCE<>(), FUSION_SEQUENCE<>()
+ )
+ )
+ ));
+ BOOST_TEST((
+ run<Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<int>, FUSION_SEQUENCE<> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int>, FUSION_SEQUENCE<> >(
+ FUSION_SEQUENCE<int>(150), FUSION_SEQUENCE<>()
+ )
+ )
+ ));
+ BOOST_TEST((
+ run<Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<>, FUSION_SEQUENCE<int> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<>, FUSION_SEQUENCE<int> >(
+ FUSION_SEQUENCE<>(), FUSION_SEQUENCE<int>(500)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run<Scenario<FUSION_SEQUENCE<FUSION_SEQUENCE<int>, FUSION_SEQUENCE<int> > > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int>, FUSION_SEQUENCE<int> >(
+ FUSION_SEQUENCE<int>(155), FUSION_SEQUENCE<int>(255)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int> >
+ > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int> >(
+ FUSION_SEQUENCE<int, int>(222, 333), FUSION_SEQUENCE<int>(444)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int>, FUSION_SEQUENCE<int, int> >
+ > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int>, FUSION_SEQUENCE<int, int> >(
+ FUSION_SEQUENCE<int>(100), FUSION_SEQUENCE<int, int>(300, 400)
+ )
+ )
+ ));
+ BOOST_TEST((
+ run< Scenario<
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int, int> >
+ > >(
+ FUSION_SEQUENCE< FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int, int> >(
+ FUSION_SEQUENCE<int, int>(600, 700)
+ , FUSION_SEQUENCE<int, int>(800, 900)
+ )
+ )
+ ));
+
+
+ // Ignore desired scenario, and cheat to make these work
+ BOOST_TEST((
+ run< can_lvalue_construct< FUSION_SEQUENCE<FUSION_SEQUENCE<>&> > >(
+ FUSION_SEQUENCE<>()
+ , FUSION_SEQUENCE< FUSION_SEQUENCE<> >()
+ )
+ ));
+ BOOST_TEST((
+ run< can_construct< FUSION_SEQUENCE<const FUSION_SEQUENCE<>&> > >(
+ FUSION_SEQUENCE<>()
+ , FUSION_SEQUENCE< FUSION_SEQUENCE<> >()
+ )
+ ));
+ BOOST_TEST((
+ run< can_lvalue_construct< FUSION_SEQUENCE<FUSION_SEQUENCE<int>&> > >(
+ FUSION_SEQUENCE<int>(300)
+ , FUSION_SEQUENCE< FUSION_SEQUENCE<int> >(FUSION_SEQUENCE<int>(300))
+ )
+ ));
+ BOOST_TEST((
+ run< can_construct< FUSION_SEQUENCE<const FUSION_SEQUENCE<int>&> > >(
+ FUSION_SEQUENCE<int>(400)
+ , FUSION_SEQUENCE< FUSION_SEQUENCE<int> >(FUSION_SEQUENCE<int>(400))
+ )
+ ));
+}
diff --git a/src/boost/libs/fusion/test/sequence/nil.cpp b/src/boost/libs/fusion/test/sequence/nil.cpp
new file mode 100644
index 000000000..bdc8c3528
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/nil.cpp
@@ -0,0 +1,25 @@
+/*=============================================================================
+ Copyright (c) 2014 Louis Dionne
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/list/cons_iterator.hpp>
+#include <boost/fusion/container/list/nil.hpp>
+#include <boost/fusion/support/config.hpp>
+#include <boost/mpl/bool.hpp>
+
+
+int main() {
+ using namespace boost::fusion;
+
+ // nil should be constexpr constructible
+ {
+ BOOST_CONSTEXPR nil x1 = nil();
+ BOOST_CONSTEXPR nil x2 = nil(nil_iterator(), boost::mpl::true_());
+ (void)x1; (void)x2;
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/nview.cpp b/src/boost/libs/fusion/test/sequence/nview.cpp
new file mode 100644
index 000000000..dab982a52
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/nview.cpp
@@ -0,0 +1,139 @@
+/*=============================================================================
+ Copyright (c) 2009 Hartmut Kaiser
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/struct.hpp>
+#include <boost/fusion/include/equal_to.hpp>
+#include <boost/fusion/include/io.hpp>
+#include <boost/fusion/include/nview.hpp>
+
+#include <string>
+#include <iostream>
+
+struct test {
+ int int_;
+ std::string string_;
+ double double_;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(
+ test,
+ (int, int_)
+ (std::string, string_)
+ (double, double_)
+)
+
+namespace fusion = boost::fusion;
+
+template <typename Sequence>
+bool check_size(Sequence const& s, int seqsize)
+{
+ return fusion::size(s) == seqsize;
+}
+
+template <typename Sequence, typename T>
+bool check_deref_begin(Sequence const& s, T val)
+{
+ return fusion::deref(fusion::begin(s)) == val;
+}
+
+template <typename Sequence, typename T>
+bool check_deref_next(Sequence const& s, T val)
+{
+ return fusion::deref(fusion::next(fusion::begin(s))) == val;
+}
+
+template <int N, typename Sequence, typename T>
+bool check_deref_advance(Sequence const& s, T val)
+{
+ return fusion::deref(fusion::advance_c<N>(fusion::begin(s))) == val;
+}
+
+template <typename Sequence, typename T>
+bool check_deref_prior(Sequence const& s, T val)
+{
+ return fusion::deref(fusion::prior(fusion::end(s))) == val;
+}
+
+template <int N, typename Sequence, typename T>
+bool check_at(Sequence const& s, T val)
+{
+ return fusion::at_c<N>(s) == val;
+}
+
+template <typename Sequence>
+bool check_distance(Sequence const& s, int val)
+{
+ return fusion::distance(fusion::begin(s), fusion::end(s)) == val;
+}
+
+int main()
+{
+ test t;
+ t.int_ = 1;
+ t.string_ = "test";
+ t.double_ = 2.0;
+
+ using fusion::as_nview;
+
+ // check size()
+ {
+ BOOST_TEST(check_size(as_nview<0>(t), 1));
+ BOOST_TEST(check_size(as_nview<2, 1>(t), 2));
+ BOOST_TEST(check_size(as_nview<2, 1, 0>(t), 3));
+ BOOST_TEST(check_size(as_nview<2, 1, 0, 2, 0>(t), 5));
+ }
+
+ // check deref/begin
+ {
+ BOOST_TEST(check_deref_begin(as_nview<0>(t), 1));
+ BOOST_TEST(check_deref_begin(as_nview<2, 1>(t), 2.0));
+ BOOST_TEST(check_deref_begin(as_nview<1, 2, 0>(t), "test"));
+ BOOST_TEST(check_deref_begin(as_nview<2, 1, 0, 2, 0>(t), 2.0));
+ }
+
+ // check deref/next
+ {
+ BOOST_TEST(check_deref_next(as_nview<2, 1>(t), "test"));
+ BOOST_TEST(check_deref_next(as_nview<1, 2, 0>(t), 2.0));
+ BOOST_TEST(check_deref_next(as_nview<2, 0, 1, 2, 0>(t), 1));
+ }
+
+ // check deref/advance
+ {
+ BOOST_TEST(check_deref_advance<0>(as_nview<2, 1>(t), 2.0));
+ BOOST_TEST(check_deref_advance<2>(as_nview<1, 2, 0>(t), 1));
+ BOOST_TEST(check_deref_advance<4>(as_nview<2, 0, 1, 2, 0>(t), 1));
+ }
+
+ // check deref/prior
+ {
+ BOOST_TEST(check_deref_prior(as_nview<2, 1>(t), "test"));
+ BOOST_TEST(check_deref_prior(as_nview<1, 2, 0>(t), 1));
+ BOOST_TEST(check_deref_prior(as_nview<2, 0, 1, 2, 0>(t), 1));
+ }
+
+ // check at
+ {
+ BOOST_TEST(check_at<0>(as_nview<0>(t), 1));
+ BOOST_TEST(check_at<1>(as_nview<2, 1>(t), "test"));
+ BOOST_TEST(check_at<2>(as_nview<1, 2, 0>(t), 1));
+ BOOST_TEST(check_at<4>(as_nview<2, 1, 0, 2, 0>(t), 1));
+ }
+
+ // check distance
+ {
+ BOOST_TEST(check_distance(as_nview<0>(t), 1));
+ BOOST_TEST(check_distance(as_nview<2, 1>(t), 2));
+ BOOST_TEST(check_distance(as_nview<1, 2, 0>(t), 3));
+ BOOST_TEST(check_distance(as_nview<2, 1, 0, 2, 0>(t), 5));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/ref_vector.cpp b/src/boost/libs/fusion/test/sequence/ref_vector.cpp
new file mode 100644
index 000000000..8bd0929b8
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/ref_vector.cpp
@@ -0,0 +1,64 @@
+/*=============================================================================
+ Copyright (c) 2012 Joel falcou
+
+ 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 <iostream>
+#include <boost/mpl/transform.hpp>
+#include <boost/fusion/include/mpl.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+
+struct foo
+{
+ double d; float f; short c;
+};
+
+BOOST_FUSION_ADAPT_STRUCT(foo,(double,d)(float,f)(short,c))
+
+template<class T>
+class composite_reference
+ : public boost::mpl::
+ transform < typename boost::fusion::result_of::
+ as_vector<T>::type
+ , boost::add_reference<boost::mpl::_>
+ >::type
+{
+ public:
+ typedef typename boost::mpl::
+ transform < typename boost::fusion::result_of::
+ as_vector<T>::type
+ , boost::add_reference<boost::mpl::_>
+ >::type parent;
+
+ composite_reference(T& src) : parent( src ) {}
+ composite_reference(parent& src) : parent(src) {}
+
+ composite_reference& operator=(T& src)
+ {
+ static_cast<parent&>(*this) = static_cast<parent&>(src);
+ return *this;
+ }
+
+ composite_reference& operator=(parent const& src)
+ {
+ static_cast<parent&>(*this) = src;
+ return *this;
+ }
+};
+
+int main(int,char**)
+{
+ foo f;
+ composite_reference<foo> ref_f(f);
+
+ boost::fusion::at_c<0>(ref_f) = 1.2;
+ boost::fusion::at_c<1>(ref_f) = 1.2f;
+ boost::fusion::at_c<2>(ref_f) = 12;
+
+ std::cout << f.d << " " << f.f << " " << f.c << "\n";
+}
diff --git a/src/boost/libs/fusion/test/sequence/repetitive_view.cpp b/src/boost/libs/fusion/test/sequence/repetitive_view.cpp
new file mode 100644
index 000000000..54da37bc8
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/repetitive_view.cpp
@@ -0,0 +1,53 @@
+/*=============================================================================
+ Copyright (c) 2007 Tobias Schwinger
+
+ 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).
+==============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/view/repetitive_view.hpp>
+
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/view/joint_view.hpp>
+#include <boost/fusion/algorithm/transformation/zip.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/iterator/next.hpp>
+
+#include <boost/fusion/functional/generation/make_fused_procedure.hpp>
+
+struct check_equal
+{
+ template<typename LHS, typename RHS>
+ void operator()(LHS const& lhs, RHS const& rhs) const
+ {
+ BOOST_TEST(( boost::is_same<LHS,RHS>::value ));
+ BOOST_TEST(( lhs == rhs ));
+ }
+};
+
+int main()
+{
+ using namespace boost::fusion;
+
+ typedef boost::fusion::vector<int,long,float,double> seq_t;
+ seq_t seq(1,2l,3.0f,4.0);
+
+ typedef repetitive_view<seq_t> view_t;
+ view_t view(seq);
+
+ typedef joint_view<seq_t,seq_t> seq_twice_t;
+ typedef joint_view<seq_t,seq_twice_t> seq_repeated_t;
+ seq_twice_t seq_twice(seq,seq);
+ seq_repeated_t seq_repeated(seq,seq_twice);
+
+ for_each(zip(view,seq_repeated), make_fused_procedure(check_equal()));
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/reverse_view.cpp b/src/boost/libs/fusion/test/sequence/reverse_view.cpp
new file mode 100644
index 000000000..fb96275d2
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/reverse_view.cpp
@@ -0,0 +1,109 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/map/map.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/view/reverse_view/reverse_view.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/range_c.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing the reverse_view
+
+ {
+ typedef boost::mpl::range_c<int, 5, 9> mpl_list1;
+ mpl_list1 l;
+ reverse_view<mpl_list1> rev(l);
+
+ std::cout << rev << std::endl;
+ BOOST_TEST((rev == make_vector(8, 7, 6, 5)));
+ }
+
+ {
+ char const* s = "Hi Kim";
+ typedef vector<int, char, long, char const*> vector_type;
+ vector_type t(123, 'x', 123456789, s);
+ typedef reverse_view<vector_type> view_type;
+ view_type rev(t);
+
+ std::cout << rev << std::endl;
+ BOOST_TEST((rev == make_vector(s, 123456789, 'x', 123)));
+
+ typedef boost::fusion::result_of::begin<view_type>::type first_type;
+ first_type first_it(begin(rev));
+ typedef boost::fusion::result_of::next<first_type>::type second_type;
+ second_type second_it(next(first_it));
+ BOOST_TEST((*second_it == 123456789));
+ BOOST_TEST((*prior(second_it) == s));
+ BOOST_TEST((*advance_c<2>(first_it) == 'x'));
+ BOOST_TEST((distance(first_it, second_it) == 1));
+
+ BOOST_TEST((at_c<0>(rev)==s));
+ BOOST_TEST((at_c<1>(rev)==123456789));
+ BOOST_TEST((at_c<2>(rev)=='x'));
+ BOOST_TEST((at_c<3>(rev)==123));
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_c<view_type,0>::type,char const*>
+ ));
+ BOOST_MPL_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_c<view_type,1>::type,long>
+ ));
+ BOOST_MPL_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_c<view_type,2>::type,char>
+ ));
+ BOOST_MPL_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_c<view_type,3>::type,int>
+ ));
+ }
+
+ //! Map
+ {
+ typedef pair<boost::mpl::int_<0>, std::string> pair0;
+ typedef pair<boost::mpl::int_<1>, std::string> pair1;
+ typedef pair<boost::mpl::int_<2>, std::string> pair2;
+ typedef pair<boost::mpl::int_<3>, std::string> pair3;
+ typedef pair<boost::mpl::int_<4>, std::string> pair4;
+
+ typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
+ map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
+ typedef reverse_view<map_type> view_type;
+ view_type rev(m);
+ std::cout << rev << std::endl;
+ BOOST_TEST((rev == make_vector( pair4("four"), pair3("three"), pair2("two"), pair1("one"), pair0("zero"))));
+ BOOST_TEST((at_c<0>(rev) == pair4("four")));
+ BOOST_TEST((at_c<1>(rev) == pair3("three")));
+ BOOST_TEST((at_c<2>(rev) == pair2("two")));
+ BOOST_TEST((at_c<3>(rev) == pair1("one")));
+ BOOST_TEST((at_c<4>(rev) == pair0("zero")));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/segmented_iterator_range.cpp b/src/boost/libs/fusion/test/sequence/segmented_iterator_range.cpp
new file mode 100644
index 000000000..df49407a6
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/segmented_iterator_range.cpp
@@ -0,0 +1,146 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+
+ 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 <sstream>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/algorithm/iteration/for_each.hpp>
+#include <boost/fusion/algorithm/query/find_if.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/view/iterator_range/iterator_range.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/static_assert.hpp>
+#include "tree.hpp"
+
+struct ostream_fun
+{
+ ostream_fun(std::ostream &sout)
+ : sout_(sout)
+ {}
+ template<typename T>
+ void operator ()(T const &t) const
+ {
+ sout_ << t << ' ';
+ }
+private:
+ std::ostream & sout_;
+};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+ using namespace fusion;
+ using mpl::_;
+
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
+
+ typedef iterator_range<short_iter, float_iter> slice_t;
+ BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);
+
+ // find_if of a segmented data structure returns generic
+ // segmented iterators
+ short_iter si = find_if<is_same<_,short> >(tree);
+ float_iter fi = find_if<is_same<_,float> >(tree);
+
+ // If you put them in an iterator range, the range
+ // is automatically a segmented data structure.
+ slice_t slice(si, fi);
+
+ std::stringstream sout;
+ fusion::for_each(slice, ostream_fun(sout));
+ BOOST_TEST((sout.str() == "100 e f 0 B "));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type vec(1, 'x', 3.3, s);
+
+ {
+ typedef vector_iterator<vector_type, 1> i1t;
+ typedef vector_iterator<vector_type, 3> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector('x', 3.3)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ typedef vector_iterator<vector_type, 0> i1t;
+ typedef vector_iterator<vector_type, 0> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST(slice == make_vector());
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ typedef boost::mpl::begin<mpl_vec>::type it0;
+ typedef boost::mpl::next<it0>::type it1;
+ typedef boost::mpl::next<it1>::type it2;
+ typedef boost::mpl::next<it2>::type it3;
+
+ it1 f;
+ it3 l;
+
+ typedef iterator_range<it1, it3> slice_t;
+ slice_t slice(f, l);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector(3, 4)));
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/set.cpp b/src/boost/libs/fusion/test/sequence/set.cpp
new file mode 100644
index 000000000..714c36cda
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/set.cpp
@@ -0,0 +1,110 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/set/set.hpp>
+#include <boost/fusion/container/generation/make_set.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
+#include <boost/fusion/sequence/intrinsic/has_key.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/iterator/key_of.hpp>
+#include <boost/fusion/iterator/deref_data.hpp>
+#include <boost/fusion/iterator/value_of_data.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <iostream>
+#include <string>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+ namespace fusion = boost::fusion;
+ using boost::fusion::pair;
+ using boost::fusion::make_pair;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ typedef set<int, std::string> set_type;
+
+ BOOST_MPL_ASSERT((traits::is_associative<set_type>));
+
+ set_type m(123, "Hola");
+
+ std::cout << at_key<int>(m) << std::endl;
+ std::cout << at_key<std::string>(m) << std::endl;
+
+ BOOST_TEST(at_key<int>(m) == 123);
+ BOOST_TEST(at_key<std::string>(m) == "Hola");
+
+ BOOST_STATIC_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_key<set_type, int>::type, int>::value));
+ BOOST_STATIC_ASSERT((
+ boost::is_same<boost::fusion::result_of::value_at_key<set_type, std::string>::type, std::string>::value));
+
+ std::cout << m << std::endl;
+
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, int>::value));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, std::string>::value));
+ BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<set_type, double>::value));
+
+ std::cout << deref_data(begin(m)) << std::endl;
+ std::cout << deref_data(fusion::next(begin(m))) << std::endl;
+
+ BOOST_TEST(deref_data(begin(m)) == 123);
+ BOOST_TEST(deref_data(fusion::next(begin(m))) == "Hola");
+
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
+ }
+
+ {
+ std::cout << make_set('X', 123) << std::endl;
+ BOOST_TEST(at_key<char>(make_set('X', 123)) == 'X');
+ BOOST_TEST(at_key<int>(make_set('X', 123)) == 123);
+ }
+
+ { // testing is_sequence
+
+ typedef set<int, float, double> t1;
+ typedef set<> t2;
+ typedef set<char> t3;
+
+ BOOST_MPL_ASSERT((traits::is_sequence<t1>));
+ BOOST_MPL_ASSERT((traits::is_sequence<t2>));
+ BOOST_MPL_ASSERT((traits::is_sequence<t3>));
+ BOOST_STATIC_ASSERT(traits::is_sequence<t1>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t2>::value);
+ BOOST_STATIC_ASSERT(traits::is_sequence<t3>::value);
+ }
+
+ { // testing mpl::is_sequence
+
+ typedef set<int, float, double> t1;
+ typedef set<> t2;
+ typedef set<char> t3;
+
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<t1>));
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<t2>));
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<t3>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/single_view.cpp b/src/boost/libs/fusion/test/sequence/single_view.cpp
new file mode 100644
index 000000000..6fa517551
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/single_view.cpp
@@ -0,0 +1,93 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/view/single_view/single_view.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct X {};
+
+template <typename OS>
+OS& operator<<(OS& os, X const&)
+{
+ os << "<X-object>";
+ return os;
+}
+
+void foo() {}
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ single_view<int> view1(3);
+ std::cout << view1 << std::endl;
+
+#ifdef FUSION_TEST_FAIL
+ // single_view is immutable
+ *begin(view1) += 4;
+#endif
+ std::cout << view1 << std::endl;
+ BOOST_TEST(*begin(view1) == 3);
+ BOOST_TEST(at<boost::mpl::int_<0> >(view1) == 3);
+ BOOST_TEST(view1.val == 3);
+ BOOST_TEST(3 == front(view1));
+ BOOST_TEST(3 == back(view1));
+ BOOST_TEST(!empty(view1));
+ BOOST_TEST(next(begin(view1)) == end(view1));
+ BOOST_TEST(prior(end(view1)) == begin(view1));
+ BOOST_TEST(!(next(begin(view1)) != end(view1)));
+ BOOST_TEST(!(prior(end(view1)) != begin(view1)));
+ BOOST_TEST(1 == distance(begin(view1), end(view1)));
+ BOOST_TEST(0 == distance(end(view1), end(view1)));
+ BOOST_TEST(0 == distance(begin(view1), begin(view1)));
+ BOOST_TEST(end(view1) == advance<boost::mpl::int_<1> >(begin(view1)));
+ BOOST_TEST(begin(view1) == advance<boost::mpl::int_<0> >(begin(view1)));
+ BOOST_TEST(end(view1) == advance<boost::mpl::int_<0> >(end(view1)));
+ BOOST_TEST(begin(view1) == advance<boost::mpl::int_<-1> >(end(view1)));
+ BOOST_TEST(end(view1) == advance_c<1>(begin(view1)));
+ BOOST_TEST(begin(view1) == advance_c<0>(begin(view1)));
+ BOOST_TEST(end(view1) == advance_c<0>(end(view1)));
+ BOOST_TEST(begin(view1) == advance_c<-1>(end(view1)));
+ BOOST_TEST(1 == size(view1));
+ BOOST_MPL_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at<single_view<int>, boost::mpl::int_<0> >::type>));
+
+ single_view<X> view2;
+ std::cout << view2 << std::endl;
+ }
+
+ {
+ std::cout << make_single_view(1) << std::endl;
+ std::cout << make_single_view("Hello, World") << std::endl;
+ std::cout << make_single_view(&foo) << std::endl;
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/size.cpp b/src/boost/libs/fusion/test/sequence/size.cpp
new file mode 100644
index 000000000..8c4c5a55b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/size.cpp
@@ -0,0 +1,103 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/config.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/deque.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/set.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/assert.hpp>
+
+#include <boost/array.hpp>
+#include <boost/fusion/adapted/boost_array.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/fusion/adapted/boost_tuple.hpp>
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
+ !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include <tuple>
+#include <boost/fusion/adapted/std_tuple.hpp>
+#endif
+
+template <typename LHS, typename RHS>
+void check_(LHS const&, RHS const&)
+{
+ BOOST_MPL_ASSERT((boost::is_same<LHS, RHS>));
+}
+
+template <typename S>
+void check()
+{
+ check_(
+ boost::fusion::result_of::size<S>::type::value
+ , boost::fusion::result_of::size<S>::value
+ );
+}
+
+void test()
+{
+ {
+ check<boost::fusion::vector<> >();
+ check<boost::fusion::vector<int> >();
+ check<boost::fusion::vector<int, int> >();
+ check<boost::fusion::vector<int, int, int> >();
+ }
+
+ {
+ check<boost::fusion::deque<> >();
+ check<boost::fusion::deque<int> >();
+ check<boost::fusion::deque<int, int> >();
+ check<boost::fusion::deque<int, int, int> >();
+ }
+
+ {
+ check<boost::fusion::list<> >();
+ check<boost::fusion::list<int> >();
+ check<boost::fusion::list<int, int> >();
+ check<boost::fusion::list<int, int, int> >();
+ }
+
+ {
+ check<boost::fusion::set<> >();
+ check<boost::fusion::set<int> >();
+ check<boost::fusion::set<int, float> >();
+ check<boost::fusion::set<int, float, double> >();
+ }
+
+ {
+ check<boost::fusion::map<> >();
+ check<boost::fusion::map<boost::fusion::pair<int, int> > >();
+ check<boost::fusion::map<boost::fusion::pair<int, int> , boost::fusion::pair<float, int> > >();
+ check<boost::fusion::map<boost::fusion::pair<int, int> , boost::fusion::pair<float, int> , boost::fusion::pair<double, int> > >();
+ }
+
+ {
+ check<boost::array<int, 1> >();
+ check<boost::array<int, 2> >();
+ check<boost::array<int, 3> >();
+ }
+
+ {
+ check<boost::tuples::tuple<> >();
+ check<boost::tuples::tuple<int> >();
+ check<boost::tuples::tuple<int, int> >();
+ check<boost::tuples::tuple<int, int, int> >();
+ }
+
+#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
+ !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ {
+ check<std::tuple<> >();
+ check<std::tuple<int> >();
+ check<std::tuple<int, int> >();
+ check<std::tuple<int, int, int> >();
+ }
+#endif
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/std_array.cpp b/src/boost/libs/fusion/test/sequence/std_array.cpp
new file mode 100644
index 000000000..50e09b398
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/std_array.cpp
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2013 Mateusz Loskot <mateusz@loskot.net>
+//
+// 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/config.hpp>
+
+#ifdef BOOST_NO_CXX11_HDR_ARRAY
+# error "does not meet requirements"
+#endif
+
+#ifdef BOOST_MSVC
+#pragma warning(disable:4180)
+#endif
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/fusion/adapted/std_array.hpp>
+#include <array>
+
+#include <boost/fusion/sequence/intrinsic.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/fusion/iterator.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ typedef std::array<int,3> array_type;
+
+ BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
+ BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
+ BOOST_STATIC_ASSERT(traits::is_sequence<array_type>::value);
+ BOOST_STATIC_ASSERT(!traits::is_view<array_type>::value);
+
+ array_type arr = {{1,2,3}};
+
+ BOOST_TEST(*boost::fusion::begin(arr) == 1);
+ BOOST_TEST(*boost::fusion::next(boost::fusion::begin(arr)) == 2);
+ BOOST_TEST(*advance_c<2>(boost::fusion::begin(arr)) == 3);
+ BOOST_TEST(prior(boost::fusion::next(boost::fusion::begin(arr))) == boost::fusion::begin(arr));
+ BOOST_TEST(*prior(boost::fusion::end(arr)) == 3);
+ BOOST_TEST(at_c<2>(arr) == 3);
+ BOOST_TEST(boost::fusion::size(arr) == 3);
+ BOOST_TEST(distance(boost::fusion::begin(arr), boost::fusion::end(arr)) == 3);
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/std_pair.cpp b/src/boost/libs/fusion/test/sequence/std_pair.cpp
new file mode 100644
index 000000000..647e9b00c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/std_pair.cpp
@@ -0,0 +1,100 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/std_pair.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/assert.hpp>
+#include <iostream>
+#include <string>
+#include <utility>
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ typedef std::pair<int, std::string> pair_type;
+ BOOST_MPL_ASSERT_NOT((traits::is_view<pair_type>));
+ BOOST_STATIC_ASSERT(!traits::is_view<pair_type>::value);
+ pair_type p(123, "Hola!!!");
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, "Hola!!!"));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = "mama mia";
+ BOOST_TEST(p == make_vector(6, "mama mia"));
+
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<pair_type>::value == 2);
+ BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<pair_type>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == "mama mia");
+ }
+
+ {
+ fusion::vector<int, float> v1(4, 3.3f);
+ std::pair<short, float> v2(5, 3.3f);
+ fusion::vector<long, double> v3(5, 4.4);
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
+ // conversion from pair to vector
+ fusion::vector<int, std::string> v(std::make_pair(123, "Hola!!!"));
+ v = std::make_pair(123, "Hola!!!");
+ }
+
+ {
+ // conversion from pair to list
+ fusion::list<int, std::string> l(std::make_pair(123, "Hola!!!"));
+ l = std::make_pair(123, "Hola!!!");
+ }
+
+ {
+ typedef std::pair<int, std::string> pair_type;
+ BOOST_MPL_ASSERT((mpl::is_sequence<pair_type>));
+ BOOST_MPL_ASSERT((boost::is_same<int, mpl::front<pair_type>::type>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/std_tuple.cpp b/src/boost/libs/fusion/test/sequence/std_tuple.cpp
new file mode 100644
index 000000000..3d7110710
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/std_tuple.cpp
@@ -0,0 +1,37 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/config.hpp>
+
+// adapted/std_tuple.hpp only supports implementations using variadic templates
+#if defined(BOOST_NO_CXX11_HDR_TUPLE) || \
+ defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+# error "does not meet requirements"
+#endif
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/std_tuple.hpp>
+#include <boost/fusion/sequence/convert.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <tuple>
+#include <string>
+
+int main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ {
+ // conversion vector to std tuple
+ std::tuple<int, std::string> t = convert<std_tuple_tag>(make_vector(123, std::string("Hola!!!")));
+ BOOST_TEST(std::get<0>(t) == 123);
+ BOOST_TEST(std::get<1>(t) == "Hola!!!");
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/std_tuple_iterator.cpp b/src/boost/libs/fusion/test/sequence/std_tuple_iterator.cpp
new file mode 100644
index 000000000..df283331f
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/std_tuple_iterator.cpp
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/config.hpp>
+
+// The std_tuple_iterator adaptor only supports implementations
+// using variadic templates
+#if defined(BOOST_NO_CXX11_HDR_TUPLE) || \
+ defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+# error "does not meet requirements"
+#endif
+
+#include <boost/fusion/adapted/std_tuple.hpp>
+
+#define FUSION_SEQUENCE std::tuple
+#define FUSION_TRAVERSAL_TAG random_access_traversal_tag
+#include "./iterator.hpp"
+
+int main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/swap.cpp b/src/boost/libs/fusion/test/sequence/swap.cpp
new file mode 100644
index 000000000..cac832b4b
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/swap.cpp
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/fusion/sequence/intrinsic/swap.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <vector>
+
+int main()
+{
+ namespace fusion = boost::fusion;
+ {
+ typedef fusion::vector<std::vector<int>, char> test_vector;
+ BOOST_MPL_ASSERT((boost::is_same<void, boost::fusion::result_of::swap<test_vector, test_vector>::type>));
+
+ test_vector v1(std::vector<int>(1, 101), 'a'), v2(std::vector<int>(1, 202), 'b');
+
+ fusion::swap(v1, v2);
+
+ BOOST_TEST(v1 == fusion::make_vector(std::vector<int>(1, 202), 'b'));
+ BOOST_TEST(v2 == fusion::make_vector(std::vector<int>(1, 101), 'a'));
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/test_deduce_sequence.cpp b/src/boost/libs/fusion/test/sequence/test_deduce_sequence.cpp
new file mode 100644
index 000000000..d7a3b8135
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/test_deduce_sequence.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2009 Joel de Guzman
+
+ 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/vector.hpp>
+#include <boost/fusion/support.hpp>
+
+typedef boost::fusion::traits::deduce_sequence <
+
+boost::mpl::vector<int, char>
+
+>::type seq1_t;
+
+
+typedef boost::fusion::traits::deduce_sequence <
+
+boost::fusion::vector<int, char>
+
+>::type seq2_t;
diff --git a/src/boost/libs/fusion/test/sequence/tie.hpp b/src/boost/libs/fusion/test/sequence/tie.hpp
new file mode 100644
index 000000000..536af1e95
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tie.hpp
@@ -0,0 +1,85 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+#if !defined(FUSION_MAKE)
+#define FUSION_MAKE BOOST_PP_CAT(make_, FUSION_SEQUENCE)
+#endif
+
+#if !defined(FUSION_TIE)
+#define FUSION_TIE BOOST_PP_CAT(FUSION_SEQUENCE, _tie)
+#endif
+
+namespace test_detail
+{
+ // something to prevent warnings for unused variables
+ template<class T> void dummy(const T&) {}
+
+ // no public default constructor
+ class foo
+ {
+ public:
+
+ explicit foo(int v) : val(v) {}
+
+ bool operator==(const foo& other) const
+ {
+ return val == other.val;
+ }
+
+ private:
+
+ foo() {}
+ int val;
+ };
+}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ int a;
+ char b;
+ foo c(5);
+
+ FUSION_TIE(a, b, c) = FUSION_MAKE(2, 'a', foo(3));
+ BOOST_TEST(a == 2);
+ BOOST_TEST(b == 'a');
+ BOOST_TEST(c == foo(3));
+
+ FUSION_TIE(a, ignore, c) = FUSION_MAKE((short int)5, false, foo(5));
+ BOOST_TEST(a == 5);
+ BOOST_TEST(b == 'a');
+ BOOST_TEST(c == foo(5));
+
+ int i, j;
+ FUSION_TIE(i, j) = FUSION_MAKE(1, 2);
+ BOOST_TEST(i == 1 && j == 2);
+
+ FUSION_SEQUENCE<int, int, float> ta;
+
+#if defined(FUSION_TEST_FAIL)
+ ta = std::FUSION_MAKE(1, 2); // should fail, tuple is of length 3, not 2
+#endif
+
+ dummy(ta);
+
+ // ties cannot be rebound
+ int d = 3;
+ FUSION_SEQUENCE<int&> ti(a);
+ BOOST_TEST(&FUSION_AT<0>(ti) == &a);
+ ti = FUSION_SEQUENCE<int&>(d);
+ BOOST_TEST(&FUSION_AT<0>(ti) == &a);
+}
diff --git a/src/boost/libs/fusion/test/sequence/traits.hpp b/src/boost/libs/fusion/test/sequence/traits.hpp
new file mode 100644
index 000000000..3684604e0
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/traits.hpp
@@ -0,0 +1,253 @@
+/*=============================================================================
+ Copyright (C) 2016 Lee Clagett
+ Copyright (C) 2018 Kohei Takahashi
+
+ 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/config.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/is_constructible.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+
+struct convertible
+{
+ convertible(int) {}
+};
+
+template <typename From, typename To>
+bool is_convertible(bool has_conversion)
+{
+ typedef typename boost::remove_reference<
+ typename boost::remove_const<From>::type
+ >::type from_rvalue;
+ typedef typename boost::add_reference<from_rvalue>::type from_lvalue;
+ typedef typename boost::add_const<from_lvalue>::type from_const_lvalue;
+
+ return
+ boost::is_convertible<from_rvalue, To>::value == has_conversion &&
+ boost::is_convertible<from_lvalue, To>::value == has_conversion &&
+ boost::is_convertible<from_const_lvalue, To>::value == has_conversion;
+}
+
+// is_constructible has a few requirements
+#ifdef BOOST_TT_IS_CONSTRUCTIBLE_CONFORMING
+
+#define FUSION_TEST_HAS_CONSTRUCTIBLE
+
+template <typename To, typename... Args>
+bool is_lvalue_constructible(bool has_constructor)
+{
+ return has_constructor ==
+ boost::is_constructible<
+ To
+ , typename boost::add_reference<Args>::type...
+ >::value;
+}
+
+template <typename To, typename... Args>
+bool is_constructible_impl(bool has_constructor)
+{
+ return
+ boost::is_constructible<To, Args...>::value == has_constructor &&
+ is_lvalue_constructible<To, Args...>(has_constructor) &&
+ is_lvalue_constructible<
+ To, typename boost::add_const<Args>::type...
+ >(has_constructor);
+}
+
+template <typename To, typename... Args>
+bool is_constructible(bool has_constructor)
+{
+ return
+ is_constructible_impl<
+ To
+ , typename boost::remove_reference<
+ typename boost::remove_const<Args>::type
+ >::type...
+ >(has_constructor);
+}
+
+void test_constructible()
+{
+ BOOST_TEST((is_constructible< FUSION_SEQUENCE<> >(true)));
+
+ BOOST_TEST((is_constructible< FUSION_SEQUENCE<int> >(true)));
+ BOOST_TEST((is_constructible<FUSION_SEQUENCE<int>, int>(true)));
+
+ BOOST_TEST((is_constructible<FUSION_SEQUENCE<convertible>, int>(true)));
+ BOOST_TEST((
+ is_constructible<FUSION_SEQUENCE<convertible>, convertible>(true)
+ ));
+
+ // boost::is_constructible always fail to test ctor which takes 2 or more arguments on GCC 4.7.
+#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
+ BOOST_TEST((
+ is_constructible<FUSION_SEQUENCE<int, int>, int, int>(true)
+ ));
+
+ BOOST_TEST((
+ is_constructible<FUSION_SEQUENCE<convertible, int>, int, int>(true)
+ ));
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<convertible, int>, convertible, int
+ >(true)
+ ));
+
+ BOOST_TEST((
+ is_constructible<FUSION_SEQUENCE<int, convertible>, int, int>(true)
+ ));
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<int, convertible>, int, convertible
+ >(true)
+ ));
+
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<convertible, convertible>, int, int
+ >(true)
+ ));
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<convertible, convertible>, convertible, int
+ >(true)
+ ));
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<convertible, convertible>, int, convertible
+ >(true)
+ ));
+ BOOST_TEST((
+ is_constructible<
+ FUSION_SEQUENCE<convertible, convertible>, convertible, convertible
+ >(true)
+ ));
+#endif // !(gcc < 4.7)
+}
+
+#endif // is_constructible is available
+
+void test_convertible(bool has_seq_conversion)
+{
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<> >(false)));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<int> >(false)));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<const int&> >(false)));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<convertible> >(false)));
+ BOOST_TEST((
+ is_convertible<int, FUSION_SEQUENCE<const convertible&> >(false)
+ ));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<int, int> >(false)));
+ BOOST_TEST((
+ is_convertible<int, FUSION_SEQUENCE<const int&, const int&> >(false)
+ ));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<convertible, int> >(false)));
+ BOOST_TEST((
+ is_convertible<int, FUSION_SEQUENCE<const convertible&, const int&> >(false)
+ ));
+ BOOST_TEST((is_convertible<int, FUSION_SEQUENCE<int, convertible> >(false)));
+ BOOST_TEST((
+ is_convertible<int, FUSION_SEQUENCE<const int&, const convertible&> >(false)
+ ));
+ BOOST_TEST((
+ is_convertible<int, FUSION_SEQUENCE<convertible, convertible> >(false)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ int, FUSION_SEQUENCE<const convertible&, const convertible&>
+ >(false)
+ ));
+
+ BOOST_TEST((is_convertible<FUSION_SEQUENCE<>, FUSION_SEQUENCE<> >(true)));
+ BOOST_TEST((
+ is_convertible<FUSION_SEQUENCE<int>, FUSION_SEQUENCE<int> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<FUSION_SEQUENCE<int>, FUSION_SEQUENCE<const int&> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<FUSION_SEQUENCE<int>, FUSION_SEQUENCE<convertible> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int, int> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<const int&, const int&>
+ >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<convertible, int>
+ >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_SEQUENCE<int, int>, FUSION_SEQUENCE<int, convertible>
+ >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_SEQUENCE<int, int>
+ , FUSION_SEQUENCE<convertible, convertible>
+ >(true)
+ ));
+
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<>, FUSION_SEQUENCE<>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int>, FUSION_SEQUENCE<int>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int>, FUSION_SEQUENCE<const int&>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int>, FUSION_SEQUENCE<convertible>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int, int>, FUSION_SEQUENCE<int, int>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int, int>
+ , FUSION_SEQUENCE<const int&, const int&>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int, int>, FUSION_SEQUENCE<convertible, int>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int, int>, FUSION_SEQUENCE<int, convertible>
+ >(has_seq_conversion)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ FUSION_ALT_SEQUENCE<int, int>
+ , FUSION_SEQUENCE<convertible, convertible>
+ >(has_seq_conversion)
+ ));
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/transform_view.cpp b/src/boost/libs/fusion/test/sequence/transform_view.cpp
new file mode 100644
index 000000000..b9e3f9432
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/transform_view.cpp
@@ -0,0 +1,115 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/view/transform_view/transform_view.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/distance.hpp>
+
+#include <boost/mpl/range_c.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct square
+{
+ template<typename T>
+ struct result;
+
+ template <typename T>
+ struct result<square(T)>
+ {
+ typedef int type;
+ };
+
+ template <typename T>
+ int operator()(T x) const
+ {
+ return x * x;
+ }
+};
+
+struct add
+{
+ template<typename T>
+ struct result;
+
+ template <typename A, typename B>
+ struct result<add(A,B)>
+ {
+ typedef int type;
+ };
+
+ template <typename A, typename B>
+ int operator()(A a, B b) const
+ {
+ return a + b;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+/// Testing the transform_view
+
+ {
+ typedef boost::mpl::range_c<int, 5, 9> sequence_type;
+ sequence_type sequence;
+ square sq;
+ typedef transform_view<sequence_type, square> xform_type;
+ xform_type xform(sequence, sq);
+
+ std::cout << xform << std::endl;
+ BOOST_TEST((xform == make_vector(25, 36, 49, 64)));
+
+ typedef boost::fusion::result_of::begin<xform_type>::type first_type;
+ first_type first_it(boost::fusion::begin(xform));
+
+ typedef boost::fusion::result_of::next<first_type>::type next_type;
+ next_type next_it(boost::fusion::next(first_it));
+ BOOST_TEST((*next_it == 36));
+ BOOST_TEST((*boost::fusion::prior(next_it) == 25));
+ BOOST_TEST((boost::fusion::distance(first_it, next_it) == 1));
+
+ BOOST_TEST((*boost::fusion::advance_c<3>(boost::fusion::begin(xform)) == 64));
+ BOOST_TEST((boost::fusion::at_c<2>(xform) == 49));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, int>));
+ }
+
+ {
+ typedef boost::mpl::range_c<int, 5, 9> sequence1_type;
+ typedef boost::mpl::range_c<int, 10, 14> sequence2_type;
+ sequence1_type sequence1;
+ sequence2_type sequence2;
+ add f;
+ typedef transform_view<sequence1_type, sequence2_type, add> xform_type;
+ xform_type xform(sequence1, sequence2, f);
+
+ std::cout << xform << std::endl;
+ BOOST_TEST((xform == make_vector(15, 17, 19, 21)));
+ BOOST_TEST((boost::fusion::at_c<2>(xform) == 19));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<xform_type, 0>::type, int>));
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tree.hpp b/src/boost/libs/fusion/test/sequence/tree.hpp
new file mode 100644
index 000000000..a345a8f1d
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tree.hpp
@@ -0,0 +1,100 @@
+/*=============================================================================
+ Copyright (c) 2006 Eric Niebler
+
+ Use, modification and distribution is 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)
+==============================================================================*/
+#ifndef FUSION_BINARY_TREE_EAN_05032006_1027
+#define FUSION_BINARY_TREE_EAN_05032006_1027
+
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/view/single_view.hpp>
+#include <boost/fusion/container/list/cons.hpp> // for nil
+#include <boost/fusion/container/vector/vector10.hpp>
+#include <boost/fusion/support/sequence_base.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/support/is_segmented.hpp>
+#include <boost/fusion/sequence/intrinsic/segments.hpp>
+
+namespace boost { namespace fusion
+{
+ struct tree_tag;
+
+ template <typename Data, typename Left = nil, typename Right = nil>
+ struct tree
+ : sequence_base<tree<Data, Left, Right> >
+ {
+ typedef Data data_type;
+ typedef Left left_type;
+ typedef Right right_type;
+ typedef tree_tag fusion_tag;
+ typedef forward_traversal_tag category;
+ typedef mpl::false_ is_view;
+
+ typedef typename mpl::if_<
+ traits::is_sequence<Data>
+ , Data
+ , single_view<Data>
+ >::type data_view;
+
+ explicit tree(
+ typename fusion::detail::call_param<Data>::type data_
+ , typename fusion::detail::call_param<Left>::type left_ = Left()
+ , typename fusion::detail::call_param<Right>::type right_ = Right()
+ )
+ : segments(left_, data_view(data_), right_)
+ {}
+
+ typedef vector3<Left, data_view, Right> segments_type;
+ segments_type segments;
+ };
+
+ template <typename Data>
+ tree<Data> make_tree(Data const &data)
+ {
+ return tree<Data>(data);
+ }
+
+ template <typename Data, typename Left, typename Right>
+ tree<Data, Left, Right> make_tree(Data const &data, Left const &left, Right const &right)
+ {
+ return tree<Data, Left, Right>(data, left, right);
+ }
+
+ namespace extension
+ {
+ template <>
+ struct is_segmented_impl<tree_tag>
+ {
+ template <typename Sequence>
+ struct apply : mpl::true_ {};
+ };
+
+ template <>
+ struct segments_impl<tree_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef typename mpl::if_<
+ is_const<Sequence>
+ , typename Sequence::segments_type const &
+ , typename Sequence::segments_type &
+ >::type type;
+
+ static type call(Sequence &seq)
+ {
+ return seq.segments;
+ }
+ };
+ };
+ }
+}}
+
+#endif
diff --git a/src/boost/libs/fusion/test/sequence/tuple_comparison.cpp b/src/boost/libs/fusion/test/sequence/tuple_comparison.cpp
new file mode 100644
index 000000000..2b4433068
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_comparison.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple/tuple.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+
+#define FUSION_SEQUENCE tuple
+#include "comparison.hpp"
+
+int
+main()
+{
+ equality_test();
+ ordering_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/tuple_construction.cpp b/src/boost/libs/fusion/test/sequence/tuple_construction.cpp
new file mode 100644
index 000000000..127720279
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_construction.cpp
@@ -0,0 +1,49 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple/tuple.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+
+#define NO_CONSTRUCT_FROM_NIL
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#include "construction.hpp"
+
+// Bug in C++03 tuple? Cannot construct from a std::pair without including
+// std::pair fusion adaption
+#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
+# include <boost/fusion/adapted/std_pair.hpp>
+#endif
+
+struct test_conversion
+{
+ test_conversion(int value) : value_(value) {}
+
+ int value_;
+};
+
+int
+main()
+{
+ test();
+
+ {
+ using namespace boost::fusion;
+ const tuple<int, test_conversion> instance(std::pair<int, int>(1, 9));
+ BOOST_TEST(boost::fusion::get<0>(instance) == 1);
+ BOOST_TEST(boost::fusion::get<1>(instance).value_ == 9);
+ }
+ {
+ using namespace boost::fusion;
+ const std::pair<int, int> init(16, 4);
+ const tuple<int, test_conversion> instance(init);
+ BOOST_TEST(boost::fusion::get<0>(instance) == 16);
+ BOOST_TEST(boost::fusion::get<1>(instance).value_ == 4);
+ }
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/tuple_conversion.cpp b/src/boost/libs/fusion/test/sequence/tuple_conversion.cpp
new file mode 100644
index 000000000..861365de4
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_conversion.cpp
@@ -0,0 +1,51 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+
+ 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).
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::tuple
+#include "conversion.hpp"
+
+// Bug in C++03 tuple? Cannot construct from a std::pair without including
+// std::pair fusion adaption
+#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
+# include <boost/fusion/adapted/std_pair.hpp>
+#endif
+
+using namespace test_detail;
+
+void test_tuple()
+{
+ BOOST_TEST((
+ run< can_copy< boost::fusion::tuple<int, int> > >(
+ std::pair<int, int>(1, 9)
+ )
+ ));
+ BOOST_TEST((
+ run< can_copy< boost::fusion::tuple<int, convertible> > >(
+ std::pair<int, int>(1, 9)
+ )
+ ));
+ BOOST_TEST((
+ run< can_copy< boost::fusion::tuple<convertible, int> > >(
+ std::pair<int, int>(1, 9)
+ )
+ ));
+ BOOST_TEST((
+ run< can_copy< boost::fusion::tuple<convertible, convertible> > >(
+ std::pair<int, int>(1, 9)
+ )
+ ));
+}
+
+int main()
+{
+ test<can_assign>(); // conversion construction not supported
+ test_tuple();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/tuple_copy.cpp b/src/boost/libs/fusion/test/sequence/tuple_copy.cpp
new file mode 100644
index 000000000..012973876
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_copy.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#define FUSION_MAKE make_tuple
+#define FUSION_TIE tie
+#include "copy.hpp"
+
+int
+main()
+{
+ test<test_detail::can_copy>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_element.cpp b/src/boost/libs/fusion/test/sequence/tuple_element.cpp
new file mode 100644
index 000000000..0932e627e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_element.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#define FUSION_VALUE_AT(S, N) tuple_element<N, S>
+#include "value_at.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_hash.cpp b/src/boost/libs/fusion/test/sequence/tuple_hash.cpp
new file mode 100644
index 000000000..e8f604ef5
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_hash.cpp
@@ -0,0 +1,16 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+
+ 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/fusion/tuple/tuple.hpp>
+
+#define FUSION_SEQUENCE tuple
+#include "hash.hpp"
+
+int main()
+{
+ hash_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/tuple_make.cpp b/src/boost/libs/fusion/test/sequence/tuple_make.cpp
new file mode 100644
index 000000000..1a453b627
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_make.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::tuple
+#define FUSION_AT get
+#define FUSION_MAKE boost::fusion::make_tuple
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_misc.cpp b/src/boost/libs/fusion/test/sequence/tuple_misc.cpp
new file mode 100644
index 000000000..473efb61c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_misc.cpp
@@ -0,0 +1,23 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#define FUSION_SIZE tuple_size
+#include "misc.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_mutate.cpp b/src/boost/libs/fusion/test/sequence/tuple_mutate.cpp
new file mode 100644
index 000000000..b6e72a610
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_mutate.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#include "mutate.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_nest.cpp b/src/boost/libs/fusion/test/sequence/tuple_nest.cpp
new file mode 100644
index 000000000..3344c5231
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_nest.cpp
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (C) 2015 Kohei Takahshi
+
+ 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/fusion/tuple/tuple.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::tuple
+#include "nest.hpp"
+
+
+// tuple does not support conversion construction from sequence by design
+template <typename T>
+struct skip_constructor_conversion
+{
+ template <typename Source, typename Expected>
+ bool operator()(Source const& source, Expected const& expected) const
+ {
+ using namespace test_detail;
+ return
+ run< can_copy<T> >(source, expected) &&
+ run< can_convert_using<can_assign>::to<T> >(source, expected) &&
+ run< can_construct_from_elements<T> >(source, expected);
+ }
+};
+
+int
+main()
+{
+ test<skip_constructor_conversion>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_tie.cpp b/src/boost/libs/fusion/test/sequence/tuple_tie.cpp
new file mode 100644
index 000000000..2d5ec24f6
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_tie.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/tuple.hpp>
+
+#define FUSION_SEQUENCE tuple
+#define FUSION_AT get
+#define FUSION_MAKE make_tuple
+#define FUSION_TIE tie
+#include "tie.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/tuple_traits.cpp b/src/boost/libs/fusion/test/sequence/tuple_traits.cpp
new file mode 100644
index 000000000..f065504a7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/tuple_traits.cpp
@@ -0,0 +1,89 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/tuple/tuple.hpp>
+#include <boost/config.hpp>
+#include <boost/type_traits/is_constructible.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::tuple
+#define FUSION_ALT_SEQUENCE boost::fusion::vector
+#include "traits.hpp"
+
+struct not_convertible {};
+
+/* Some construction differences in fusion::tuple from std::tuple:
+ - Construction from elements cannot call an explicit constructor.
+ - There is no implicit construction from elements.
+ - Construction from std::pair is _enabled_ when tuple is not of size 2.
+ - Construction from tuple is _enabled_ when destination tuple is of
+ different size.
+ - Implicit construction from std::pair can call explicit constructors on
+ elements.
+ - Implicit construction from tuple can call explicit constructors on
+ elements.
+
+ These differences are historical. Matching the behavior of std::tuple
+ could break existing code, however, switching to fusion::vector would
+ restore the historical behavior. */
+int
+main()
+{
+ using namespace boost::fusion;
+
+ test_convertible(false /* no conversion construction */ );
+
+ BOOST_TEST((is_convertible<std::pair<int, int>, tuple<int, int> >(true)));
+ BOOST_TEST((
+ is_convertible<std::pair<int, int>, tuple<convertible, int> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<std::pair<int, int>, tuple<int, convertible> >(true)
+ ));
+ BOOST_TEST((
+ is_convertible<
+ std::pair<int, int>, tuple<convertible, convertible>
+ >(true)
+ ));
+
+#if defined(FUSION_TEST_HAS_CONSTRUCTIBLE)
+ test_constructible();
+
+ BOOST_TEST((is_constructible< tuple<> >(true)));
+ BOOST_TEST((is_constructible<tuple<>, int>(false)));
+
+ BOOST_TEST((is_constructible< tuple<int> >(true)));
+ BOOST_TEST((is_constructible<tuple<int>, int>(true)));
+ BOOST_TEST((is_constructible<tuple<convertible>, int>(true)));
+ BOOST_TEST((is_constructible<tuple<not_convertible>, int>(false)));
+ BOOST_TEST((is_constructible< tuple<int>, vector<int> >(false)));
+ BOOST_TEST((is_constructible<tuple<int>, int, int>(false)));
+
+ BOOST_TEST((is_constructible< tuple<int, int> >(true)));
+ // boost::is_constructible always fail to test ctor which takes 2 or more arguments on GCC 4.7.
+#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
+ BOOST_TEST((is_constructible<tuple<int, int>, int, int>(true)));
+ BOOST_TEST((
+ is_constructible<tuple<convertible, convertible>, int, int>(true)
+ ));
+#endif // !(gcc < 4.7)
+ BOOST_TEST((is_constructible<tuple<int, not_convertible>, int, int>(false)));
+ BOOST_TEST((is_constructible<tuple<not_convertible, int>, int, int>(false)));
+ BOOST_TEST((
+ is_constructible<tuple<not_convertible, not_convertible>, int, int>(false)
+ ));
+#if defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
+ // C++03 fusion::tuple has constructors that can never be used
+ BOOST_TEST((is_constructible<tuple<int, int>, int>(false)));
+#endif
+ BOOST_TEST((is_constructible<tuple<int, int>, int, int, int>(false)));
+
+#endif // FUSION_TEST_HAS_CONSTRUCTIBLE
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/value_at.hpp b/src/boost/libs/fusion/test/sequence/value_at.hpp
new file mode 100644
index 000000000..ae03dd3c7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/value_at.hpp
@@ -0,0 +1,100 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+#include <functional>
+#endif
+
+#if !defined(FUSION_AT)
+#define FUSION_AT at_c
+#endif
+
+#if !defined(FUSION_VALUE_AT)
+#define FUSION_VALUE_AT(S, N) boost::fusion::result_of::value_at_c<S, N>
+#endif
+
+namespace test_detail
+{
+ // something to prevent warnings for unused variables
+ template<class T> void dummy(const T&) {}
+
+ class A {};
+}
+
+void
+test()
+{
+ using namespace boost::fusion;
+ using namespace test_detail;
+
+ double d = 2.7;
+ A a;
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+ // Note: C++11 will pickup the rvalue overload for the d argument
+ // since we do not have all permutations (expensive!) for all const&
+ // and && arguments. We either have all && or all const& arguments only.
+ // For that matter, use std::ref to disambiguate the call.
+
+ FUSION_SEQUENCE<int, double&, const A&, int> t(1, std::ref(d), a, 2);
+#else
+ FUSION_SEQUENCE<int, double&, const A&, int> t(1, d, a, 2);
+#endif
+ const FUSION_SEQUENCE<int, double&, const A, int> ct(t);
+
+ int i = FUSION_AT<0>(t);
+ int i2 = FUSION_AT<3>(t);
+
+ BOOST_TEST(i == 1 && i2 == 2);
+
+ int j = FUSION_AT<0>(ct);
+ BOOST_TEST(j == 1);
+
+ FUSION_AT<0>(t) = 5;
+ BOOST_TEST(FUSION_AT<0>(t) == 5);
+
+#if defined(FUSION_TEST_FAIL)
+ FUSION_AT<0>(ct) = 5; // can't assign to const
+#endif
+
+ double e = FUSION_AT<1>(t);
+ BOOST_TEST(e > 2.69 && e < 2.71);
+
+ FUSION_AT<1>(t) = 3.14+i;
+ BOOST_TEST(FUSION_AT<1>(t) > 4.13 && FUSION_AT<1>(t) < 4.15);
+
+#if defined(FUSION_TEST_FAIL)
+ FUSION_AT<4>(t) = A(); // can't assign to const
+ dummy(FUSION_AT<5>(ct)); // illegal index
+#endif
+
+ ++FUSION_AT<0>(t);
+ BOOST_TEST(FUSION_AT<0>(t) == 6);
+
+ typedef FUSION_SEQUENCE<int, float> seq_type;
+
+ BOOST_STATIC_ASSERT(!(
+ boost::is_const<FUSION_VALUE_AT(seq_type, 0)::type>::value));
+
+ // constness should not affect
+ BOOST_STATIC_ASSERT(!(
+ boost::is_const<FUSION_VALUE_AT(const seq_type, 0)::type>::value));
+
+ BOOST_STATIC_ASSERT(!(
+ boost::is_const<FUSION_VALUE_AT(seq_type, 1)::type>::value));
+
+ // constness should not affect
+ BOOST_STATIC_ASSERT(!(
+ boost::is_const<FUSION_VALUE_AT(const seq_type, 1)::type>::value));
+
+ dummy(i); dummy(i2); dummy(j); dummy(e); // avoid warns for unused variables
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_comparison.cpp b/src/boost/libs/fusion/test/sequence/vector_comparison.cpp
new file mode 100644
index 000000000..c23db8336
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_comparison.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "comparison.hpp"
+
+int
+main()
+{
+ equality_test();
+ ordering_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_construction.cpp b/src/boost/libs/fusion/test/sequence/vector_construction.cpp
new file mode 100644
index 000000000..8af5bc042
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_construction.cpp
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "construction.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_conversion.cpp b/src/boost/libs/fusion/test/sequence/vector_conversion.cpp
new file mode 100644
index 000000000..1ffd77cc6
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_conversion.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+
+ 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).
+==============================================================================*/
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::vector
+#include "conversion.hpp"
+
+int main()
+{
+ test<test_detail::can_copy>();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_copy.cpp b/src/boost/libs/fusion/test/sequence/vector_copy.cpp
new file mode 100644
index 000000000..8a4d26ce9
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_copy.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/generation/vector_tie.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "copy.hpp"
+
+int
+main()
+{
+ test<test_detail::can_copy>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_hash.cpp b/src/boost/libs/fusion/test/sequence/vector_hash.cpp
new file mode 100644
index 000000000..6b6dcd24c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_hash.cpp
@@ -0,0 +1,16 @@
+/*=============================================================================
+ Copyright (c) 2014 Christoph Weiss
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "hash.hpp"
+
+int main()
+{
+ hash_test();
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_iterator.cpp b/src/boost/libs/fusion/test/sequence/vector_iterator.cpp
new file mode 100644
index 000000000..a2ca7df73
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_iterator.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/vector/vector_iterator.hpp>
+
+#define FUSION_SEQUENCE vector
+#define FUSION_TRAVERSAL_TAG random_access_traversal_tag
+#include "./iterator.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
+
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_make.cpp b/src/boost/libs/fusion/test/sequence/vector_make.cpp
new file mode 100644
index 000000000..8a687354a
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_make.cpp
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "make.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_misc.cpp b/src/boost/libs/fusion/test/sequence/vector_misc.cpp
new file mode 100644
index 000000000..e2b273967
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_misc.cpp
@@ -0,0 +1,21 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "misc.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_move.cpp b/src/boost/libs/fusion/test/sequence/vector_move.cpp
new file mode 100644
index 000000000..3e9f0b6a7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_move.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 2012 Joel de Guzman
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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)
+==============================================================================*/
+#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
+#include <boost/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::vector<std::vector<x>>
+#define FUSION_SEQUENCE2 boost::fusion::vector<std::vector<x>, x>
+
+#include "move.hpp"
+
+int main()
+{
+ test();
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_mutate.cpp b/src/boost/libs/fusion/test/sequence/vector_mutate.cpp
new file mode 100644
index 000000000..448bbf768
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_mutate.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "mutate.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_n.cpp b/src/boost/libs/fusion/test/sequence/vector_n.cpp
new file mode 100644
index 000000000..65e1032df
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_n.cpp
@@ -0,0 +1,231 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector/vector10.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+
+#include <boost/fusion/container/vector/vector20.hpp>
+#include <boost/fusion/container/vector/vector30.hpp>
+#include <boost/fusion/container/vector/vector40.hpp>
+#include <boost/fusion/container/vector/vector50.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_empty.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+
+#include <boost/fusion/algorithm/transformation/push_back.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using namespace boost;
+
+ {
+ vector0<> vec;
+ (void) vec;
+ std::cout << "(): " << sizeof(vec) << std::endl;
+ std::cout << (boost::is_empty<vector0<> >::value ? "is empty" : "is not empty") << std::endl;
+ }
+
+ {
+ typedef vector1<int> type;
+ type vec;
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 1);
+
+ BOOST_TEST(at_c<0>(vec) == 0);
+ BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
+
+ // prove that it is mutable
+ at_c<0>(vec) = 987;
+ BOOST_TEST(at_c<0>(vec) == 987);
+ }
+
+ {
+ typedef vector1<int> type;
+ type vec(123);
+ BOOST_TEST(at_c<0>(vec) == 123);
+ std::cout << "(int): " << sizeof(vec) << std::endl;
+ }
+
+ { // testing const vector
+ vector1<short> const vec(999);
+ BOOST_TEST(at_c<0>(vec) == 999);
+
+#ifdef FUSION_TEST_COMPILE_FAIL
+ at_c<0>(vec) = 321;
+#endif
+ }
+
+ {
+ vector1<int> t1(123L); // try conversion from long to int
+ vector1<double> t2(t1); // try copy
+ (void)t2;
+ }
+
+ {
+ typedef vector2<int, char> type;
+ type vec;
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 2);
+
+ BOOST_TEST(at_c<0>(vec) == 0);
+ BOOST_TEST(at_c<1>(vec) == char());
+
+ BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
+ }
+
+ {
+ typedef vector2<int, char> type;
+ type vec(123, 'x');
+ BOOST_TEST(at_c<0>(vec) == 123);
+ BOOST_TEST(at_c<1>(vec) == 'x');
+ std::cout << "(int, char): " << sizeof(vec) << std::endl;
+ }
+
+ {
+ vector2<int, short> t1(123, 456);
+ vector2<double, float> t2(t1);
+ (void)t2;
+ }
+
+ {
+ typedef vector3<int, char, double> type;
+ type vec;
+ BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 3);
+
+ BOOST_TEST(at_c<0>(vec) == 0);
+ BOOST_TEST(at_c<1>(vec) == char());
+ BOOST_TEST(at_c<2>(vec) == double());
+
+ BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
+ }
+
+ {
+ typedef vector3<int, char, double> type;
+ type vec(123, 'x', 123.456);
+ BOOST_TEST(at_c<0>(vec) == 123);
+ BOOST_TEST(at_c<1>(vec) == 'x');
+ BOOST_TEST(at_c<2>(vec) >= 123.455 && at_c<2>(vec) <= 123.457);
+ std::cout << "(int, char, double): " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector4<int, char, double, bool> type;
+ type vec(123, 'x', 123.456, true);
+ std::cout << "(int, char, double, bool): " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector4<int, char, bool, double> type;
+ type vec(123, 'x', true, 123.456);
+ std::cout << "(int, char, bool, double): " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector7<bool, char, short, int, long, float, double> type;
+ type vec(false, 'x', 3, 4, 5, 6.f, 7.0);
+
+ BOOST_TEST(at_c<0>(vec) == false);
+ BOOST_TEST(at_c<1>(vec) == 'x');
+ BOOST_TEST(at_c<2>(vec) == 3);
+ BOOST_TEST(at_c<3>(vec) == 4);
+ BOOST_TEST(at_c<4>(vec) == 5);
+ BOOST_TEST(at_c<5>(vec) >= 5.9 && at_c<5>(vec) <= 6.1);
+ BOOST_TEST(at_c<6>(vec) >= 6.9 && at_c<6>(vec) <= 7.1);
+
+ BOOST_STATIC_ASSERT((boost::is_same<bool, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<short, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 3>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<long, boost::fusion::result_of::value_at_c<type, 4>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<float, boost::fusion::result_of::value_at_c<type, 5>::type>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 6>::type>::value));
+ std::cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector10<int, int, int, int, int, int, int, int, int, int> type;
+ type vec; // compile check only
+ std::cout << "vector10 of int: " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector20<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int> type;
+
+ type vec; // compile check only
+ std::cout << "vector20 of int: " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector30<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int> type;
+
+ type vec; // compile check only
+ std::cout << "vector30 of int: " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector40<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int> type;
+
+ type vec; // compile check only
+ std::cout << "vector40 of int: " << sizeof(vec) << std::endl;
+ }
+
+ {
+ typedef vector50<
+ int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int
+ , int, int, int, int, int, int, int, int, int, int> type;
+
+ type vec; // compile check only
+ std::cout << "vector50 of int: " << sizeof(vec) << std::endl;
+ }
+
+ {
+ // testing copy and assign from a view
+ vector0<> empty;
+ fusion::vector2<int, long> v(fusion::push_back(fusion::push_back(empty, 123), 456));
+ BOOST_TEST(at_c<0>(v) == 123);
+ BOOST_TEST(at_c<1>(v) == 456);
+ v = fusion::push_back(fusion::push_back(empty, 123), 456); // test assign
+ BOOST_TEST(at_c<0>(v) == 123);
+ BOOST_TEST(at_c<1>(v) == 456);
+ }
+
+ {
+ // testing copy and assign from a vector_c
+ mpl::vector_c<int, 123, 456> vec_c;
+ fusion::vector2<int, long> v(vec_c);
+ BOOST_TEST(at_c<0>(v) == 123);
+ BOOST_TEST(at_c<1>(v) == 456);
+ v = mpl::vector_c<int, 123, 456>(); // test assign
+ BOOST_TEST(at_c<0>(v) == 123);
+ BOOST_TEST(at_c<1>(v) == 456);
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_nest.cpp b/src/boost/libs/fusion/test/sequence/vector_nest.cpp
new file mode 100644
index 000000000..2627b3d7c
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_nest.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (C) 2015 Kohei Takahshi
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/core/lightweight_test.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::vector
+#include "nest.hpp"
+
+int
+main()
+{
+ test<test_detail::can_nest>();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_tie.cpp b/src/boost/libs/fusion/test/sequence/vector_tie.cpp
new file mode 100644
index 000000000..123bf888e
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_tie.cpp
@@ -0,0 +1,22 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/generation/vector_tie.hpp>
+#include <boost/fusion/container/generation/ignore.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "tie.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/vector_traits.cpp b/src/boost/libs/fusion/test/sequence/vector_traits.cpp
new file mode 100644
index 000000000..470f11e69
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_traits.cpp
@@ -0,0 +1,32 @@
+/*=============================================================================
+ Copyright (C) 2016 Lee Clagett
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/container/vector.hpp>
+
+#define FUSION_SEQUENCE boost::fusion::vector
+#define FUSION_ALT_SEQUENCE boost::fusion::list
+#include "traits.hpp"
+
+int main() {
+ test_convertible(true /* has conversion construction */ );
+
+ // C++11 models overly aggressive (bug) implicit conversion from C++03
+ BOOST_TEST((
+ is_convertible<
+ boost::fusion::list<int>
+ , boost::fusion::vector< boost::fusion::list<int> >
+ >(true)
+ ));
+
+#if defined(FUSION_TEST_HAS_CONSTRUCTIBLE)
+ test_constructible();
+#endif
+
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/vector_value_at.cpp b/src/boost/libs/fusion/test/sequence/vector_value_at.cpp
new file mode 100644
index 000000000..191da4cf7
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/vector_value_at.cpp
@@ -0,0 +1,19 @@
+/*=============================================================================
+ Copyright (c) 1999-2003 Jaakko Jarvi
+ Copyright (c) 2001-2011 Joel de Guzman
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#include "value_at.hpp"
+
+int
+main()
+{
+ test();
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/zip_view.cpp b/src/boost/libs/fusion/test/sequence/zip_view.cpp
new file mode 100644
index 000000000..83bfa8798
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/zip_view.cpp
@@ -0,0 +1,87 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/view/zip_view.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/vector_c.hpp>
+
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ typedef vector2<int,int> int_vector;
+ typedef vector2<char,char> char_vector;
+ typedef vector<int_vector&, char_vector&> seqs_type;
+ typedef zip_view<seqs_type> view;
+
+ BOOST_MPL_ASSERT((boost::mpl::equal_to<boost::fusion::result_of::size<view>::type, boost::fusion::result_of::size<int_vector>::type>));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::size<view>::value == 2));
+
+ int_vector iv(1,2);
+ char_vector cv('a', 'b');
+ seqs_type seqs(iv, cv);
+ view v(seqs);
+
+ BOOST_TEST(at_c<0>(v) == make_vector(1, 'a'));
+ BOOST_TEST(at_c<1>(v) == make_vector(2, 'b'));
+ BOOST_TEST(front(v) == make_vector(1, 'a'));
+ BOOST_TEST(back(v) == make_vector(2, 'b'));
+ BOOST_TEST(*next(begin(v)) == make_vector(2, 'b'));
+ BOOST_TEST(*prior(end(v)) == make_vector(2, 'b'));
+ BOOST_TEST(advance_c<2>(begin(v)) == end(v));
+ BOOST_TEST(advance_c<-2>(end(v)) == begin(v));
+ BOOST_TEST(distance(begin(v), end(v)) == 2);
+
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<boost::fusion::result_of::begin<view>::type, boost::fusion::result_of::end<view>::type>::value == 2));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector2<int,char> >));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector2<int,char> >));
+ }
+ {
+ using namespace boost;
+ typedef mpl::vector2<int,bool> v1_type;
+ typedef mpl::vector2<char,long> v2_type;
+ typedef fusion::vector<v1_type&, v2_type&> seqs_type;
+ typedef fusion::zip_view<seqs_type> view;
+
+ v1_type v1;
+ v2_type v2;
+ seqs_type seqs(v1,v2);
+ view v(seqs);
+ BOOST_TEST((fusion::at_c<0>(v) == mpl::vector2<int,char>()));
+ BOOST_TEST((fusion::at_c<1>(v) == mpl::vector2<bool,long>()));
+ BOOST_TEST((fusion::front(v) == mpl::vector2<int,char>()));
+ BOOST_TEST((fusion::back(v) == mpl::vector2<bool,long>()));
+ BOOST_TEST((*fusion::next(fusion::begin(v)) == mpl::vector2<bool,long>()));
+ BOOST_TEST((*fusion::prior(fusion::end(v)) == mpl::vector2<bool,long>()));
+ BOOST_TEST(fusion::advance_c<2>(fusion::begin(v)) == fusion::end(v));
+ BOOST_TEST(fusion::advance_c<-2>(fusion::end(v)) == fusion::begin(v));
+ BOOST_TEST(fusion::distance(fusion::begin(v), fusion::end(v)) == 2);
+ }
+ return boost::report_errors();
+}
+
diff --git a/src/boost/libs/fusion/test/sequence/zip_view2.cpp b/src/boost/libs/fusion/test/sequence/zip_view2.cpp
new file mode 100644
index 000000000..b63a27446
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/zip_view2.cpp
@@ -0,0 +1,64 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2006 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/view/zip_view.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/container/list.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/iterator/next.hpp>
+#include <boost/fusion/iterator/prior.hpp>
+#include <boost/fusion/iterator/deref.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/equal_to.hpp>
+
+#include <boost/type_traits/is_reference.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/static_assert.hpp>
+
+int main()
+{
+ {
+ using namespace boost::fusion;
+ typedef vector2<int,int> int_vector;
+ typedef vector2<char,char> char_vector;
+ typedef list<char,char> char_list;
+ typedef vector<int_vector&, char_vector&, char_list&> seqs_type;
+ typedef zip_view<seqs_type> view;
+
+ BOOST_MPL_ASSERT((boost::mpl::equal_to<boost::fusion::result_of::size<view>::type, boost::fusion::result_of::size<int_vector>::type>));
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::size<view>::value == 2));
+
+ int_vector iv(1,2);
+ char_vector cv('a', 'b');
+ char_list cl('y','z');
+ seqs_type seqs(iv, cv, cl);
+ view v(seqs);
+
+ BOOST_TEST(at_c<0>(v) == make_vector(1, 'a', 'y'));
+ BOOST_TEST(at_c<1>(v) == make_vector(2, 'b', 'z'));
+ BOOST_TEST(front(v) == make_vector(1, 'a', 'y'));
+ BOOST_TEST(*next(begin(v)) == make_vector(2, 'b', 'z'));
+ BOOST_TEST(advance_c<2>(begin(v)) == end(v));
+ BOOST_TEST(distance(begin(v), end(v)) == 2);
+ BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<boost::fusion::result_of::begin<view>::type, boost::fusion::result_of::end<view>::type>::value == 2));
+
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_c<view,0>::type, vector3<int,char,char> >));
+ BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of<boost::fusion::result_of::begin<view>::type>::type, vector3<int,char,char> >));
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/sequence/zip_view_ignore.cpp b/src/boost/libs/fusion/test/sequence/zip_view_ignore.cpp
new file mode 100644
index 000000000..d22bf70ff
--- /dev/null
+++ b/src/boost/libs/fusion/test/sequence/zip_view_ignore.cpp
@@ -0,0 +1,58 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2007 Dan Marsden
+
+ 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/detail/lightweight_test.hpp>
+#include <boost/fusion/container/vector.hpp>
+#include <boost/fusion/view/zip_view.hpp>
+#include <boost/fusion/support/unused.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/fusion/sequence/intrinsic.hpp>
+
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+int main()
+{
+ using namespace boost::fusion;
+ {
+ typedef vector2<int,int> int_vector;
+ typedef vector2<char,char> char_vector;
+ typedef vector<int_vector&, unused_type const&, char_vector&> seqs_type;
+ typedef zip_view<seqs_type> view;
+
+ int_vector iv(1,2);
+ char_vector cv('a','b');
+ seqs_type seq(iv, unused, cv);
+ view v(seq);
+
+ BOOST_TEST(at_c<0>(front(v)) == 1);
+ BOOST_TEST(at_c<2>(front(v)) == 'a');
+ BOOST_TEST(at_c<0>(back(v)) == 2);
+ BOOST_TEST(at_c<2>(back(v)) == 'b');
+
+ typedef boost::fusion::result_of::begin<view>::type first_iterator;
+ typedef boost::fusion::result_of::value_of<first_iterator>::type first_element;
+
+ typedef boost::fusion::result_of::at_c<first_element, 0>::type e0;
+ typedef boost::fusion::result_of::at_c<first_element, 2>::type e2;
+ BOOST_MPL_ASSERT((boost::is_same<e0, int&>));
+ BOOST_MPL_ASSERT((boost::is_same<e2, char&>));
+
+ BOOST_TEST(size(front(v)) == 3);
+
+ typedef boost::fusion::result_of::value_at_c<view, 0>::type first_value_at;
+ typedef boost::fusion::result_of::value_at_c<first_value_at, 0>::type v0;
+ typedef boost::fusion::result_of::value_at_c<first_value_at, 2>::type v2;
+
+ BOOST_MPL_ASSERT((boost::is_same<v0, int>));
+ BOOST_MPL_ASSERT((boost::is_same<v2, char>));
+
+ BOOST_TEST(at_c<0>(at_c<0>(v)) == 1);
+ BOOST_TEST(at_c<2>(at_c<0>(v)) == 'a');
+ }
+ return boost::report_errors();
+}
diff --git a/src/boost/libs/fusion/test/support/and.cpp b/src/boost/libs/fusion/test/support/and.cpp
new file mode 100644
index 000000000..604a68d74
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/and.cpp
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2016 Lee Clagett
+ Copyright (c) 2018 Kohei Takahashi
+ 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/config.hpp>
+
+#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+# error "does not meet requirements"
+#endif
+
+#include <boost/fusion/support/detail/and.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/assert.hpp>
+
+using namespace boost;
+using namespace boost::fusion::detail;
+
+BOOST_MPL_ASSERT((and_<>));
+BOOST_MPL_ASSERT_NOT((and_<false_type>));
+BOOST_MPL_ASSERT((and_<true_type>));
+BOOST_MPL_ASSERT_NOT((and_<true_type, false_type>));
+BOOST_MPL_ASSERT((and_<true_type, true_type>));
+BOOST_MPL_ASSERT_NOT((and_<true_type, true_type, false_type>));
+BOOST_MPL_ASSERT((and_<true_type, true_type, true_type>));
+BOOST_MPL_ASSERT((and_<true_type, mpl::true_>));
diff --git a/src/boost/libs/fusion/test/support/index_sequence.cpp b/src/boost/libs/fusion/test/support/index_sequence.cpp
new file mode 100644
index 000000000..019ae4742
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/index_sequence.cpp
@@ -0,0 +1,32 @@
+/*=============================================================================
+ Copyright (c) 2015,2018 Kohei Takahashi
+
+ 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/config.hpp>
+
+#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
+# error "does not meet requirements"
+#endif
+
+#include <boost/fusion/support/detail/index_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+using namespace boost::fusion;
+
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<0>::type, detail::index_sequence<> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<1>::type, detail::index_sequence<0> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<2>::type, detail::index_sequence<0, 1> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<3>::type, detail::index_sequence<0, 1, 2> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<4>::type, detail::index_sequence<0, 1, 2, 3> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<5>::type, detail::index_sequence<0, 1, 2, 3, 4> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<6>::type, detail::index_sequence<0, 1, 2, 3, 4, 5> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<7>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<8>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7> >));
+
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<15>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<16>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15> >));
+BOOST_MPL_ASSERT((boost::is_same<detail::make_index_sequence<17>::type, detail::index_sequence<0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16> >));
+
diff --git a/src/boost/libs/fusion/test/support/is_sequence.cpp b/src/boost/libs/fusion/test/support/is_sequence.cpp
new file mode 100644
index 000000000..428f63545
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/is_sequence.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2018 Louis Dionne
+
+ 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/fusion/support/is_sequence.hpp>
+#include <boost/static_assert.hpp>
+
+
+// Make sure fusion::is_sequence and fusion::is_native_fusion_sequence can be
+// used with an incomplete type.
+struct incomplete;
+BOOST_STATIC_ASSERT(!boost::fusion::traits::is_sequence<incomplete>::value);
+BOOST_STATIC_ASSERT(!boost::fusion::traits::is_native_fusion_sequence<incomplete>::value);
+
+int main() { }
diff --git a/src/boost/libs/fusion/test/support/is_view.cpp b/src/boost/libs/fusion/test/support/is_view.cpp
new file mode 100644
index 000000000..068f1a80d
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/is_view.cpp
@@ -0,0 +1,15 @@
+/*=============================================================================
+ Copyright (c) 2018 Nikita Kniazev
+
+ 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/fusion/support/is_view.hpp>
+#include <boost/static_assert.hpp>
+
+
+// Make sure fusion::is_view can be used with non fusion types.
+struct incomplete;
+BOOST_STATIC_ASSERT(!boost::fusion::traits::is_view<incomplete>::value);
+
+int main() { }
diff --git a/src/boost/libs/fusion/test/support/pair_container.hpp b/src/boost/libs/fusion/test/support/pair_container.hpp
new file mode 100644
index 000000000..3e84f0588
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_container.hpp
@@ -0,0 +1,27 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/core/ignore_unused.hpp>
+#include <boost/fusion/support/pair.hpp>
+
+using namespace boost::fusion;
+
+template <typename C>
+void copy()
+{
+ pair<int, C> src;
+ pair<int, C> dest = src;
+ boost::ignore_unused(dest);
+}
+
+void test()
+{
+ copy<FUSION_SEQUENCE<> >();
+ copy<FUSION_SEQUENCE<TEST_TYPE> >();
+ copy<FUSION_SEQUENCE<TEST_TYPE, TEST_TYPE> >();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_deque.cpp b/src/boost/libs/fusion/test/support/pair_deque.cpp
new file mode 100644
index 000000000..27da30ec4
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_deque.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/container/deque/deque.hpp>
+
+#define FUSION_SEQUENCE deque
+#define TEST_TYPE int
+#include "./pair_container.hpp"
+
+int main()
+{
+ test();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_list.cpp b/src/boost/libs/fusion/test/support/pair_list.cpp
new file mode 100644
index 000000000..ce478ff68
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_list.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/container/list/list.hpp>
+
+#define FUSION_SEQUENCE list
+#define TEST_TYPE int
+#include "./pair_container.hpp"
+
+int main()
+{
+ test();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_map.cpp b/src/boost/libs/fusion/test/support/pair_map.cpp
new file mode 100644
index 000000000..d472ba269
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_map.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/container/map/map.hpp>
+
+#define FUSION_SEQUENCE map
+#define TEST_TYPE pair<int,int>
+#include "./pair_container.hpp"
+
+int main()
+{
+ test();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_nest.cpp b/src/boost/libs/fusion/test/support/pair_nest.cpp
new file mode 100644
index 000000000..fbc253cbe
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_nest.cpp
@@ -0,0 +1,24 @@
+/*=============================================================================
+ Copyright (c) 2015 Kohei Takahashi
+
+ 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/core/ignore_unused.hpp>
+#include <boost/fusion/support/pair.hpp>
+
+using namespace boost::fusion;
+
+template <typename C>
+void copy()
+{
+ pair<int, C> src;
+ pair<int, C> dest = src;
+ boost::ignore_unused(dest);
+}
+
+int main()
+{
+ copy<pair<void, float> >();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_set.cpp b/src/boost/libs/fusion/test/support/pair_set.cpp
new file mode 100644
index 000000000..b346a8ba5
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_set.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/container/set/set.hpp>
+
+#define FUSION_SEQUENCE set
+#define TEST_TYPE int
+#include "./pair_container.hpp"
+
+int main()
+{
+ test();
+}
+
diff --git a/src/boost/libs/fusion/test/support/pair_vector.cpp b/src/boost/libs/fusion/test/support/pair_vector.cpp
new file mode 100644
index 000000000..62a4f2b55
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/pair_vector.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2014 Kohei Takahashi
+
+ 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/fusion/container/vector/vector.hpp>
+
+#define FUSION_SEQUENCE vector
+#define TEST_TYPE int
+#include "./pair_container.hpp"
+
+int main()
+{
+ test();
+}
+
diff --git a/src/boost/libs/fusion/test/support/tag_of.cpp b/src/boost/libs/fusion/test/support/tag_of.cpp
new file mode 100644
index 000000000..ee2da10d4
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/tag_of.cpp
@@ -0,0 +1,17 @@
+/*=============================================================================
+ Copyright (c) 2018 Louis Dionne
+
+ 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/fusion/support/tag_of.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+
+// Make sure tag_of can be used with an incomplete type.
+struct incomplete;
+typedef boost::fusion::traits::tag_of<incomplete>::type Tag;
+BOOST_STATIC_ASSERT((boost::is_same<Tag, boost::fusion::non_fusion_tag>::value));
+
+int main() { }
diff --git a/src/boost/libs/fusion/test/support/unused.cpp b/src/boost/libs/fusion/test/support/unused.cpp
new file mode 100644
index 000000000..8b9e62602
--- /dev/null
+++ b/src/boost/libs/fusion/test/support/unused.cpp
@@ -0,0 +1,96 @@
+/*=============================================================================
+ Copyright (c) 2018 Kohei Takahashi
+
+ 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/config.hpp>
+#include <boost/fusion/support/unused.hpp>
+#include <boost/type_traits/detail/yes_no_type.hpp>
+#include <boost/static_assert.hpp>
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+#include <utility>
+#endif
+
+struct T { };
+
+void unused_construction()
+{
+ boost::fusion::unused_type dephault;
+
+ boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED parenthesis = boost::fusion::unused_type();
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED brace{};
+ boost::fusion::unused_type BOOST_ATTRIBUTE_UNUSED list_copy = {};
+#endif
+
+ boost::fusion::unused_type copy_copy BOOST_ATTRIBUTE_UNUSED = dephault;
+ boost::fusion::unused_type copy_direct BOOST_ATTRIBUTE_UNUSED (dephault);
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ boost::fusion::unused_type copy_copy_brace_direct BOOST_ATTRIBUTE_UNUSED = {dephault};
+ boost::fusion::unused_type copy_direct_brace BOOST_ATTRIBUTE_UNUSED {dephault};
+#endif
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ boost::fusion::unused_type move_copy BOOST_ATTRIBUTE_UNUSED = std::move(dephault);
+ boost::fusion::unused_type move_direct BOOST_ATTRIBUTE_UNUSED (std::move(dephault));
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ boost::fusion::unused_type move_copy_brace_direct BOOST_ATTRIBUTE_UNUSED = {std::move(dephault)};
+ boost::fusion::unused_type move_direct_brace BOOST_ATTRIBUTE_UNUSED {std::move(dephault)};
+#endif
+#endif
+
+
+ T value;
+
+ boost::fusion::unused_type T_copy_copy BOOST_ATTRIBUTE_UNUSED = value;
+ boost::fusion::unused_type T_copy_direct BOOST_ATTRIBUTE_UNUSED (value);
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ boost::fusion::unused_type T_copy_copy_brace_direct BOOST_ATTRIBUTE_UNUSED = {value};
+ boost::fusion::unused_type T_copy_direct_brace BOOST_ATTRIBUTE_UNUSED {value};
+#endif
+
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ boost::fusion::unused_type T_move_copy BOOST_ATTRIBUTE_UNUSED = std::move(value);
+ boost::fusion::unused_type T_move_direct BOOST_ATTRIBUTE_UNUSED (std::move(value));
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ boost::fusion::unused_type T_move_copy_brace_direct BOOST_ATTRIBUTE_UNUSED = {std::move(value)};
+ boost::fusion::unused_type T_move_direct_brace BOOST_ATTRIBUTE_UNUSED {std::move(value)};
+#endif
+#endif
+}
+
+void unused_assignment()
+{
+ boost::fusion::unused_type val1, val2;
+
+ val1 = val2;
+#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+ val1 = {};
+#endif
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ val1 = std::move(val2);
+#endif
+
+
+ T value;
+
+ val1 = value;
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ val1 = std::move(value);
+#endif
+}
+
+boost::type_traits::yes_type test_unused(boost::fusion::detail::unused_only const&);
+boost::type_traits::no_type test_unused(...);
+
+void only_unused()
+{
+ BOOST_STATIC_ASSERT((sizeof(test_unused(boost::fusion::unused)) == sizeof(boost::type_traits::yes_type)));
+ BOOST_STATIC_ASSERT((sizeof(test_unused(0)) == sizeof(boost::type_traits::no_type)));
+
+ boost::fusion::unused_type my_unused;
+ (void)my_unused;
+ BOOST_STATIC_ASSERT((sizeof(test_unused(my_unused)) == sizeof(boost::type_traits::yes_type)));
+}