diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9915256 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,164 @@ +# Copyright 2016 Peter Dimov +# Copyright 2017, 2018 James E. King III +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +# +# Generic Travis CI build script for boostorg repositories +# +# Instructions for customizing this script for your library: +# +# 1. Customize the compilers and language levels you want. +# 2. If you have move than include/, src/, test/, example/, examples/, +# benchmark/ or tools/ directories, set the environment variable DEPINST. +# For example if your build uses code in "bench/" and "fog/" directories: +# - DEPINST="--include bench --include fog" +# 3. If you want to enable Coverity Scan, you need to provide the environment +# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in +# your github settings. +# 4. Enable pull request builds in your boostorg/ account. +# 5. The default language level is C++03, you can change CXXSTD to modify it. +# +# That's it - the scripts will do everything else for you. +# + +sudo: false +dist: trusty +language: cpp + +env: + global: + # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties + # to use the default for a given environment, comment it out; recommend you build debug and release however.. + # - B2_ADDRESS_MODEL=address-model=64,32 + # - B2_LINK=link=shared,static + # - B2_THREADING=threading=multi,single + - B2_VARIANT=variant=release,debug + # - CXXSTD=03 + # - DEPINST="--include other" + +install: + - git clone https://github.com/jeking3/boost-ci.git boost-ci + - cp -pr boost-ci/ci boost-ci/.codecov.yml . + - source ci/travis/install.sh + +addons: + apt: + packages: + - binutils-gold + - gdb + - libc6-dbg + +branches: + only: + - develop + - master + +script: + - cd $BOOST_ROOT/libs/$SELF + - ci/travis/build.sh + +jobs: + include: + #################### Jobs to run on every pull request #################### + - os: linux + env: + - COMMENT="C++03" + - TOOLSET=gcc,gcc-7,clang + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test + - os: linux + env: + - COMMENT="C++11" + - TOOLSET=gcc,gcc-7,clang + - CXXSTD=11 + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test + - os: linux + env: + - COMMENT=valgrind + - TOOLSET=clang + - B2_VARIANT=variant=debug + - TESTFLAGS=testing.launcher=valgrind + - VALGRIND_OPTS=--error-exitcode=1 + addons: + apt: + packages: + - clang-5.0 + - libstdc++-7-dev + - valgrind + sources: + - llvm-toolchain-trusty-5.0 + - ubuntu-toolchain-r-test + + - os: linux + env: + - COMMENT=cppcheck + script: + - cd $BOOST_ROOT/libs/$SELF + - ci/travis/cppcheck.sh + + - os: linux + env: + - COMMENT=UBSAN + - B2_VARIANT=variant=debug + - TOOLSET=gcc-7 + - CXXFLAGS="cxxflags=-fno-omit-frame-pointer cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined" + - LINKFLAGS="linkflags=-fsanitize=undefined linkflags=-fno-sanitize-recover=undefined linkflags=-fuse-ld=gold" + - UBSAN_OPTIONS=print_stacktrace=1 + addons: + apt: + packages: + - g++-7 + sources: + - ubuntu-toolchain-r-test + + - os: linux + env: + - COMMENT=CodeCov + - TOOLSET=gcc-7 + addons: + apt: + packages: + - gcc-7 + - g++-7 + sources: + - ubuntu-toolchain-r-test + script: + - pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && export PATH=/tmp/lcov/bin:$PATH && which lcov && lcov --version && popd + - cd $BOOST_ROOT/libs/$SELF + - ci/travis/codecov.sh + + # does not work with sourced install shell yet: see + # https://travis-ci.org/jeking3/tokenizer/jobs/384903189 + # for a typical failure + # - os: osx + # osx_image: xcode9 + # env: + # - TOOLSET=clang + # - CXXSTD=03,11 + + #################### Jobs to run on pushes to master, develop ################### + + # Coverity Scan + - os: linux + if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push)) + env: + - COMMENT="Coverity Scan" + - TOOLSET=gcc + script: + - cd $BOOST_ROOT/libs/$SELF + - ci/travis/coverity.sh + +notifications: + email: + false + diff --git a/Jamfile b/Jamfile index cf5eb61..04e53d7 100644 --- a/Jamfile +++ b/Jamfile @@ -1,3 +1,10 @@ -# Empty Jamfile because the super project still expects one to appear here. -# Can be deleted once 'status/Jamfile.v2' has been updated in the super -# project. +# Boost.ConceptCheck Library Jamfile +# +# Copyright (c) 2018 James E. King III +# +# Use, modification, and distribution are subject to the +# Boost Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +# please order by name to ease maintenance +build-project test ; diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2dc0d6 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +ConceptCheck, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), +allows one to add explicit statement and checking of concepts in the style of the proposed C++ language extension. + +### License + +Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + +### Properties + +* C++03 +* Header-only + +### Build Status + +Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | +:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | +[`master`](https://github.com/boostorg/concept_check/tree/master) | [![Build Status](https://travis-ci.org/boostorg/concept_check.svg?branch=master)](https://travis-ci.org/boostorg/concept_check) | [![Build status](https://ci.appveyor.com/api/projects/status/nuihr6s92fjb9gwy/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/concept_check-gaamf/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/99999/badge.svg)](https://scan.coverity.com/projects/boostorg-concept_check) | [![codecov](https://codecov.io/gh/boostorg/concept_check/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/concept_check/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/concept_check.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/concept_check.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/concept_check.html) +[`develop`](https://github.com/boostorg/concept_check/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/concept_check.svg?branch=develop)](https://travis-ci.org/boostorg/concept_check) | [![Build status](https://ci.appveyor.com/api/projects/status/nuihr6s92fjb9gwy/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/concept_check-gaamf/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/99999/badge.svg)](https://scan.coverity.com/projects/boostorg-concept_check) | [![codecov](https://codecov.io/gh/boostorg/concept_check/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/concept_check/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/concept_check.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/concept_check.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/concept_check.html) + +### Directories + +| Name | Purpose | +| ----------- | ------------------------------ | +| `doc` | documentation | +| `include` | headers | +| `test` | unit tests | + +### More information + +* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-concept_check) +* [Report bugs](https://github.com/boostorg/concept_check/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). +* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[concept_check]` tag at the beginning of the subject line. + diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..e10b9e0 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,98 @@ +# Copyright 2016, 2017 Peter Dimov +# Copyright (C) 2017, 2018 James E. King III +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +# +# Generic Appveyor build script for boostorg repositories +# +# Instructions for customizing this script for your library: +# +# 1. Customize the compilers and language levels you want. +# 2. If you have move than include/, src/, test/, example/, examples/, +# benchmark/ or tools/ directories, set the environment variable DEPINST. +# For example if your build uses code in "bench/" and "fog/" directories: +# - DEPINST: --include bench --include fog +# 3. Enable pull request builds in your boostorg/ account. +# 4. The default language level is C++03, you can change CXXSTD to modify it. +# +# That's it - the scripts will do everything else for you. +# + +version: 1.0.{build}-{branch} + +shallow_clone: true + +branches: + only: + - develop + - master + +matrix: + allow_failures: + - MAYFAIL: true + +environment: + global: + # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties + # to use the default for a given environment, comment it out; recommend you build debug and release however.. + # on Windows it is important to exercise all the possibilities, especially shared vs static + # B2_ADDRESS_MODEL: address-model=64,32 + # B2_LINK: link=shared,static + # B2_THREADING: threading=multi,single + B2_VARIANT: variant=release,debug + CXXSTD: 03 + # DEPINST: --include otherdir + + matrix: + - FLAVOR: Visual Studio 2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + TOOLSET: msvc-14.1 + B2_ADDRESS_MODEL: address-model=64,32 + - FLAVOR: Visual Studio 2015 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-14.0 + B2_ADDRESS_MODEL: address-model=64,32 + - FLAVOR: Visual Studio 2010, 2012, 2013 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + TOOLSET: msvc-10.0,msvc-11.0,msvc-12.0 + - FLAVOR: cygwin (32-bit) + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + ADDPATH: C:\cygwin\bin; + B2_ADDRESS_MODEL: address-model=32 + # https://github.com/boostorg/test/issues/144 + DEFINES: define=_POSIX_C_SOURCE=200112L + THREADING: threadapi=pthread + TOOLSET: gcc + - FLAVOR: cygwin (64-bit) + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + ADDPATH: C:\cygwin64\bin; + B2_ADDRESS_MODEL: address-model=64 + # https://github.com/boostorg/test/issues/144 + DEFINES: define=_POSIX_C_SOURCE=200112L + THREADING: threadapi=pthread + TOOLSET: gcc + - FLAVOR: mingw32 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + ARCH: i686 + B2_ADDRESS_MODEL: address-model=32 + SCRIPT: ci\appveyor\mingw.bat + - FLAVOR: mingw64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + ARCH: x86_64 + B2_ADDRESS_MODEL: address-model=64 + SCRIPT: ci\appveyor\mingw.bat + +install: + - set SELF=%APPVEYOR_PROJECT_NAME:-=_% + - git clone https://github.com/jeking3/boost-ci.git C:\boost-ci + - xcopy /s /e /q /i C:\boost-ci\ci .\ci + - ci\appveyor\install.bat + +build: off + +test_script: + - set SELF=%APPVEYOR_PROJECT_NAME:-=_% + - PATH=%ADDPATH%%PATH% + - IF DEFINED SCRIPT (call libs\%SELF%\%SCRIPT%) ELSE (b2 libs/%SELF% toolset=%TOOLSET% cxxstd=%CXXSTD% %CXXFLAGS% %DEFINES% %THREADING% %B2_ADDRESS_MODEL% %B2_LINK% %B2_THREADING% %B2_VARIANT% -j3) + diff --git a/include/boost/concept_check.hpp b/include/boost/concept_check.hpp index 25f118b..62bc872 100644 --- a/include/boost/concept_check.hpp +++ b/include/boost/concept_check.hpp @@ -734,8 +734,8 @@ namespace boost private: void const_constraints(const C& cc) { - const_reverse_iterator i = cc.rbegin(); - i = cc.rend(); + const_reverse_iterator _i = cc.rbegin(); + _i = cc.rend(); } C c; }; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 7b7c833..4510302 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -5,7 +5,7 @@ import testing ; test-suite concept_check - : [ run stl_concept_covering.cpp ] + : [ link stl_concept_covering.cpp ] [ run stl_concept_check.cpp ] [ run concept_check_test.cpp ] [ run class_concept_check_test.cpp ] diff --git a/test/stl_concept_covering.cpp b/test/stl_concept_covering.cpp index 6d3144d..cc932ec 100644 --- a/test/stl_concept_covering.cpp +++ b/test/stl_concept_covering.cpp @@ -3,9 +3,6 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// This file doesn't work on other compilers. -#if defined(__GNUC__) || defined(__KCC) - #include #include #include @@ -28,6 +25,21 @@ */ +/** + * Input iterator - explanation from Peter Dimov: + * + * Requirements say that *it is convertible to the value_type, and it is, in + * our case. The problem however is that op== is a template and the first + * argument fails deduction. std::find is specified in terms of the exact + * expression `*it == value`, so if it doesn't compile (and it doesn't), + * `find(it, it, value)` won't compile either. + * + * To address this, the no_proxy variant of the input iterator is used + * instead. + */ + +#define BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE input_iterator_archetype_no_proxy + boost::detail::dummy_constructor dummy_cons; // This is a special concept needed for std::swap_ranges. @@ -147,7 +159,7 @@ main() // gcc bug { typedef equality_comparable2_first_archetype<> Left; - input_iterator_archetype< Left > in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE< Left > in; equality_comparable2_second_archetype<> value(dummy_cons); in = std::find(in, in, value); } @@ -171,14 +183,14 @@ main() // gcc bug { typedef equal_op_first_archetype<> Left; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; typedef equal_op_second_archetype<> Right; forward_iterator_archetype fo; in = std::find_first_of(in, in, fo, fo); } { typedef equal_op_first_archetype<> Left; - typedef input_iterator_archetype InIter; + typedef BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE InIter; InIter in; function_requires< InputIterator >(); equal_op_second_archetype<> value(dummy_cons); @@ -197,10 +209,10 @@ main() // gcc bug { typedef equal_op_first_archetype<> Left; - typedef input_iterator_archetype InIter1; + typedef BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE InIter1; InIter1 in1; typedef equal_op_second_archetype<> Right; - typedef input_iterator_archetype InIter2; + typedef BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE InIter2; InIter2 in2; std::pair p = std::mismatch(in1, in1, in2); ignore_unused_variable_warning(p); @@ -216,9 +228,9 @@ main() // gcc bug { typedef equality_comparable2_first_archetype<> Left; - input_iterator_archetype in1; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in1; typedef equality_comparable2_second_archetype<> Right; - input_iterator_archetype in2; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in2; bool b = std::equal(in1, in1, in2); ignore_unused_variable_warning(b); } @@ -309,13 +321,16 @@ main() mutable_forward_iterator_archetype a, b; std::iter_swap(a, b); } +#if 0 { + // fails on gcc 7.3 and clang 6.0 typedef mutually_convertible_archetype Tin; typedef mutually_convertible_archetype Tout; mutable_forward_iterator_archetype fi1; mutable_forward_iterator_archetype fi2; fi2 = std::swap_ranges(fi1, fi1, fi2); } +#endif { typedef null_archetype Tin; typedef null_archetype Tout; @@ -353,13 +368,14 @@ main() convertible_to_archetype value(dummy_cons); std::replace_if(fi, fi, pred, value); } - // gcc bug +#if !defined(BOOST_MSVC) || BOOST_WORKAROUND(BOOST_MSVC, > 1900) + // fails on MSVC 2015 and earlier { // Issue, the use of ?: inside replace_copy() complicates things typedef equal_op_first_archetype<> Tin; typedef null_archetype<> Tout; typedef equal_op_second_archetype< convertible_to_archetype > T; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; output_iterator_archetype out(dummy_cons); T value(dummy_cons); out = std::replace_copy(in, in, out, value, value); @@ -368,12 +384,13 @@ main() // The issue of ?: also affects this function typedef null_archetype<> Tout; typedef assignable_archetype< convertible_to_archetype > Tin; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; output_iterator_archetype out(dummy_cons); unary_predicate_archetype pred(dummy_cons); Tin value(dummy_cons); out = std::replace_copy_if(in, in, out, pred, value); } +#endif { typedef assignable_archetype<> FT; mutable_forward_iterator_archetype fi; @@ -381,6 +398,8 @@ main() T value(dummy_cons); std::fill(fi, fi, value); } +#if !defined(BOOST_MSVC) || BOOST_WORKAROUND(BOOST_MSVC, >= 1700) + // fails on MSVC 2010 { typedef null_archetype<> Tout; typedef convertible_to_archetype T; @@ -389,6 +408,7 @@ main() int n = 1; out = std::fill_n(out, n, value); } +#endif { typedef assignable_archetype<> FT; typedef convertible_to_archetype Ret; @@ -424,7 +444,7 @@ main() typedef equality_comparable2_first_archetype< convertible_to_archetype > Tin; typedef equality_comparable2_second_archetype<> T; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; output_iterator_archetype out(dummy_cons); T value(dummy_cons); out = std::remove_copy(in, in, out, value); @@ -454,7 +474,7 @@ main() // gcc bug { typedef equality_comparable_archetype< sgi_assignable_archetype<> > T; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; output_iterator_archetype out(dummy_cons); out = std::unique_copy(in, in, out); } @@ -508,14 +528,16 @@ main() unary_predicate_archetype pred(dummy_cons); bi = std::partition(bi, bi, pred); } +#ifndef BOOST_MSVC { + // fails on MSVC typedef null_archetype<> PredArg; typedef sgi_assignable_archetype > FT; mutable_forward_iterator_archetype fi; unary_predicate_archetype pred(dummy_cons); fi = std::stable_partition(fi, fi, pred); } - +#endif //=========================================================================== // Sorting Algorithms { @@ -567,7 +589,7 @@ main() // required to have the same value type, but it is messy. typedef sgi_assignable_archetype< less_than_comparable_archetype<> > T; - input_iterator_archetype in; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in; mutable_random_access_iterator_archetype ri_out; ri_out = std::partial_sort_copy(in, in , ri_out, ri_out); } @@ -594,14 +616,14 @@ main() std::nth_element(ri, ri, ri, comp); } { -#if defined(__GNUC__) - typedef less_than_op_first_archetype<> FT; - typedef less_than_op_second_archetype<> T; -#elif defined(__KCC) +#if defined(__KCC) // The KAI version of this uses a one-argument less-than function // object. typedef less_than_comparable_archetype<> T; typedef convertible_to_archetype FT; +#else + typedef less_than_op_first_archetype<> FT; + typedef less_than_op_second_archetype<> T; #endif forward_iterator_archetype fi; T value(dummy_cons); @@ -618,13 +640,13 @@ main() fi = std::lower_bound(fi, fi, value, comp); } { -#if defined(__GNUC__) +#if defined(__KCC) + typedef less_than_comparable_archetype<> T; + typedef convertible_to_archetype FT; +#else // Note, order of T,FT is flipped from lower_bound typedef less_than_op_second_archetype<> FT; typedef less_than_op_first_archetype<> T; -#elif defined(__KCC) - typedef less_than_comparable_archetype<> T; - typedef convertible_to_archetype FT; #endif forward_iterator_archetype fi; T value(dummy_cons); @@ -641,15 +663,17 @@ main() binary_predicate_archetype comp(dummy_cons); fi = std::upper_bound(fi, fi, value, comp); } +#if !defined(BOOST_MSVC) || BOOST_WORKAROUND(BOOST_MSVC, >= 1900) + // Fails on MSVC 2013 and earlier { -#if defined(__GNUC__) +#if defined(__KCC) + typedef less_than_comparable_archetype<> T; + typedef convertible_to_archetype FT; +#else typedef less_than_op_first_archetype< less_than_op_second_archetype< null_archetype<>, optag2>, optag1> FT; typedef less_than_op_second_archetype< less_than_op_first_archetype< null_archetype<>, optag2>, optag1> T; -#elif defined(__KCC) - typedef less_than_comparable_archetype<> T; - typedef convertible_to_archetype FT; #endif typedef forward_iterator_archetype FIter; FIter fi; @@ -657,6 +681,7 @@ main() std::pair p = std::equal_range(fi, fi, value); ignore_unused_variable_warning(p); } +#endif { typedef null_archetype Arg1; typedef null_archetype Arg2; @@ -672,14 +697,14 @@ main() ignore_unused_variable_warning(p); } { -#if defined(__GNUC__) +#if defined(__KCC) + typedef less_than_op_first_archetype< less_than_comparable_archetype<> > T; + typedef less_than_op_second_archetype< convertible_to_archetype > FT; +#else typedef less_than_op_first_archetype< less_than_op_second_archetype, optag2>, optag1> FT; typedef less_than_op_second_archetype< less_than_op_first_archetype, optag2>, optag1> T; -#elif defined(__KCC) - typedef less_than_op_first_archetype< less_than_comparable_archetype<> > T; - typedef less_than_op_second_archetype< convertible_to_archetype > FT; #endif forward_iterator_archetype fi; T value(dummy_cons); @@ -689,12 +714,10 @@ main() { typedef null_archetype Arg1; typedef null_archetype Arg2; -#if defined(__GNUC__) || defined(__KCC) typedef convertible_to_archetype > FT; typedef convertible_to_archetype > T; -#endif typedef forward_iterator_archetype FIter; FIter fi; T value(dummy_cons); @@ -704,17 +727,15 @@ main() } { typedef null_archetype<> Tout; -#if defined(__GNUC__) || defined(__KCC) typedef less_than_op_first_archetype< less_than_op_second_archetype< convertible_to_archetype, optag2>, optag1 > Tin1; typedef less_than_op_second_archetype< less_than_op_first_archetype< convertible_to_archetype, optag2> ,optag1> Tin2; -#endif // gcc bug - input_iterator_archetype in1; - input_iterator_archetype in2; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in1; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in2; output_iterator_archetype out(dummy_cons); out = std::merge(in1, in1, in2, in2, out); out = std::set_union(in1, in1, in2, in2, out); @@ -726,7 +747,6 @@ main() typedef null_archetype<> T; input_iterator_archetype in1; input_iterator_archetype in2; - typedef convertible_from_archetype Tout; output_iterator_archetype out(dummy_cons); binary_predicate_archetype comp(dummy_cons); out = std::merge(in1, in1, in2, in2, out, comp); @@ -755,8 +775,8 @@ main() less_than_op_second_archetype, optag1>, optag2> Tin1; typedef less_than_op_second_archetype< less_than_op_first_archetype, optag1>, optag2> Tin2; - input_iterator_archetype in1; - input_iterator_archetype in2; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in1; + BOOST_CONCEPT_CHECK_COMPATIBLE_INPUT_ITERATOR_ARCHETYPE in2; bool b = std::includes(in1, in1, in2, in2); b = std::lexicographical_compare(in1, in1, in2, in2); ignore_unused_variable_warning(b); @@ -908,9 +928,3 @@ main() } return 0; } - -#else - -int main() {} - -#endif