├── .clang-format ├── .github └── workflows │ └── Tests.yaml ├── .gitignore ├── .travis.yml ├── CMake ├── CTestConfig.cmake ├── SetupDoxygen.cmake └── SetupStandardese.cmake ├── CMakeLists.txt ├── LICENSE ├── README.md ├── appveyor.yml ├── debian ├── README ├── changelog ├── compat ├── control ├── docs ├── libbrigand-dev.dirs ├── libbrigand-dev.install ├── rules └── source │ └── format ├── doc ├── Doxyfile.in └── GroupDefs.h ├── examples ├── CMakeLists.txt ├── algorithms │ └── flatten.cpp └── sequences │ ├── append.cpp │ └── join.cpp ├── include ├── brigand │ ├── adapted.hpp │ ├── adapted │ │ ├── fusion.hpp │ │ ├── integral_list.hpp │ │ ├── list.hpp │ │ ├── pair.hpp │ │ ├── tuple.hpp │ │ └── variant.hpp │ ├── algorithms.hpp │ ├── algorithms │ │ ├── all.hpp │ │ ├── any.hpp │ │ ├── count.hpp │ │ ├── detail │ │ │ ├── find.hpp │ │ │ ├── fold.hpp │ │ │ └── non_null.hpp │ │ ├── find.hpp │ │ ├── flatten.hpp │ │ ├── fold.hpp │ │ ├── for_each.hpp │ │ ├── for_each_args.hpp │ │ ├── index_of.hpp │ │ ├── is_set.hpp │ │ ├── merge.hpp │ │ ├── none.hpp │ │ ├── partition.hpp │ │ ├── remove.hpp │ │ ├── replace.hpp │ │ ├── reverse.hpp │ │ ├── select.hpp │ │ ├── sort.hpp │ │ ├── split.hpp │ │ ├── split_at.hpp │ │ ├── transform.hpp │ │ └── wrap.hpp │ ├── brigand.hpp │ ├── config.hpp │ ├── functions.hpp │ ├── functions │ │ ├── arithmetic.hpp │ │ ├── arithmetic │ │ │ ├── complement.hpp │ │ │ ├── divides.hpp │ │ │ ├── identity.hpp │ │ │ ├── max.hpp │ │ │ ├── min.hpp │ │ │ ├── minus.hpp │ │ │ ├── modulo.hpp │ │ │ ├── negate.hpp │ │ │ ├── next.hpp │ │ │ ├── plus.hpp │ │ │ ├── prev.hpp │ │ │ └── times.hpp │ │ ├── bitwise.hpp │ │ ├── bitwise │ │ │ ├── bitand.hpp │ │ │ ├── bitor.hpp │ │ │ ├── bitxor.hpp │ │ │ ├── shift_left.hpp │ │ │ └── shift_right.hpp │ │ ├── comparison │ │ │ ├── equal_to.hpp │ │ │ ├── greater.hpp │ │ │ ├── greater_equal.hpp │ │ │ ├── less.hpp │ │ │ ├── less_equal.hpp │ │ │ └── not_equal_to.hpp │ │ ├── comparisons.hpp │ │ ├── eval_if.hpp │ │ ├── if.hpp │ │ ├── lambda.hpp │ │ ├── lambda │ │ │ ├── apply.hpp │ │ │ ├── bind.hpp │ │ │ └── substitute.hpp │ │ ├── logical.hpp │ │ ├── logical │ │ │ ├── and.hpp │ │ │ ├── not.hpp │ │ │ ├── or.hpp │ │ │ └── xor.hpp │ │ ├── misc.hpp │ │ └── misc │ │ │ ├── always.hpp │ │ │ ├── repeat.hpp │ │ │ └── sizeof.hpp │ ├── sequences.hpp │ ├── sequences │ │ ├── append.hpp │ │ ├── at.hpp │ │ ├── back.hpp │ │ ├── clear.hpp │ │ ├── contains.hpp │ │ ├── erase.hpp │ │ ├── filled_list.hpp │ │ ├── front.hpp │ │ ├── has_key.hpp │ │ ├── insert.hpp │ │ ├── keys_as_sequence.hpp │ │ ├── list.hpp │ │ ├── make_sequence.hpp │ │ ├── map.hpp │ │ ├── pair.hpp │ │ ├── range.hpp │ │ ├── set.hpp │ │ ├── size.hpp │ │ └── values_as_sequence.hpp │ ├── types.hpp │ ├── types │ │ ├── args.hpp │ │ ├── bool.hpp │ │ ├── empty_base.hpp │ │ ├── has_type.hpp │ │ ├── inherit.hpp │ │ ├── inherit_linearly.hpp │ │ ├── integer.hpp │ │ ├── integral_constant.hpp │ │ ├── no_such_type.hpp │ │ ├── operators.hpp │ │ ├── real.hpp │ │ ├── type.hpp │ │ └── voidp.hpp │ └── version.hpp └── standalone │ └── brigand.hpp ├── libbrigand.pc.in ├── meta └── libraries.json ├── script ├── briganddoc.py ├── embed.py ├── header_guard.py └── pre-commit └── test ├── CMakeLists.txt ├── always.cpp ├── apply.cpp ├── args.cpp ├── bind.cpp ├── bitwise_test.cpp ├── comparison_test.cpp ├── config_test.cpp ├── count_test.cpp ├── erase_c_test.cpp ├── eval_if_test.cpp ├── find.cpp ├── flatten.cpp ├── fold.cpp ├── for_each.cpp ├── fusion_test.cpp ├── identity.cpp ├── if_test.cpp ├── include_test.cpp ├── index_of.cpp ├── inherit.cpp ├── inherit_linearly.cpp ├── integer.cpp ├── integral_list_test.cpp ├── integral_test.cpp ├── is_set_test.cpp ├── keys_as_sequence.cpp ├── list_test.cpp ├── logical_test.cpp ├── main.cpp ├── make_sequence_test.cpp ├── map_test.cpp ├── map_test.hpp ├── merge_test.cpp ├── pair_test.cpp ├── partition_test.cpp ├── predicate_reduction_test.cpp ├── range_test.cpp ├── real.cpp ├── remove_test.cpp ├── repeat_test.cpp ├── replace.cpp ├── reverse_test.cpp ├── select.cpp ├── set_test.cpp ├── sizeof.cpp ├── sort_test.cpp ├── split.cpp ├── split_at.cpp ├── transform.cpp ├── tuple_test.cpp ├── values_as_sequence.cpp └── variant_test.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html 2 | 3 | BasedOnStyle: LLVM 4 | 5 | AccessModifierOffset: -4 6 | AlwaysBreakTemplateDeclarations: true 7 | BreakBeforeBraces: Allman 8 | ColumnLimit: 100 9 | IndentWidth: 4 10 | NamespaceIndentation: Inner 11 | PointerAlignment: Middle 12 | TabWidth: 4 13 | UseTab: Never 14 | -------------------------------------------------------------------------------- /.github/workflows/Tests.yaml: -------------------------------------------------------------------------------- 1 | 2 | name: Tests 3 | 4 | on: 5 | pull_request: 6 | push: 7 | branches-ignore: 8 | - gh-pages 9 | 10 | concurrency: 11 | group: ${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | unit_tests: 16 | name: Unit 17 | strategy: 18 | matrix: 19 | host: [ubuntu-latest, macos-latest] 20 | # Test with these compilers. Currently, we just select whichever version 21 | # is the default on the host. Note that the default `g++` is only a 22 | # wrapper around AppleClang on macOS. 23 | compiler: [g++, clang++] 24 | fail-fast: false 25 | runs-on: ${{ matrix.host }} 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v2 29 | - name: Build and test 30 | run: | 31 | mkdir build && cd build 32 | cmake \ 33 | -D CMAKE_CXX_COMPILER=${{ matrix.compiler }} \ 34 | .. 35 | make 36 | make test 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | project 31 | build 32 | .idea -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: cpp 3 | 4 | # More complete test matrix 5 | matrix: 6 | include: 7 | - os: linux 8 | compiler: gcc 9 | addons: 10 | apt: 11 | sources: ['ubuntu-toolchain-r-test'] 12 | packages: ['g++-4.8'] 13 | env: TOOLSET=g++-4.8 14 | 15 | - os: linux 16 | compiler: gcc 17 | addons: 18 | apt: 19 | sources: ['ubuntu-toolchain-r-test'] 20 | packages: ['g++-4.9'] 21 | env: TOOLSET=g++-4.9 22 | 23 | - os: linux 24 | compiler: gcc 25 | addons: 26 | apt: 27 | sources: ['ubuntu-toolchain-r-test'] 28 | packages: ['g++-5', 'graphviz', 'doxygen'] 29 | env: TOOLSET=g++-5 GENERATE_DOCUMENTATION=true 30 | 31 | - os: linux 32 | compiler: clang 33 | addons: 34 | apt: 35 | sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5'] 36 | packages: ['clang-3.5'] 37 | env: TOOLSET=clang++-3.5 38 | 39 | - os: linux 40 | compiler: clang 41 | addons: 42 | apt: 43 | sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] 44 | packages: ['clang-3.6'] 45 | env: TOOLSET=clang++-3.6 46 | 47 | - os: osx 48 | compiler: clang 49 | env: TOOLSET=clang++ 50 | 51 | # Install boost 52 | before_install: 53 | - wget http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download -O /tmp/boost.tar.bz2 54 | - tar jxf /tmp/boost.tar.bz2 55 | - mv boost_1_58_0 $PWD/boost-trunk 56 | - export BOOST_ROOT="$PWD/boost-trunk" 57 | - cd $TRAVIS_BUILD_DIR 58 | 59 | # Prepare build 60 | before_script: 61 | - mkdir build 62 | - cd build 63 | - cmake .. -DCMAKE_CXX_COMPILER=$TOOLSET 64 | 65 | script: 66 | - make VERBOSE=1 67 | - ./brigand_test 68 | 69 | after_success: 70 | - if [ "${GENERATE_DOCUMENTATION}" == "true" ]; then 71 | cd $TRAVIS_BUILD_DIR/build; 72 | make doxygen VERBOSE=1; 73 | cd $TRAVIS_BUILD_DIR; 74 | fi 75 | 76 | deploy: 77 | provider: pages 78 | skip_cleanup: true 79 | local_dir: build/doc/html/ 80 | github_token: $GITHUB_API_TOKEN 81 | on: 82 | branch: master 83 | condition: $GENERATE_DOCUMENTATION = true 84 | -------------------------------------------------------------------------------- /CMake/CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | ENABLE_TESTING() 2 | INCLUDE(CTest) 3 | set(CTEST_PROJECT_NAME "Brigand") 4 | -------------------------------------------------------------------------------- /CMake/SetupDoxygen.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_package(Doxygen) 3 | if (DOXYGEN_FOUND) 4 | set(DOXYGEN_GROUPS_FILE "${CMAKE_BINARY_DIR}/doc/GroupDefs.h") 5 | 6 | set(DOXYGEN_GENERATE_HTML "YES") 7 | set(DOXYGEN_GENERATE_XML "NO") 8 | configure_file( 9 | doc/Doxyfile.in 10 | ${PROJECT_BINARY_DIR}/doc/DoxyfileHtml @ONLY IMMEDIATE 11 | ) 12 | # Configure file that contains doxygen groups 13 | configure_file(doc/GroupDefs.h ${DOXYGEN_GROUPS_FILE}) 14 | 15 | add_custom_target( 16 | doxygen 17 | COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/DoxyfileHtml 2>&1 18 | DEPENDS 19 | ${PROJECT_BINARY_DIR}/doc/DoxyfileHtml 20 | ${DOXYGEN_GROUPS_FILE} 21 | ) 22 | 23 | set(DOXYGEN_GENERATE_HTML "NO") 24 | set(DOXYGEN_GENERATE_XML "YES") 25 | configure_file( 26 | doc/Doxyfile.in 27 | ${PROJECT_BINARY_DIR}/doc/DoxyfileXml @ONLY IMMEDIATE 28 | ) 29 | add_custom_target( 30 | doxygen-xml 31 | COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/DoxyfileXml 32 | DEPENDS 33 | ${PROJECT_BINARY_DIR}/doc/DoxyfileXml 34 | ${DOXYGEN_GROUPS_FILE} 35 | ) 36 | endif (DOXYGEN_FOUND) 37 | -------------------------------------------------------------------------------- /CMake/SetupStandardese.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_program(STANDARDESE standardese HINTS ${STANDARDESE_ROOT}) 3 | 4 | if (STANDARDESE) 5 | message(STATUS "Found standardese for documentation generation") 6 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc/standardese) 7 | add_custom_target( 8 | standardese 9 | COMMAND ${STANDARDESE} 10 | -I${CMAKE_SOURCE_DIR}/include 11 | --input.blacklist_namespace=detail 12 | --compilation.comments_in_macro=false 13 | --output.require_comment_for_full_synopsis=false 14 | --output.format=html 15 | ${CMAKE_SOURCE_DIR}/include 16 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/standardese 17 | ) 18 | endif (STANDARDESE) 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Brigand Meta-programming library 2 | ================================ 3 | 4 | ![A brigand](https://raw.githubusercontent.com/wiki/edouarda/brigand/brigand_small.jpg) 5 | 6 | [![Build Status](https://travis-ci.org/edouarda/brigand.svg?branch=master)](https://travis-ci.org/edouarda/brigand) 7 | 8 | [![Build Status](https://ci.appveyor.com/api/projects/status/github/edouarda/brigand)](https://ci.appveyor.com/project/edouarda/brigand) 9 | 10 | # Introduction 11 | 12 | Brigand is a light-weight, fully functional, instant-compile time C++ 11 meta-programming library. 13 | 14 | Everything you were doing with Boost.MPL can be done with Brigand. And if that's not the case, open an issue! 15 | 16 | # Learning 17 | 18 | Should you wish to learn more, feel free to [watch our Meeting C++ 2015 lightning talk](https://www.youtube.com/watch?v=B8XSDhWx7hY)! 19 | 20 | Want more? Our [CppCon 2016 presentation](https://www.youtube.com/watch?v=ky0JdPh_LgE) explains in details the library concepts and goes through two concrete usages. 21 | 22 | If you are looking to learn the concepts of metaprogramming, [have a look at our free e-book](http://www.oreilly.com/programming/free/practical-c-plus-plus-metaprogramming.csp). 23 | 24 | # Tutorials 25 | 26 | * [Introduction](https://github.com/edouarda/brigand/wiki/Introduction) 27 | * [Algorithms](https://github.com/edouarda/brigand/wiki/Algorithms) 28 | * [Runtime](https://github.com/edouarda/brigand/wiki/Runtime) 29 | 30 | # Documentation 31 | 32 | The documentation is available [here](https://github.com/edouarda/brigand/wiki). 33 | 34 | # Contributors 35 | 36 | We'd like to thank the following contributors, in alphabetical order 37 | 38 | * Odin Holmes 39 | * Marek Kurdej 40 | * Jonathan Poelen 41 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # Notes: 2 | # - Minimal appveyor.yml file is an empty file. All sections are optional. 3 | # - Indent each level of configuration with 2 spaces. Do not use tabs! 4 | # - All section names are case-sensitive. 5 | # - Section names should be unique on each level. 6 | 7 | #---------------------------------# 8 | # general configuration # 9 | #---------------------------------# 10 | 11 | # version format 12 | version: 1.0.{build} 13 | 14 | # you can use {branch} name in version format too 15 | # version: 1.0.{build}-{branch} 16 | 17 | #---------------------------------# 18 | # environment configuration # 19 | #---------------------------------# 20 | 21 | # Operating system (build VM template) 22 | os: Windows Server 2012 23 | 24 | # this is how to allow failing jobs in the matrix 25 | matrix: 26 | fast_finish: true # set this flag to immediately finish build once one of the jobs fails. 27 | 28 | 29 | #---------------------------------# 30 | # build configuration # 31 | #---------------------------------# 32 | 33 | # build platform, i.e. x86, x64, Any CPU. This setting is optional. 34 | platform: 35 | 36 | # build Configuration, i.e. Debug, Release, etc. 37 | #configuration: 38 | # - Debug 39 | # - Release 40 | 41 | clone_folder: c:\sources\brigand 42 | 43 | build: 44 | parallel: true 45 | project: c:\sources\brigand\build\brigand.sln 46 | verbosity: minimal 47 | 48 | # scripts to run before build 49 | before_build: 50 | - cd c:\sources\brigand 51 | - md build 52 | - cd build 53 | - cmake -G"Visual Studio 14 2015 Win64" -DBOOST_ROOT="C:\Libraries\boost_1_59_0" .. 54 | 55 | # scripts to run after build 56 | after_build: 57 | 58 | build_script: 59 | - cd c:\sources\brigand\build 60 | - msbuild /target:brigand_test /p:Configuration=Release;Platform="x64" brigand.sln 61 | - msbuild /target:brigand_test /p:Configuration=Debug;Platform="x64" brigand.sln 62 | 63 | # scripts to run before tests 64 | before_test: 65 | 66 | # scripts to run after tests 67 | after_test: 68 | 69 | # to run your custom scripts instead of automatic tests 70 | test_script: 71 | - cd c:\sources\brigand\build 72 | - cmd: ctest -C Debug -VV 73 | - cmd: ctest -C Release -VV 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /debian/README: -------------------------------------------------------------------------------- 1 | The Debian Package brigand 2 | ---------------------------- 3 | 4 | First version of the Debian Package fro brigand 5 | 6 | -- The Brigand Team Mon, 20 Jun 2016 09:35:48 +0200 7 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | brigand (1.2.0) unstable; urgency=low 2 | 3 | * New split_at algorithm 4 | * New pop_back_n and pop_front_n functions 5 | * New keys_as_sequence, values_as_sequence and as_sequence functions 6 | * New index_of and index_if functions 7 | * Added basic compiler detection macros 8 | * The standalone header is now correctly updated at each build 9 | * Fixed algorithms that didn't work with types other than brigand::list 10 | 11 | -- The Brigand Team Mon, 20 Jun 2016 09:35:48 +0200 12 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: brigand 2 | Priority: optional 3 | Maintainer: Edouard Alligand 4 | Build-Depends: debhelper (>= 9), cmake 5 | Standards-Version: 3.9.5 6 | Section: libs 7 | Homepage: https://github.com/edouarda/brigand 8 | 9 | Package: libbrigand-dev 10 | Section: libdevel 11 | Architecture: all 12 | Depends: ${misc:Depends} 13 | Description: C++ 11 meta-programming library. 14 | Light-weight, fully functional, instant-compile time C++ 11 meta-programming library. 15 | Everything you were doing with Boost.MPL can be done with Brigand. 16 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /debian/libbrigand-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /debian/libbrigand-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/brigand 2 | usr/lib/pkgconfig/* 3 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | DH_VERBOSE = 1 5 | 6 | # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* 7 | DPKG_EXPORT_BUILDFLAGS = 1 8 | include /usr/share/dpkg/default.mk 9 | 10 | # see FEATURE AREAS in dpkg-buildflags(1) 11 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 12 | 13 | # see ENVIRONMENT in dpkg-buildflags(1) 14 | # package maintainers to append CFLAGS 15 | export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 16 | # package maintainers to append LDFLAGS 17 | export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 18 | 19 | 20 | # main packaging script based on dh7 syntax 21 | %: 22 | dh $@ --parallel 23 | 24 | override_dh_auto_install: 25 | dh_auto_install --destdir=debian/tmp 26 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /doc/GroupDefs.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(brigand_examples 2 | algorithms/flatten.cpp 3 | sequences/append.cpp 4 | sequences/join.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /examples/algorithms/flatten.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file examples/algorithms/flatten.cpp 3 | Example of using brigand::flatten 4 | 5 | @copyright Edouard Alligand and Joel Falcou 2015-2017 6 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | /// [flatten_simple_example] 10 | #include 11 | 12 | using list1 = brigand::list; 13 | using list2 = brigand::list; 14 | using flat_list = brigand::flatten< 15 | brigand::list>>>; 16 | 17 | static_assert( 18 | std::is_same>::value, 20 | "failed to compile brigand::flatten example"); 21 | /// [flatten_simple_example] 22 | -------------------------------------------------------------------------------- /examples/sequences/append.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file append.cpp 3 | Example of using brigand::append 4 | 5 | @copyright Edouard Alligand and Joel Falcou 2015-2017 6 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | /// [append_simple_example] 10 | #include 11 | 12 | using list1 = brigand::list; 13 | using list2 = brigand::list; 14 | using appended_list = brigand::append< 15 | list1, list2, brigand::list>>; 16 | 17 | static_assert(std::is_same>>::value, 19 | "failed to compile brigand::append example"); 20 | /// [append_simple_example] 21 | 22 | /// [append_lazy_example] 23 | using list3 = brigand::list; 24 | using list4 = brigand::list; 25 | using lazy_appended_list = 26 | brigand::lazy::append>>; 27 | 28 | static_assert(std::is_same>>::value, 31 | "failed to compile brigand::append example"); 32 | /// [append_lazy_example] 33 | -------------------------------------------------------------------------------- /examples/sequences/join.cpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file join.cpp 3 | Example of using brigand::join 4 | 5 | @copyright Edouard Alligand and Joel Falcou 2015-2017 6 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 7 | */ 8 | 9 | /// [join_simple_example] 10 | #include 11 | 12 | using list1 = brigand::list; 13 | using list2 = brigand::list; 14 | using joined_list = 15 | brigand::join>>>; 16 | 17 | static_assert(std::is_same>>::value, 19 | "failed to compile brigand::append example"); 20 | /// [join_simple_example] 21 | 22 | /// [join_lazy_example] 23 | using list3 = brigand::list; 24 | using list4 = brigand::list; 25 | using lazy_joined_list = 26 | brigand::lazy::join>>>; 27 | 28 | static_assert(std::is_same>>::value, 31 | "failed to compile brigand::join example"); 32 | /// [join_lazy_example] 33 | -------------------------------------------------------------------------------- /include/brigand/adapted.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_HPP 8 | #define BOOST_BRIGAND_ADAPTED_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #if !defined(BRIGAND_NO_BOOST_SUPPORT) 16 | #include 17 | #include 18 | #endif 19 | #endif 20 | -------------------------------------------------------------------------------- /include/brigand/adapted/fusion.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_FUSION_HPP 8 | #define BOOST_BRIGAND_ADAPTED_FUSION_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace brigand 17 | { 18 | template 19 | using fusion_vector_wrapper = boost::fusion::vector; 20 | 21 | template 22 | using fusion_list_wrapper = boost::fusion::list; 23 | 24 | template 25 | using fusion_deque_wrapper = boost::fusion::deque; 26 | 27 | template 28 | using fusion_set_wrapper = boost::fusion::set; 29 | 30 | template using as_fusion_vector = wrap; 31 | template using as_fusion_deque = wrap; 32 | template using as_fusion_list = wrap; 33 | template using as_fusion_set = wrap; 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /include/brigand/adapted/integral_list.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_INTEGRAL_LIST_HPP 8 | #define BOOST_BRIGAND_ADAPTED_INTEGRAL_LIST_HPP 9 | 10 | #include 11 | #include 12 | 13 | namespace brigand 14 | { 15 | 16 | template 17 | struct make_integral : brigand::integral_constant 18 | { 19 | }; 20 | 21 | template 22 | using as_integral_list = transform>; 23 | } 24 | #endif 25 | -------------------------------------------------------------------------------- /include/brigand/adapted/list.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_LIST_HPP 8 | #define BOOST_BRIGAND_ADAPTED_LIST_HPP 9 | 10 | #include 11 | #include 12 | 13 | namespace brigand 14 | { 15 | namespace detail 16 | { 17 | template class Sequence> 18 | struct as_sequence_impl 19 | { 20 | using type = wrap; 21 | }; 22 | } // namespace detail 23 | 24 | template class Sequence> 25 | using as_sequence = typename detail::as_sequence_impl::type; 26 | 27 | template 28 | using as_list = as_sequence; 29 | 30 | } // namespace brigand 31 | #endif 32 | -------------------------------------------------------------------------------- /include/brigand/adapted/pair.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_PAIR_HPP 8 | #define BOOST_BRIGAND_ADAPTED_PAIR_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace brigand 15 | { 16 | template 17 | struct pair_wrapper_ 18 | { 19 | static_assert (sizeof...(T) == 2 20 | , "as_pair requires a type list of exactly two types" 21 | ); 22 | 23 | // type need to be defined or the error becomes a hard, non-static assert error 24 | using type = no_such_type_; 25 | }; 26 | 27 | template 28 | struct pair_wrapper_ 29 | { 30 | using type = std::pair; 31 | }; 32 | 33 | template 34 | using pair_wrapper = typename pair_wrapper_::type; 35 | 36 | template 37 | using as_pair = wrap; 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /include/brigand/adapted/tuple.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_TUPLE_HPP 8 | #define BOOST_BRIGAND_ADAPTED_TUPLE_HPP 9 | 10 | #include 11 | #include 12 | 13 | namespace brigand 14 | { 15 | template 16 | using tuple_wrapper = typename std::tuple; 17 | 18 | template 19 | using as_tuple = wrap; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /include/brigand/adapted/variant.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ADAPTED_VARIANT_HPP 8 | #define BOOST_BRIGAND_ADAPTED_VARIANT_HPP 9 | 10 | #include 11 | #include 12 | 13 | namespace brigand 14 | { 15 | template 16 | using variant_wrapper = typename boost::variant; 17 | 18 | template 19 | using as_variant = wrap; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /include/brigand/algorithms.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ALGORITHMS_HPP 8 | #define BOOST_BRIGAND_ALGORITHMS_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #endif 32 | -------------------------------------------------------------------------------- /include/brigand/algorithms/all.hpp: -------------------------------------------------------------------------------- 1 | /*! 2 | @file 3 | 4 | @copyright Edouard Alligand and Joel Falcou 2015-2017 5 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | */ 7 | #ifndef BOOST_BRIGAND_ALGORITHMS_ALL_HPP 8 | #define BOOST_BRIGAND_ALGORITHMS_ALL_HPP 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | namespace brigand 17 | { 18 | // defined(_LIBCPP_VERSION) && __cplusplus < 201402L 19 | // - std::initializer_list is not a literal type in libc++ until C++14 20 | #if defined(BRIGAND_COMP_MSVC_2013) || defined(BRIGAND_COMP_CUDA) || defined(BRIGAND_COMP_INTEL) || (defined(_LIBCPP_VERSION) && __cplusplus < 201402L) 21 | namespace detail 22 | { 23 | template 24 | struct all_helper : ::brigand::apply 25 | { 26 | }; 27 | 28 | template 29 | struct bools_ 30 | { 31 | }; 32 | template 33 | struct all_impl; 34 | 35 | template