X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fconcept_check.hpp;h=8b090d0232cbf3830ce355fc03ed29efbbd4a57d;hb=7677e9487c1669735a2aa9b2356199c2f608fe15;hp=b5bdbe45614c02adc18c342c9da3edc210d1e2b5;hpb=7cdb5279835b7ae9fe0fe0372f9fed7524f39da6;p=lyx.git diff --git a/boost/boost/concept_check.hpp b/boost/boost/concept_check.hpp index b5bdbe4561..8b090d0232 100644 --- a/boost/boost/concept_check.hpp +++ b/boost/boost/concept_check.hpp @@ -1,15 +1,17 @@ // -// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, -// sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided -// "as is" without express or implied warranty, and with no claim as -// to its suitability for any purpose. +// (C) Copyright Jeremy Siek 2000. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) // // Revision History: // 05 May 2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek) // 02 April 2001: Removed limits header altogether. (Jeremy Siek) // 01 April 2001: Modified to use new header. (JMaddock) // + +// See http://www.boost.org/libs/concept_check for documentation. + #ifndef BOOST_CONCEPT_CHECKS_HPP #define BOOST_CONCEPT_CHECKS_HPP @@ -19,7 +21,7 @@ #include #include #include -#include +#include #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) @@ -40,7 +42,7 @@ template inline void ignore_unused_variable_warning(const T&) { } // the unused, defaulted parameter is a workaround for MSVC and Compaq C++ template -inline void function_requires(type* = 0) +inline void function_requires(mpl::identity* = 0) { #if !defined(NDEBUG) void (Concept::*x)() = BOOST_FPTR Concept::constraints; @@ -50,7 +52,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ typedef void (ns::concept ::* func##type_var##concept)(); \ - template \ + template \ struct concept_checking_##type_var##concept { }; \ typedef concept_checking_##type_var##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -59,7 +61,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ typedef void (ns::concept ::* \ func##type_var1##type_var2##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##concept { }; \ typedef concept_checking_##type_var1##type_var2##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -68,7 +70,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ typedef void (ns::concept ::* \ func##tv1##tv2##tv3##concept)(); \ - template \ + template \ struct concept_checking_##tv1##tv2##tv3##concept { }; \ typedef concept_checking_##tv1##tv2##tv3##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -77,7 +79,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ typedef void (ns::concept ::* \ func##tv1##tv2##tv3##tv4##concept)(); \ - template \ + template \ struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ BOOST_FPTR ns::concept::constraints> \ @@ -99,7 +101,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES(type_var, concept) \ typedef void (concept ::* func##type_var##concept)(); \ - template \ + template \ struct concept_checking_##type_var##concept { }; \ typedef concept_checking_##type_var##concept< \ BOOST_FPTR concept ::constraints> \ @@ -107,7 +109,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \ typedef void (concept ::* func##type_var1##type_var2##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##concept { }; \ typedef concept_checking_##type_var1##type_var2##concept< \ BOOST_FPTR concept ::constraints> \ @@ -115,7 +117,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \ typedef void (concept ::* func##type_var1##type_var2##type_var3##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \ typedef concept_checking_##type_var1##type_var2##type_var3##concept< \ BOOST_FPTR concept ::constraints> \ @@ -123,7 +125,7 @@ inline void function_requires(type* = 0) #define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) \ typedef void (concept ::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \ - template \ + template \ struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \ typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \ BOOST_FPTR concept ::constraints> \ @@ -177,7 +179,7 @@ struct require_same { typedef T type; }; template <> struct SignedIntegerConcept { void constraints() {} }; template <> struct SignedIntegerConcept { void constraints() {} }; # if defined(BOOST_HAS_LONG_LONG) - template <> struct SignedIntegerConcept { void constraints() {} }; + template <> struct SignedIntegerConcept< ::boost::long_long_type> { void constraints() {} }; # endif // etc. #endif @@ -533,34 +535,15 @@ struct require_same { typedef T type; }; // Iterator Concepts template - struct TrivialIteratorConcept + struct InputIteratorConcept { void constraints() { function_requires< AssignableConcept >(); - function_requires< DefaultConstructibleConcept >(); function_requires< EqualityComparableConcept >(); + TT j(i); (void)*i; // require dereference operator - } - TT i; - }; - - template - struct Mutable_TrivialIteratorConcept - { - void constraints() { - function_requires< TrivialIteratorConcept >(); - *i = *j; // require dereference and assignment - } - TT i, j; - }; - - template - struct InputIteratorConcept - { - void constraints() { - function_requires< TrivialIteratorConcept >(); - // require iterator_traits typedef's #ifndef BOOST_NO_STD_ITERATOR_TRAITS + // require iterator_traits typedef's typedef typename std::iterator_traits::difference_type D; // Hmm, the following is a bit fragile //function_requires< SignedIntegerConcept >(); @@ -569,7 +552,7 @@ struct require_same { typedef T type; }; typedef typename std::iterator_traits::iterator_category C; function_requires< ConvertibleConcept >(); #endif - ++i; // require preincrement operator + ++j; // require preincrement operator i++; // require postincrement operator } TT i; @@ -705,12 +688,12 @@ struct require_same { typedef T type; }; function_requires< AssignableConcept >(); const_constraints(c); } - void const_constraints(const Container& c) { - i = c.begin(); - i = c.end(); - n = c.size(); - n = c.max_size(); - b = c.empty(); + void const_constraints(const Container& cc) { + i = cc.begin(); + i = cc.end(); + n = cc.size(); + n = cc.max_size(); + b = cc.empty(); } Container c; bool b; @@ -774,9 +757,9 @@ struct require_same { typedef T type; }; BidirectionalIteratorConcept >(); const_constraints(c); } - void const_constraints(const ReversibleContainer& c) { - const_reverse_iterator i = c.rbegin(); - i = c.rend(); + void const_constraints(const ReversibleContainer& cc) { + const_reverse_iterator i = cc.rbegin(); + i = cc.rend(); } ReversibleContainer c; }; @@ -818,8 +801,8 @@ struct require_same { typedef T type; }; const_constraints(c); } - void const_constraints(const RandomAccessContainer& c) { - const_reference r = c[n]; + void const_constraints(const RandomAccessContainer& cc) { + const_reference r = cc[n]; ignore_unused_variable_warning(r); } RandomAccessContainer c; @@ -922,8 +905,8 @@ struct require_same { typedef T type; }; reference r = c.back(); ignore_unused_variable_warning(r); } - void const_constraints(const BackInsertionSequence& c) { - const_reference r = c.back(); + void const_constraints(const BackInsertionSequence& cc) { + const_reference r = cc.back(); ignore_unused_variable_warning(r); }; BackInsertionSequence c; @@ -944,10 +927,10 @@ struct require_same { typedef T type; }; c.erase(r.first, r.second); const_constraints(c); } - void const_constraints(const AssociativeContainer& c) { - ci = c.find(k); - n = c.count(k); - cr = c.equal_range(k); + void const_constraints(const AssociativeContainer& cc) { + ci = cc.find(k); + n = cc.count(k); + cr = cc.equal_range(k); } typedef typename AssociativeContainer::iterator iterator; typedef typename AssociativeContainer::const_iterator const_iterator;