From d64a07a784241498594fc9d2bc0b7eae598134e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 5 Sep 2006 07:18:36 +0000 Subject: [PATCH] Update in-tree boost to latest from boost 1.34 cvs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14895 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/boost/aligned_storage.hpp | 4 +- boost/boost/array.hpp | 127 +- boost/boost/bind.hpp | 704 ++++---- boost/boost/bind/bind_template.hpp | 65 + boost/boost/bind/mem_fn_template.hpp | 86 + boost/boost/bind/placeholders.hpp | 2 +- boost/boost/bind/storage.hpp | 475 ++++++ boost/boost/cast.hpp | 14 +- boost/boost/config/auto_link.hpp | 12 +- boost/boost/config/compiler/borland.hpp | 69 +- boost/boost/config/compiler/comeau.hpp | 4 +- boost/boost/config/compiler/intel.hpp | 35 +- boost/boost/config/compiler/sunpro_cc.hpp | 4 +- boost/boost/config/compiler/visualc.hpp | 18 +- boost/boost/config/no_tr1/utility.hpp | 28 + boost/boost/config/platform/bsd.hpp | 2 +- boost/boost/config/posix_features.hpp | 8 + boost/boost/config/select_compiler_config.hpp | 6 +- boost/boost/config/select_platform_config.hpp | 4 + boost/boost/config/select_stdlib_config.hpp | 2 +- boost/boost/config/stdlib/dinkumware.hpp | 2 +- boost/boost/config/stdlib/libcomo.hpp | 2 +- boost/boost/config/stdlib/libstdcpp3.hpp | 9 + boost/boost/config/stdlib/modena.hpp | 2 +- boost/boost/config/stdlib/msl.hpp | 2 +- boost/boost/config/stdlib/roguewave.hpp | 2 +- boost/boost/config/stdlib/sgi.hpp | 2 +- boost/boost/config/stdlib/stlport.hpp | 2 +- boost/boost/config/suffix.hpp | 46 +- boost/boost/cstdint.hpp | 1 + boost/boost/detail/call_traits.hpp | 15 +- boost/boost/detail/compressed_pair.hpp | 25 +- boost/boost/detail/interlocked.hpp | 61 +- boost/boost/detail/is_incrementable.hpp | 5 +- boost/boost/detail/shared_count.hpp | 48 +- .../boost/detail/sp_counted_base_gcc_ppc.hpp | 6 +- boost/boost/detail/sp_counted_base_w32.hpp | 13 + boost/boost/detail/sp_counted_impl.hpp | 45 + boost/boost/detail/workaround.hpp | 5 +- boost/boost/enable_shared_from_this.hpp | 6 + boost/boost/filesystem/cerrno.hpp | 23 + boost/boost/filesystem/config.hpp | 48 +- boost/boost/filesystem/convenience.hpp | 312 +++- boost/boost/filesystem/exception.hpp | 111 +- boost/boost/filesystem/fstream.hpp | 649 ++++++-- boost/boost/filesystem/operations.hpp | 1106 ++++++++++++- boost/boost/filesystem/path.hpp | 1430 ++++++++++++++++- boost/boost/format/feed_args.hpp | 6 +- boost/boost/format/format_implementation.hpp | 2 +- boost/boost/function/function_base.hpp | 370 +++-- boost/boost/function/function_template.hpp | 469 +++--- boost/boost/integer_traits.hpp | 6 +- boost/boost/intrusive_ptr.hpp | 10 +- boost/boost/iostreams/chain.hpp | 61 +- boost/boost/iostreams/checked_operations.hpp | 4 +- .../detail/adapter/concept_adapter.hpp | 24 +- .../iostreams/detail/adapter/mode_adapter.hpp | 14 +- .../detail/adapter/non_blocking_adapter.hpp | 6 +- .../detail/adapter/range_adapter.hpp | 6 +- .../boost/iostreams/detail/bool_trait_def.hpp | 2 +- .../boost/iostreams/detail/config/codecvt.hpp | 2 +- boost/boost/iostreams/detail/resolve.hpp | 10 +- .../detail/streambuf/direct_streambuf.hpp | 19 +- .../detail/streambuf/indirect_streambuf.hpp | 11 +- boost/boost/iostreams/device/file.hpp | 8 +- .../iostreams/device/file_descriptor.hpp | 2 +- boost/boost/iostreams/device/mapped_file.hpp | 4 +- boost/boost/iostreams/device/null.hpp | 6 +- boost/boost/iostreams/filter/gzip.hpp | 26 +- boost/boost/iostreams/filter/symmetric.hpp | 2 +- boost/boost/iostreams/filter/zlib.hpp | 4 +- boost/boost/iostreams/positioning.hpp | 2 +- boost/boost/iterator.hpp | 2 +- boost/boost/iterator/detail/config_def.hpp | 5 - boost/boost/iterator/detail/enable_if.hpp | 2 +- .../iterator/detail/minimum_category.hpp | 8 +- boost/boost/iterator/filter_iterator.hpp | 10 +- boost/boost/iterator/iterator_categories.hpp | 4 +- boost/boost/iterator/iterator_facade.hpp | 36 +- boost/boost/iterator/iterator_traits.hpp | 2 +- boost/boost/mem_fn.hpp | 11 +- boost/boost/mpl/apply_fwd.hpp | 6 +- boost/boost/mpl/aux_/lambda_support.hpp | 6 +- .../boost/mpl/aux_/preprocessed/gcc/quote.hpp | 2 +- .../mpl/aux_/preprocessed/plain/vector_c.hpp | 99 +- boost/boost/mpl/aux_/yes_no.hpp | 6 +- boost/boost/mpl/quote.hpp | 14 +- boost/boost/multi_array.hpp | 25 +- boost/boost/multi_array/base.hpp | 47 +- boost/boost/multi_array/extent_gen.hpp | 2 +- boost/boost/multi_array/index_gen.hpp | 18 +- boost/boost/multi_array/index_range.hpp | 41 +- boost/boost/multi_array/iterator.hpp | 15 +- boost/boost/multi_array/multi_array_ref.hpp | 24 +- boost/boost/multi_array/subarray.hpp | 15 +- boost/boost/multi_array/types.hpp | 2 +- boost/boost/multi_array/view.hpp | 26 +- boost/boost/optional/optional.hpp | 10 +- boost/boost/preprocessor/config/config.hpp | 8 +- boost/boost/preprocessor/stringize.hpp | 3 +- boost/boost/range/begin.hpp | 2 +- boost/boost/range/config.hpp | 2 +- boost/boost/range/detail/common.hpp | 20 +- .../range/detail/implementation_help.hpp | 2 +- boost/boost/range/end.hpp | 2 +- boost/boost/range/iterator_range.hpp | 69 +- boost/boost/range/rbegin.hpp | 6 +- boost/boost/range/rend.hpp | 8 +- boost/boost/rational.hpp | 8 + boost/boost/ref.hpp | 5 +- boost/boost/regex/config.hpp | 2 +- boost/boost/regex/pending/object_cache.hpp | 4 +- boost/boost/regex/v4/basic_regex.hpp | 1 + boost/boost/regex/v4/basic_regex_creator.hpp | 19 +- boost/boost/regex/v4/basic_regex_parser.hpp | 141 +- boost/boost/regex/v4/match_results.hpp | 19 +- boost/boost/regex/v4/perl_matcher.hpp | 11 +- boost/boost/regex/v4/perl_matcher_common.hpp | 51 +- .../regex/v4/perl_matcher_non_recursive.hpp | 10 + .../boost/regex/v4/perl_matcher_recursive.hpp | 31 +- boost/boost/regex/v4/regex_format.hpp | 12 +- boost/boost/regex/v4/regex_replace.hpp | 2 +- .../boost/regex/v4/regex_traits_defaults.hpp | 6 +- boost/boost/regex/v4/regex_workaround.hpp | 12 +- boost/boost/regex/v4/w32_regex_traits.hpp | 5 +- boost/boost/shared_ptr.hpp | 129 +- boost/boost/signal.hpp | 6 +- boost/boost/spirit/attribute/closure.hpp | 33 +- .../spirit/core/composite/directives.hpp | 23 +- boost/boost/spirit/core/composite/epsilon.hpp | 6 +- .../spirit/core/composite/no_actions.hpp | 18 +- .../spirit/core/non_terminal/impl/grammar.ipp | 4 +- .../spirit/core/non_terminal/subrule.hpp | 5 +- .../core/primitives/impl/primitives.ipp | 144 +- .../boost/spirit/core/primitives/numerics.hpp | 22 +- .../spirit/core/primitives/primitives.hpp | 4 + .../spirit/core/scanner/impl/skipper.ipp | 2 - boost/boost/spirit/core/scanner/scanner.hpp | 12 +- boost/boost/spirit/core/scanner/skipper.hpp | 33 +- .../spirit/error_handling/exceptions.hpp | 9 +- boost/boost/spirit/iterator/file_iterator.hpp | 17 +- .../spirit/iterator/impl/file_iterator.ipp | 7 +- boost/boost/spirit/iterator/multi_pass.hpp | 19 +- .../spirit/iterator/position_iterator.hpp | 16 +- boost/boost/spirit/symbols/impl/symbols.ipp | 3 +- boost/boost/spirit/symbols/symbols.hpp | 22 +- boost/boost/spirit/utility/confix.hpp | 172 +- boost/boost/spirit/utility/distinct.hpp | 10 +- boost/boost/spirit/utility/escape_char.hpp | 3 +- boost/boost/spirit/utility/lists.hpp | 5 +- boost/boost/test/detail/enable_warnings.hpp | 12 +- boost/boost/test/detail/suppress_warnings.hpp | 12 +- boost/boost/token_functions.hpp | 6 +- boost/boost/token_iterator.hpp | 7 +- boost/boost/tokenizer.hpp | 2 +- boost/boost/tuple/detail/tuple_basic.hpp | 2 +- .../detail/tuple_basic_no_partial_spec.hpp | 2 +- boost/boost/tuple/tuple_io.hpp | 4 +- boost/boost/type_traits/add_const.hpp | 6 +- boost/boost/type_traits/add_cv.hpp | 6 +- boost/boost/type_traits/add_pointer.hpp | 8 +- boost/boost/type_traits/add_reference.hpp | 12 +- boost/boost/type_traits/add_volatile.hpp | 6 +- boost/boost/type_traits/alignment_of.hpp | 8 +- boost/boost/type_traits/alignment_traits.hpp | 4 +- boost/boost/type_traits/arithmetic_traits.hpp | 10 +- boost/boost/type_traits/array_traits.hpp | 2 +- .../type_traits/broken_compiler_spec.hpp | 6 +- boost/boost/type_traits/composite_traits.hpp | 14 +- boost/boost/type_traits/config.hpp | 27 +- boost/boost/type_traits/conversion_traits.hpp | 2 +- boost/boost/type_traits/cv_traits.hpp | 16 +- .../type_traits/detail/bool_trait_def.hpp | 6 +- .../type_traits/detail/cv_traits_impl.hpp | 8 +- .../boost/type_traits/detail/false_result.hpp | 2 +- boost/boost/type_traits/detail/ice_and.hpp | 2 +- boost/boost/type_traits/detail/ice_eq.hpp | 2 +- boost/boost/type_traits/detail/ice_not.hpp | 2 +- boost/boost/type_traits/detail/ice_or.hpp | 2 +- .../detail/is_function_ptr_helper.hpp | 8 +- .../detail/is_function_ptr_tester.hpp | 64 +- .../detail/is_mem_fun_pointer_impl.hpp | 8 +- .../detail/is_mem_fun_pointer_tester.hpp | 75 +- .../type_traits/detail/size_t_trait_def.hpp | 6 +- boost/boost/type_traits/extent.hpp | 6 +- boost/boost/type_traits/function_traits.hpp | 2 +- .../boost/type_traits/has_nothrow_assign.hpp | 6 +- .../type_traits/has_nothrow_constructor.hpp | 6 +- boost/boost/type_traits/has_nothrow_copy.hpp | 6 +- .../type_traits/has_nothrow_destructor.hpp | 6 +- .../boost/type_traits/has_trivial_assign.hpp | 20 +- .../type_traits/has_trivial_constructor.hpp | 12 +- boost/boost/type_traits/has_trivial_copy.hpp | 18 +- .../type_traits/has_trivial_destructor.hpp | 12 +- .../type_traits/has_virtual_destructor.hpp | 4 +- boost/boost/type_traits/ice.hpp | 10 +- boost/boost/type_traits/integral_constant.hpp | 10 +- boost/boost/type_traits/intrinsics.hpp | 15 +- boost/boost/type_traits/is_abstract.hpp | 6 +- boost/boost/type_traits/is_arithmetic.hpp | 12 +- boost/boost/type_traits/is_array.hpp | 10 +- .../boost/type_traits/is_base_and_derived.hpp | 21 +- boost/boost/type_traits/is_base_of.hpp | 12 +- boost/boost/type_traits/is_class.hpp | 28 +- boost/boost/type_traits/is_compound.hpp | 10 +- boost/boost/type_traits/is_const.hpp | 26 +- boost/boost/type_traits/is_convertible.hpp | 105 +- boost/boost/type_traits/is_empty.hpp | 36 +- boost/boost/type_traits/is_enum.hpp | 18 +- boost/boost/type_traits/is_float.hpp | 4 +- boost/boost/type_traits/is_floating_point.hpp | 4 +- boost/boost/type_traits/is_function.hpp | 16 +- boost/boost/type_traits/is_fundamental.hpp | 10 +- boost/boost/type_traits/is_integral.hpp | 10 +- .../is_member_function_pointer.hpp | 22 +- .../type_traits/is_member_object_pointer.hpp | 14 +- boost/boost/type_traits/is_member_pointer.hpp | 22 +- boost/boost/type_traits/is_object.hpp | 16 +- boost/boost/type_traits/is_pod.hpp | 14 +- boost/boost/type_traits/is_pointer.hpp | 22 +- boost/boost/type_traits/is_polymorphic.hpp | 12 +- boost/boost/type_traits/is_reference.hpp | 12 +- boost/boost/type_traits/is_same.hpp | 12 +- boost/boost/type_traits/is_scalar.hpp | 16 +- boost/boost/type_traits/is_signed.hpp | 12 +- boost/boost/type_traits/is_stateless.hpp | 18 +- boost/boost/type_traits/is_union.hpp | 10 +- boost/boost/type_traits/is_unsigned.hpp | 10 +- boost/boost/type_traits/is_void.hpp | 6 +- boost/boost/type_traits/is_volatile.hpp | 26 +- boost/boost/type_traits/object_traits.hpp | 30 +- boost/boost/type_traits/rank.hpp | 4 +- boost/boost/type_traits/reference_traits.hpp | 2 +- .../boost/type_traits/remove_all_extents.hpp | 15 +- boost/boost/type_traits/remove_bounds.hpp | 15 +- boost/boost/type_traits/remove_const.hpp | 23 +- boost/boost/type_traits/remove_cv.hpp | 21 +- boost/boost/type_traits/remove_extent.hpp | 15 +- boost/boost/type_traits/remove_pointer.hpp | 17 +- boost/boost/type_traits/remove_reference.hpp | 17 +- boost/boost/type_traits/remove_volatile.hpp | 23 +- boost/boost/type_traits/same_traits.hpp | 2 +- boost/boost/type_traits/transform_traits.hpp | 10 +- .../type_traits/transform_traits_spec.hpp | 2 +- .../boost/type_traits/type_with_alignment.hpp | 28 +- boost/boost/version.hpp | 6 +- boost/boost/weak_ptr.hpp | 10 +- boost/libs/filesystem/src/Makefile.am | 7 +- boost/libs/filesystem/src/convenience.cpp | 75 - boost/libs/filesystem/src/exception.cpp | 362 ++--- boost/libs/filesystem/src/operations.cpp | 1292 +++++++++++++++ .../src/operations_posix_windows.cpp | 852 ---------- boost/libs/filesystem/src/path.cpp | 121 ++ .../filesystem/src/path_posix_windows.cpp | 692 -------- boost/libs/filesystem/src/portability.cpp | 112 ++ boost/libs/iostreams/src/file_descriptor.cpp | 12 +- boost/libs/iostreams/src/mapped_file.cpp | 6 +- boost/libs/iostreams/src/zlib.cpp | 17 +- boost/libs/regex/src/cregex.cpp | 29 +- boost/libs/regex/src/posix_api.cpp | 27 +- boost/libs/regex/src/regex.cpp | 4 +- .../libs/regex/src/regex_traits_defaults.cpp | 224 +-- boost/libs/regex/src/w32_regex_traits.cpp | 4 +- boost/libs/regex/src/wide_posix_api.cpp | 28 +- src/client/client.C | 2 +- src/support/fs_extras.C | 48 +- 266 files changed, 9007 insertions(+), 4557 deletions(-) create mode 100644 boost/boost/bind/storage.hpp create mode 100644 boost/boost/config/no_tr1/utility.hpp create mode 100644 boost/boost/filesystem/cerrno.hpp delete mode 100644 boost/libs/filesystem/src/convenience.cpp create mode 100644 boost/libs/filesystem/src/operations.cpp delete mode 100644 boost/libs/filesystem/src/operations_posix_windows.cpp create mode 100644 boost/libs/filesystem/src/path.cpp delete mode 100644 boost/libs/filesystem/src/path_posix_windows.cpp create mode 100644 boost/libs/filesystem/src/portability.cpp diff --git a/boost/boost/aligned_storage.hpp b/boost/boost/aligned_storage.hpp index 9ab94a0835..cfaf7877a1 100644 --- a/boost/boost/aligned_storage.hpp +++ b/boost/boost/aligned_storage.hpp @@ -121,7 +121,7 @@ public: // accessors return this; } -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) const void* address() const { @@ -136,7 +136,7 @@ public: // accessors }; -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // MSVC6 seems not to like inline functions with const void* returns, so we // declare the following here: diff --git a/boost/boost/array.hpp b/boost/boost/array.hpp index ce9eda7b53..21e5f1bd1b 100644 --- a/boost/boost/array.hpp +++ b/boost/boost/array.hpp @@ -30,6 +30,7 @@ // Handles broken standard libraries better than #include +#include #include // FIXES for broken compilers @@ -52,7 +53,7 @@ namespace boost { typedef const T& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - + // iterator support iterator begin() { return elems; } const_iterator begin() const { return elems; } @@ -135,6 +136,7 @@ namespace boost { // direct access to data (read-only) const T* data() const { return elems; } + T* data() { return elems; } // use array as C array (direct read/write access to data) T* c_array() { return elems; } @@ -154,13 +156,134 @@ namespace boost { // check range (may be private because it is static) static void rangecheck (size_type i) { - if (i >= size()) { + if (i >= size()) { throw std::range_error("array<>: index out of range"); } } }; +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template< class T > + class array< T, 0 > { + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); } + const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + iterator end() { return begin(); } + const_iterator end() const { return begin(); } + + // reverse iterator support +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) + // workaround for broken reverse_iterator in VC7 + typedef std::reverse_iterator > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type i) + { + return failed_rangecheck(); + } + + const_reference operator[](size_type i) const + { + return failed_rangecheck(); + } + + // at() with range check + reference at(size_type i) { return failed_rangecheck(); } + const_reference at(size_type i) const { return failed_rangecheck(); } + + // front() and back() + reference front() + { + return failed_rangecheck(); + } + + const_reference front() const + { + return failed_rangecheck(); + } + + reference back() + { + return failed_rangecheck(); + } + + const_reference back() const + { + return failed_rangecheck(); + } + + // size is constant + static size_type size() { return 0; } + static bool empty() { return true; } + static size_type max_size() { return 0; } + enum { static_size = 0 }; + + void swap (array& y) { + } + + // direct access to data (read-only) + const T* data() const { return 0; } + T* data() { return 0; } + + // use array as C array (direct read/write access to data) + T* c_array() { return 0; } + + // assignment with type conversion + template + array& operator= (const array& ) { + return *this; + } + + // assign one value to all elements + void assign (const T& ) { } + + // check range (may be private because it is static) + static reference failed_rangecheck () { + std::range_error e("attempt to access element of an empty array"); + boost::throw_exception(e); + // + // We need to return something here to keep + // some compilers happy: however we will never + // actually get here.... + // + static T placeholder; + return placeholder; + } + }; +#endif + // comparisons template bool operator== (const array& x, const array& y) { diff --git a/boost/boost/bind.hpp b/boost/boost/bind.hpp index b91bc77f28..bece8a7af3 100644 --- a/boost/boost/bind.hpp +++ b/boost/boost/bind.hpp @@ -26,8 +26,8 @@ #include #include #include -#include #include +#include // Borland-specific bug, visit_each() silently fails to produce code @@ -37,6 +37,8 @@ # define BOOST_BIND_VISIT_EACH visit_each #endif +#include + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4512) // assignment operator could not be generated @@ -73,12 +75,22 @@ template struct result_traits< unspecified, reference_wrapper > // ref_compare -template bool ref_compare(T const & a, T const & b, long) +template bool ref_compare( T const & a, T const & b, long ) { return a == b; } -template bool ref_compare(reference_wrapper const & a, reference_wrapper const & b, int) +template bool ref_compare( arg const &, arg const &, int ) +{ + return true; +} + +template bool ref_compare( arg (*) (), arg (*) (), int ) +{ + return true; +} + +template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) { return a.get_pointer() == b.get_pointer(); } @@ -114,38 +126,23 @@ template class type {}; // unwrap -template inline F & unwrap(F * f, long) +template struct unwrapper { - return *f; -} - -template inline F & unwrap(reference_wrapper * f, int) -{ - return f->get(); -} - -template inline F & unwrap(reference_wrapper const * f, int) -{ - return f->get(); -} - -#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3004) ) - -template inline _mfi::dm unwrap(R T::* * pm, int) -{ - return _mfi::dm(*pm); -} - -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -// IBM/VisualAge 6.0 is not able to handle this overload. -template inline _mfi::dm unwrap(R T::* const * pm, int) -{ - return _mfi::dm(*pm); -} -#endif + static inline F & unwrap( F & f, long ) + { + return f; + } + template static inline F2 & unwrap( reference_wrapper rf, int ) + { + return rf.get(); + } -#endif + template static inline _mfi::dm unwrap( R T::* pm, int ) + { + return _mfi::dm( pm ); + } +}; // listN @@ -167,22 +164,22 @@ public: template R operator()(type, F & f, A &, long) { - return unwrap(&f, 0)(); + return unwrapper::unwrap(f, 0)(); } template R operator()(type, F const & f, A &, long) const { - return unwrap(&f, 0)(); + return unwrapper::unwrap(f, 0)(); } template void operator()(type, F & f, A &, int) { - unwrap(&f, 0)(); + unwrapper::unwrap(f, 0)(); } template void operator()(type, F const & f, A &, int) const { - unwrap(&f, 0)(); + unwrapper::unwrap(f, 0)(); } template void accept(V &) const @@ -195,15 +192,19 @@ public: } }; -template class list1 +template< class A1 > class list1: private storage1< A1 > { +private: + + typedef storage1< A1 > base_type; + public: - explicit list1(A1 a1): a1_(a1) {} + explicit list1( A1 a1 ): base_type( a1 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } template T & operator[] ( _bi::value & v ) const { return v.get(); } @@ -217,50 +218,50 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); + base_type::accept(v); } bool operator==(list1 const & rhs) const { - return ref_compare(a1_, rhs.a1_, 0); + return ref_compare(base_type::a1_, rhs.a1_, 0); } +}; +template< class A1, class A2 > class list2: private storage2< A1, A2 > +{ private: - A1 a1_; -}; + typedef storage2< A1, A2 > base_type; -template class list2 -{ public: - list2(A1 a1, A2 a2): a1_(a1), a2_(a2) {} + list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -274,54 +275,52 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); + base_type::accept(v); } bool operator==(list2 const & rhs) const { - return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0); + return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); } +}; +template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > +{ private: - A1 a1_; - A2 a2_; -}; + typedef storage3< A1, A2, A3 > base_type; -template class list3 -{ public: - list3(A1 a1, A2 a2, A3 a3): a1_(a1), a2_(a2), a3_(a3) {} + list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -335,58 +334,58 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); + base_type::accept(v); } bool operator==(list3 const & rhs) const { - return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0); + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ); } +}; +template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; -}; + typedef storage4< A1, A2, A3, A4 > base_type; -template class list4 -{ public: - list4(A1 a1, A2 a2, A3 a3, A4 a4): a1_(a1), a2_(a2), a3_(a3), a4_(a4) {} + list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -400,64 +399,61 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); + base_type::accept(v); } bool operator==(list4 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0); + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ); } +}; +template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; -}; + typedef storage5< A1, A2, A3, A4, A5 > base_type; -template class list5 -{ public: - list5(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5) {} + list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -471,68 +467,64 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); + base_type::accept(v); } bool operator==(list5 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0); + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ); } +}; +template class list6: private storage6< A1, A2, A3, A4, A5, A6 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; -}; + typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; -template class list6 -{ public: - list6(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6) {} + list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -546,72 +538,67 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); + base_type::accept(v); } bool operator==(list6 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0); + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ); } +}; +template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; -}; + typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; -template class list7 -{ public: - list7(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7) {} + list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -625,77 +612,70 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); + base_type::accept(v); } bool operator==(list7 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0); + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ); } +}; +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; -}; + typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; -template class list8 -{ public: - list8(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } - A8 operator[] (boost::arg<8>) const { return a8_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return a8_; } + list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -709,81 +689,73 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - BOOST_BIND_VISIT_EACH(v, a8_, 0); + base_type::accept(v); } bool operator==(list8 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0); + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ); } +}; +template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > +{ private: - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; - A8 a8_; -}; + typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; -template class list9 -{ public: - list9(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8), a9_(a9) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } - A8 operator[] (boost::arg<8>) const { return a8_; } - A9 operator[] (boost::arg<9>) const { return a9_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return a8_; } - A9 operator[] (boost::arg<9> (*) ()) const { return a9_; } + list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + A9 operator[] (boost::arg<9>) const { return base_type::a9_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } template T & operator[] (_bi::value & v) const { return v.get(); } @@ -797,56 +769,43 @@ public: template R operator()(type, F & f, A & a, long) { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); } template R operator()(type, F const & f, A & a, long) const { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); } template void operator()(type, F & f, A & a, int) { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); } template void operator()(type, F const & f, A & a, int) const { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); } template void accept(V & v) const { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - BOOST_BIND_VISIT_EACH(v, a8_, 0); - BOOST_BIND_VISIT_EACH(v, a9_, 0); + base_type::accept(v); } bool operator==(list9 const & rhs) const { return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0) && ref_compare(a9_, rhs.a9_, 0); - } -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; - A8 a8_; - A9 a9_; + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ) && + ref_compare( base_type::a9_, rhs.a9_, 0 ); + } }; // bind_t @@ -1200,20 +1159,41 @@ BOOST_BIND_OPERATOR( >=, greater_equal ) #endif +// visit_each, ADL + +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) + +template void visit_each( V & v, value const & t, int ) +{ + using boost::visit_each; + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + } // namespace _bi -// visit_each +// visit_each, no ADL -template void visit_each(V & v, _bi::value const & t, int) +#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) + +template void visit_each( V & v, _bi::value const & t, int ) { - BOOST_BIND_VISIT_EACH(v, t.get(), 0); + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); } -template void visit_each(V & v, _bi::bind_t const & t, int) +template void visit_each( V & v, _bi::bind_t const & t, int ) { - t.accept(v); + t.accept( v ); } +#endif + // bind #ifndef BOOST_BIND @@ -1564,63 +1544,95 @@ template +_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t( F(f), list_type(a1) ); +} + +#else namespace _bi { -template struct add_cref +template< class Pm, int I > struct add_cref; + +template< class M, class T > struct add_cref< M T::*, 0 > { - typedef T const & type; + typedef M type; }; -template struct add_cref< T & > +template< class M, class T > struct add_cref< M T::*, 1 > { - typedef T const & type; + typedef M const & type; }; -template<> struct add_cref +template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; }; -} // namespace _bi +#if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) ) -template -_bi::bind_t< typename _bi::add_cref::type, _mfi::dm, typename _bi::list_av_1::type > - BOOST_BIND(R T::*f, A1 a1) +template< class R, class T > struct add_cref< R (T::*) () const, 1 > { - typedef _mfi::dm F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t::type, F, list_type>(F(f), list_type(a1)); -} + typedef void type; +}; -#else +#endif // __IBMCPP__ -template -_bi::bind_t< R const &, _mfi::dm, typename _bi::list_av_1::type > - BOOST_BIND(R T::*f, A1 a1) +template struct isref { - typedef _mfi::dm F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} + enum value_type { value = 0 }; +}; -#endif +template struct isref< R& > +{ + enum value_type { value = 1 }; +}; + +template struct isref< R* > +{ + enum value_type { value = 1 }; +}; -*/ +template struct dm_result +{ + typedef typename add_cref< Pm, 1 >::type type; +}; -template -_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > - BOOST_BIND(R T::*f, A1 a1) +template struct dm_result< Pm, bind_t > { - typedef _mfi::dm F; + typedef typename bind_t::result_type result_type; + typedef typename add_cref< Pm, isref< result_type >::value >::type type; +}; + +} // namespace _bi + +template< class A1, class M, class T > + +_bi::bind_t< + typename _bi::dm_result< M T::*, A1 >::type, + _mfi::dm, + typename _bi::list_av_1::type +> + +BOOST_BIND( M T::*f, A1 a1 ) +{ + typedef typename _bi::dm_result< M T::*, A1 >::type result_type; + typedef _mfi::dm F; typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t( F(f), list_type(a1) ); + return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); } +#endif + } // namespace boost #ifndef BOOST_BIND_NO_PLACEHOLDERS diff --git a/boost/boost/bind/bind_template.hpp b/boost/boost/bind/bind_template.hpp index 60d78b31bb..b2c295d245 100644 --- a/boost/boost/bind/bind_template.hpp +++ b/boost/boost/bind/bind_template.hpp @@ -38,6 +38,23 @@ BOOST_BIND_RETURN l_(type(), f_, a, 0); } +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + template result_type operator()(A1 & a1, A2 & a2) { list2 a(a1, a2); @@ -50,6 +67,49 @@ BOOST_BIND_RETURN l_(type(), f_, a, 0); } +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 const & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) { list3 a(a1, a2, a3); @@ -146,6 +206,11 @@ template void accept(V & v) const { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) + + using boost::visit_each; + +#endif BOOST_BIND_VISIT_EACH(v, f_, 0); l_.accept(v); } diff --git a/boost/boost/bind/mem_fn_template.hpp b/boost/boost/bind/mem_fn_template.hpp index 6368bf25c2..1db0713b77 100644 --- a/boost/boost/bind/mem_fn_template.hpp +++ b/boost/boost/bind/mem_fn_template.hpp @@ -12,6 +12,10 @@ // See http://www.boost.org/libs/bind/mem_fn.html for documentation. // +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS +#endif + // mf0 template class BOOST_MEM_FN_NAME(mf0) @@ -50,6 +54,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u) const + { + BOOST_MEM_FN_RETURN call(u, &u); + } + +#endif + R operator()(T & t) const { BOOST_MEM_FN_RETURN (t.*f_)(); @@ -154,6 +167,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1); + } + +#endif + R operator()(T & t, A1 a1) const { BOOST_MEM_FN_RETURN (t.*f_)(a1); @@ -257,6 +279,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2); + } + +#endif + R operator()(T & t, A1 a1, A2 a2) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); @@ -358,6 +389,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); @@ -459,6 +499,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); @@ -560,6 +609,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); @@ -661,6 +719,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); @@ -762,6 +829,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); @@ -863,6 +939,15 @@ public: BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); } +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const { BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); @@ -932,3 +1017,4 @@ public: } }; +#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/boost/boost/bind/placeholders.hpp b/boost/boost/bind/placeholders.hpp index 8feed58905..a8098a7b10 100644 --- a/boost/boost/bind/placeholders.hpp +++ b/boost/boost/bind/placeholders.hpp @@ -25,7 +25,7 @@ namespace { -#if defined(__BORLANDC__) +#if defined(__BORLANDC__) || defined(__GNUC__) static inline boost::arg<1> _1() { return boost::arg<1>(); } static inline boost::arg<2> _2() { return boost::arg<2>(); } diff --git a/boost/boost/bind/storage.hpp b/boost/boost/bind/storage.hpp new file mode 100644 index 0000000000..be490b0f59 --- /dev/null +++ b/boost/boost/bind/storage.hpp @@ -0,0 +1,475 @@ +#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED +#define BOOST_BIND_STORAGE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/storage.hpp +// +// boost/bind.hpp support header, optimized storage +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +namespace _bi +{ + +// 1 + +template struct storage1 +{ + explicit storage1( A1 a1 ): a1_( a1 ) {} + + template void accept(V & v) const + { + BOOST_BIND_VISIT_EACH(v, a1_, 0); + } + + A1 a1_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ ) + +template struct storage1< boost::arg > +{ + explicit storage1( boost::arg ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +template struct storage1< boost::arg (*) () > +{ + explicit storage1( boost::arg (*) () ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +#endif + +// 2 + +template struct storage2: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, A2 a2 ): storage1( a1 ), a2_( a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a2_, 0); + } + + A2 a2_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage2< A1, boost::arg >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +template struct storage2< A1, boost::arg (*) () >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg (*) () ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +#endif + +// 3 + +template struct storage3: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, A3 a3 ): storage2( a1, a2 ), a3_( a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a3_, 0); + } + + A3 a3_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage3< A1, A2, boost::arg >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +template struct storage3< A1, A2, boost::arg (*) () >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg (*) () ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +#endif + +// 4 + +template struct storage4: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3( a1, a2, a3 ), a4_( a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a4_, 0); + } + + A4 a4_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage4< A1, A2, A3, boost::arg >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +template struct storage4< A1, A2, A3, boost::arg (*) () >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg (*) () ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +#endif + +// 5 + +template struct storage5: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4( a1, a2, a3, a4 ), a5_( a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a5_, 0); + } + + A5 a5_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage5< A1, A2, A3, A4, boost::arg >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +template struct storage5< A1, A2, A3, A4, boost::arg (*) () >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg (*) () ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +#endif + +// 6 + +template struct storage6: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5( a1, a2, a3, a4, a5 ), a6_( a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a6_, 0); + } + + A6 a6_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage6< A1, A2, A3, A4, A5, boost::arg >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +template struct storage6< A1, A2, A3, A4, A5, boost::arg (*) () >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg (*) () ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +#endif + +// 7 + +template struct storage7: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a7_, 0); + } + + A7 a7_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg (*) () >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg (*) () ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +#endif + +// 8 + +template struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a8_, 0); + } + + A8 a8_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg (*) () ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +#endif + +// 9 + +template struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a9_, 0); + } + + A9 a9_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg (*) () ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +#endif + +} // namespace _bi + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED diff --git a/boost/boost/cast.hpp b/boost/boost/cast.hpp index c4ce8d3c08..2615d183fa 100644 --- a/boost/boost/cast.hpp +++ b/boost/boost/cast.hpp @@ -44,7 +44,7 @@ #define BOOST_CAST_HPP # include -# include +# include # include # include # include @@ -55,7 +55,7 @@ // appear in the function's argument list. // // TODO: Add this to config.hpp? -# if defined(BOOST_MSVC) && BOOST_MSVC <= 1200 // 1200 = VC6 +# if defined(BOOST_MSVC) && BOOST_MSVC < 1300 # define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::type* = 0 # else # define BOOST_EXPLICIT_DEFAULT_TARGET @@ -82,17 +82,19 @@ namespace boost // polymorphic_downcast ----------------------------------------------------// - // assert() checked polymorphic downcast. Crosscasts prohibited. + // BOOST_ASSERT() checked polymorphic downcast. Crosscasts prohibited. - // WARNING: Because this cast uses assert(), it violates the One Definition - // Rule if NDEBUG is inconsistently defined across translation units. + // WARNING: Because this cast uses BOOST_ASSERT(), it violates + // the One Definition Rule if used in multiple translation units + // where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER + // NDEBUG are defined inconsistently. // Contributed by Dave Abrahams template inline Target polymorphic_downcast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET) { - assert( dynamic_cast(x) == x ); // detect logic error + BOOST_ASSERT( dynamic_cast(x) == x ); // detect logic error return static_cast(x); } diff --git a/boost/boost/config/auto_link.hpp b/boost/boost/config/auto_link.hpp index 3fbe4173bb..f491042755 100644 --- a/boost/boost/config/auto_link.hpp +++ b/boost/boost/config/auto_link.hpp @@ -109,10 +109,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // select toolset if not defined already: // #ifndef BOOST_LIB_TOOLSET -#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) +// Note: no compilers before 1200 are supported +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) - // vc6: -# define BOOST_LIB_TOOLSET "vc6" +# ifdef UNDER_CE + // vc6: +# define BOOST_LIB_TOOLSET "evc4" +# else + // vc6: +# define BOOST_LIB_TOOLSET "vc6" +# endif #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) diff --git a/boost/boost/config/compiler/borland.hpp b/boost/boost/config/compiler/borland.hpp index 66769bec54..b0d6ab0b44 100644 --- a/boost/boost/config/compiler/borland.hpp +++ b/boost/boost/config/compiler/borland.hpp @@ -9,6 +9,37 @@ // Borland C++ compiler setup: +// +// versions check: +// we don't support Borland prior to version 5.4: +#if __BORLANDC__ < 0x540 +# error "Compiler not supported or configured - please reconfigure" +#elif __BORLANDC__ < 0x581 +# pragma message( "Support for Borland compilers older than BCB2006 is deprecated in Boost 1.34" ) +#endif + +// last known and checked version is 0x600 (Builder X preview) +// Or 0x582 (Borland C++ Builder 2006 Update 1): +#if (__BORLANDC__ > 0x582) && (__BORLANDC__ != 0x600) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# pragma message( "Unknown compiler version - please run the configure tests and report the results") +# endif +#endif + +// +// Support macros to help with standard library detection +#if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL) +# define BOOST_BCB_WITH_ROGUE_WAVE +#elif __BORLANDC__ < 0x570 +# define BOOST_BCB_WITH_STLPORT +#else +# define BOOST_BCB_WITH_DINKUMWARE +#endif + + +// // Version 5.0 and below: # if __BORLANDC__ <= 0x0550 // Borland C++Builder 4 and 5: @@ -36,8 +67,8 @@ #endif #endif -// Version 7.0 (Kylix) and below: -#if (__BORLANDC__ <= 0x570) +// Borland C++ Builder 2006 Update 2 and below: +#if (__BORLANDC__ <= 0x582) # define BOOST_NO_SFINAE # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS @@ -52,15 +83,21 @@ # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT + # ifdef NDEBUG // fix broken so that Boost.test works: # include # undef strcmp +# endif + // fix broken errno declaration: +# include +# ifndef errno +# define errno errno # endif // // new bug in 5.61: -#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x570) +#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580) // this seems to be needed by the command line compiler, but not the IDE: # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif @@ -91,7 +128,7 @@ // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is // defined, then we have 0x560 or greater with the Rogue Wave implementation // which presumably has the std::DBL_MAX bug. -#if ((__BORLANDC__ >= 0x550) && (__BORLANDC__ < 0x560)) || defined(_USE_OLD_RW_STL) +#if defined( BOOST_BCB_WITH_ROGUE_WAVE ) // is partly broken, some macros define symbols that are really in // namespace std, so you end up having to use illegal constructs like // std::DBL_MAX, as a fix we'll just include float.h and have done with: @@ -142,6 +179,7 @@ #endif // // MSVC compatibility mode does some nasty things: +// TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -150,26 +188,3 @@ #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) -// -// versions check: -// we don't support Borland prior to version 5.4: -#if __BORLANDC__ < 0x540 -# error "Compiler not supported or configured - please reconfigure" -#endif -// -// last known and checked version is 1536 (Builder X preview): -#if (__BORLANDC__ > 1536) -# if defined(BOOST_ASSERT_CONFIG) -# error "Unknown compiler version - please run the configure tests and report the results" -# else -# pragma message( "Unknown compiler version - please run the configure tests and report the results") -# endif -#endif - - - - - - - - diff --git a/boost/boost/config/compiler/comeau.hpp b/boost/boost/config/compiler/comeau.hpp index 1b71008e0f..278222dcfd 100644 --- a/boost/boost/config/compiler/comeau.hpp +++ b/boost/boost/config/compiler/comeau.hpp @@ -24,8 +24,8 @@ # endif // Void returns don't work when emulating VC 6 (Peter Dimov) - -# if defined(_MSC_VER) && (_MSC_VER == 1200) +// TODO: look up if this doesn't apply to the whole 12xx range +# if defined(_MSC_VER) && (_MSC_VER < 1300) # define BOOST_NO_VOID_RETURNS # endif diff --git a/boost/boost/config/compiler/intel.hpp b/boost/boost/config/compiler/intel.hpp index d47c345a5e..87920e490b 100644 --- a/boost/boost/config/compiler/intel.hpp +++ b/boost/boost/config/compiler/intel.hpp @@ -1,13 +1,13 @@ -// (C) Copyright John Maddock 2001. -// (C) Copyright Peter Dimov 2001. -// (C) Copyright Jens Maurer 2001. -// (C) Copyright David Abrahams 2002 - 2003. -// (C) Copyright Aleksey Gurtovoy 2002 - 2003. -// (C) Copyright Guillaume Melquiond 2002 - 2003. -// (C) Copyright Beman Dawes 2003. -// (C) Copyright Martin Wille 2003. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright John Maddock 2001. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright Guillaume Melquiond 2002 - 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Martin Wille 2003. +// 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) // See http://www.boost.org for most recent version. @@ -79,9 +79,9 @@ // supports wchar_t natively. *BUT* there is a problem here: the standard // headers define this macro if they typedef wchar_t. Anyway, we're lucky // because they define it without a value, while Intel C++ defines it -// to 1. So we can check its value to see if the macro was defined natively -// or not. -// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T +// to 1. So we can check its value to see if the macro was defined natively +// or not. +// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T // is used instead. # if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0) # define BOOST_NO_INTRINSIC_WCHAR_T @@ -90,9 +90,12 @@ #if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) // -// Figure out when Intel is emulating this gcc bug: +// Figure out when Intel is emulating this gcc bug +// (All Intel versions prior to 9.0.26, and versions +// later than that if they are set up to emulate gcc 3.2 +// or earlier): // -# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL <= 900) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #endif @@ -141,7 +144,7 @@ template<> struct assert_intrinsic_wchar_t {}; #endif // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 900) +#if (BOOST_INTEL_CXX_VERSION > 910) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/boost/boost/config/compiler/sunpro_cc.hpp b/boost/boost/config/compiler/sunpro_cc.hpp index eca19feb0b..b256d843a7 100644 --- a/boost/boost/config/compiler/sunpro_cc.hpp +++ b/boost/boost/config/compiler/sunpro_cc.hpp @@ -64,6 +64,8 @@ # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_SFINAE # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# endif +# if (__SUNPRO_CC <= 0x580) # define BOOST_NO_IS_ABSTRACT # endif @@ -77,7 +79,7 @@ #endif // // last known and checked version is 0x570: -#if (__SUNPRO_CC > 0x570) +#if (__SUNPRO_CC > 0x580) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif diff --git a/boost/boost/config/compiler/visualc.hpp b/boost/boost/config/compiler/visualc.hpp index aa8ce21046..2885a418ba 100644 --- a/boost/boost/config/compiler/visualc.hpp +++ b/boost/boost/config/compiler/visualc.hpp @@ -63,7 +63,9 @@ #endif -#if _MSC_VER < 1310 // 1310 == VC++ 7.1 +#if _MSC_VER < 1400 +// although a conforming signature for swprint exists in VC7.1 +// it appears not to actually work: # define BOOST_NO_SWPRINTF #endif @@ -82,7 +84,7 @@ // // check for exception handling support: -#ifndef _CPPUNWIND +#ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif @@ -95,6 +97,9 @@ #if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_LONG_LONG #endif +#if (_MSC_VER >= 1400) && !defined(_DEBUG) +# define BOOST_HAS_NRVO +#endif // // disable Win32 API's if compiler extentions are // turned off: @@ -128,9 +133,14 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# error unknown CE compiler +# elif _MSC_VER == 1400 +# define BOOST_COMPILER_VERSION evc8 # else -# error unknown CE compiler +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif # endif # else # if _MSC_VER < 1200 diff --git a/boost/boost/config/no_tr1/utility.hpp b/boost/boost/config/no_tr1/utility.hpp new file mode 100644 index 0000000000..dea8f115bc --- /dev/null +++ b/boost/boost/config/no_tr1/utility.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/utility is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_UTILITY +# define BOOST_CONFIG_UTILITY + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +# include + +# ifdef BOOST_CONFIG_NO_UTILITY_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +#endif diff --git a/boost/boost/config/platform/bsd.hpp b/boost/boost/config/platform/bsd.hpp index 17496d85bb..df2308503e 100644 --- a/boost/boost/config/platform/bsd.hpp +++ b/boost/boost/config/platform/bsd.hpp @@ -36,7 +36,7 @@ // FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in // and not in // -#if defined(__FreeBSD__) && (__FreeBSD__ <= 3) +#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3)) || defined(__OpenBSD__) # define BOOST_HAS_PTHREADS #endif diff --git a/boost/boost/config/posix_features.hpp b/boost/boost/config/posix_features.hpp index 4afb476b7f..d12954797f 100644 --- a/boost/boost/config/posix_features.hpp +++ b/boost/boost/config/posix_features.hpp @@ -74,14 +74,22 @@ // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: // These are predicated on _XOPEN_VERSION, and appears to be first released // in issue 4, version 2 (_XOPEN_VERSION > 500). + // Likewise for the functions log1p and expm1. # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) # define BOOST_HAS_GETTIMEOFDAY # if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # endif +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif # endif # endif + diff --git a/boost/boost/config/select_compiler_config.hpp b/boost/boost/config/select_compiler_config.hpp index 3453f1a35f..3c960b3bde 100644 --- a/boost/boost/config/select_compiler_config.hpp +++ b/boost/boost/config/select_compiler_config.hpp @@ -12,7 +12,11 @@ // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: -# if defined __COMO__ +#if defined(__GCCXML__) +// GCC-XML emulates other compilers, it has to appear first here! +# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" + +#elif defined __COMO__ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" diff --git a/boost/boost/config/select_platform_config.hpp b/boost/boost/config/select_platform_config.hpp index 2101ed431d..a4c7ad6a87 100644 --- a/boost/boost/config/select_platform_config.hpp +++ b/boost/boost/config/select_platform_config.hpp @@ -57,6 +57,10 @@ // AmigaOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" +#elif defined(__QNXNTO__) +// QNX: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" + #else # if defined(unix) \ diff --git a/boost/boost/config/select_stdlib_config.hpp b/boost/boost/config/select_stdlib_config.hpp index b7bf591434..13e5e4cef0 100644 --- a/boost/boost/config/select_stdlib_config.hpp +++ b/boost/boost/config/select_stdlib_config.hpp @@ -17,7 +17,7 @@ // users can short-circuit this header if they know whose std lib // they are using. -#include +#include #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since diff --git a/boost/boost/config/stdlib/dinkumware.hpp b/boost/boost/config/stdlib/dinkumware.hpp index aa214fc1b0..01f1238d93 100644 --- a/boost/boost/config/stdlib/dinkumware.hpp +++ b/boost/boost/config/stdlib/dinkumware.hpp @@ -12,7 +12,7 @@ // Dinkumware standard library config: #if !defined(_YVALS) && !defined(_CPPLIB_VER) -#include +#include #if !defined(_YVALS) && !defined(_CPPLIB_VER) #error This is not the Dinkumware lib! #endif diff --git a/boost/boost/config/stdlib/libcomo.hpp b/boost/boost/config/stdlib/libcomo.hpp index b2c8e44002..749781fece 100644 --- a/boost/boost/config/stdlib/libcomo.hpp +++ b/boost/boost/config/stdlib/libcomo.hpp @@ -10,7 +10,7 @@ // Comeau STL: #if !defined(__LIBCOMO__) -# include +# include # if !defined(__LIBCOMO__) # error "This is not the Comeau STL!" # endif diff --git a/boost/boost/config/stdlib/libstdcpp3.hpp b/boost/boost/config/stdlib/libstdcpp3.hpp index 5cf5ef773f..7bbe604f7f 100644 --- a/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/boost/config/stdlib/libstdcpp3.hpp @@ -62,3 +62,12 @@ // support is useless. # undef BOOST_HAS_LONG_LONG #endif + +#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 +# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx +# define BOOST_HAS_SLIST +# define BOOST_HAS_HASH +# define BOOST_SLIST_HEADER +# define BOOST_HASH_SET_HEADER +# define BOOST_HASH_MAP_HEADER +#endif diff --git a/boost/boost/config/stdlib/modena.hpp b/boost/boost/config/stdlib/modena.hpp index 61e31b7d1c..3d0f76be9f 100644 --- a/boost/boost/config/stdlib/modena.hpp +++ b/boost/boost/config/stdlib/modena.hpp @@ -8,7 +8,7 @@ // Modena C++ standard library (comes with KAI C++) #if !defined(MSIPL_COMPILE_H) -# include +# include # if !defined(__MSIPL_COMPILE_H) # error "This is not the Modena C++ library!" # endif diff --git a/boost/boost/config/stdlib/msl.hpp b/boost/boost/config/stdlib/msl.hpp index 0df8e0e3bc..f8d8752bf7 100644 --- a/boost/boost/config/stdlib/msl.hpp +++ b/boost/boost/config/stdlib/msl.hpp @@ -9,7 +9,7 @@ // Metrowerks standard library: #ifndef __MSL_CPP__ -# include +# include # ifndef __MSL_CPP__ # error This is not the MSL standard library! # endif diff --git a/boost/boost/config/stdlib/roguewave.hpp b/boost/boost/config/stdlib/roguewave.hpp index b331f6538b..49d0106dd2 100644 --- a/boost/boost/config/stdlib/roguewave.hpp +++ b/boost/boost/config/stdlib/roguewave.hpp @@ -10,7 +10,7 @@ // Rogue Wave std lib: #if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) -# include +# include # if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # error This is not the Rogue Wave standard library # endif diff --git a/boost/boost/config/stdlib/sgi.hpp b/boost/boost/config/stdlib/sgi.hpp index 67f7a0a4bf..f3fa05b260 100644 --- a/boost/boost/config/stdlib/sgi.hpp +++ b/boost/boost/config/stdlib/sgi.hpp @@ -10,7 +10,7 @@ // generic SGI STL: #if !defined(__STL_CONFIG_H) -# include +# include # if !defined(__STL_CONFIG_H) # error "This is not the SGI STL!" # endif diff --git a/boost/boost/config/stdlib/stlport.hpp b/boost/boost/config/stdlib/stlport.hpp index 294f96ed6f..98fdd43490 100644 --- a/boost/boost/config/stdlib/stlport.hpp +++ b/boost/boost/config/stdlib/stlport.hpp @@ -10,7 +10,7 @@ // STLPort standard library config: #if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) -# include +# include # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # error "This is not STLPort!" # endif diff --git a/boost/boost/config/suffix.hpp b/boost/boost/config/suffix.hpp index d4d9502d4a..61a8d46a23 100644 --- a/boost/boost/config/suffix.hpp +++ b/boost/boost/config/suffix.hpp @@ -30,18 +30,12 @@ // remember that since these just declare a bunch of macros, there should be // no namespace issues from this. // -#include -# if !defined(BOOST_HAS_LONG_LONG) \ - && !defined(BOOST_MSVC) && !defined(__BORLANDC__) \ - && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) -# define BOOST_HAS_LONG_LONG -#endif - -// TODO: Remove the following lines after the 1.33 release because the presence -// of an integral 64 bit type has nothing to do with support for long long. - -#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(__DECCXX_VER) -# define BOOST_NO_INTEGRAL_INT64_T +#if !defined(BOOST_HAS_LONG_LONG) \ + && !defined(BOOST_MSVC) && !defined(__BORLANDC__) +# include +# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) +# define BOOST_HAS_LONG_LONG +# endif #endif // GCC 3.x will clean up all of those nasty macro definitions that @@ -250,6 +244,12 @@ // # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) # define BOOST_HAS_STDINT_H +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif # endif // @@ -264,6 +264,27 @@ # define BOOST_NO_HASH # endif +// +// Set BOOST_SLIST_HEADER if not set already: +// +#if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) +# define BOOST_SLIST_HEADER +#endif + +// +// Set BOOST_HASH_SET_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) +# define BOOST_HASH_SET_HEADER +#endif + +// +// Set BOOST_HASH_MAP_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) +# define BOOST_HASH_MAP_HEADER +#endif + // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -545,3 +566,4 @@ namespace boost{ + diff --git a/boost/boost/cstdint.hpp b/boost/boost/cstdint.hpp index 698c149f58..31a432a886 100644 --- a/boost/boost/cstdint.hpp +++ b/boost/boost/cstdint.hpp @@ -173,6 +173,7 @@ namespace boost { #else // BOOST_HAS_STDINT_H # include // implementation artifact; not part of interface +# include // needed for limits macros namespace boost diff --git a/boost/boost/detail/call_traits.hpp b/boost/boost/detail/call_traits.hpp index 0d9e99febf..54d441c569 100644 --- a/boost/boost/detail/call_traits.hpp +++ b/boost/boost/detail/call_traits.hpp @@ -58,7 +58,7 @@ struct ct_imp template struct ct_imp { - typedef T const param_type; + typedef const T param_type; }; } @@ -76,7 +76,7 @@ public: // however compiler bugs prevent this - instead pass three bool's to // ct_imp and add an extra partial specialisation // of ct_imp to handle the logic. (JM) - typedef typename detail::ct_imp< + typedef typename boost::detail::ct_imp< T, ::boost::is_pointer::value, ::boost::is_arithmetic::value @@ -92,7 +92,7 @@ struct call_traits typedef T& param_type; // hh removed const }; -#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) +#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 ) ) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -121,6 +121,15 @@ struct call_traits typedef const T& const_reference; typedef T& param_type; // hh removed const }; + +template +struct call_traits< T * > +{ + typedef T * value_type; + typedef T * & reference; + typedef T * const & const_reference; + typedef T * const param_type; // hh removed const +}; #endif #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) template diff --git a/boost/boost/detail/compressed_pair.hpp b/boost/boost/detail/compressed_pair.hpp index c45d20c599..3f326456ce 100644 --- a/boost/boost/detail/compressed_pair.hpp +++ b/boost/boost/detail/compressed_pair.hpp @@ -27,6 +27,10 @@ #include #include +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4512) +#endif namespace boost { @@ -132,7 +136,7 @@ namespace details template class compressed_pair_imp - : private ::boost::remove_cv::type + : protected ::boost::remove_cv::type { public: typedef T1 first_type; @@ -174,7 +178,7 @@ namespace details template class compressed_pair_imp - : private ::boost::remove_cv::type + : protected ::boost::remove_cv::type { public: typedef T1 first_type; @@ -217,8 +221,8 @@ namespace details template class compressed_pair_imp - : private ::boost::remove_cv::type, - private ::boost::remove_cv::type + : protected ::boost::remove_cv::type, + protected ::boost::remove_cv::type { public: typedef T1 first_type; @@ -253,11 +257,14 @@ namespace details // JM // 4 T1 == T2, T1 and T2 both empty - // Note does not actually store an instance of T2 at all - - // but reuses T1 base class for both first() and second(). + // Originally this did not store an instance of T2 at all + // but that led to problems beause it meant &x.first() == &x.second() + // which is not true for any other kind of pair, so now we store an instance + // of T2 just in case the user is relying on first() and second() returning + // different objects (albeit both empty). template class compressed_pair_imp - : private ::boost::remove_cv::type + : protected ::boost::remove_cv::type { public: typedef T1 first_type; @@ -428,5 +435,9 @@ swap(compressed_pair& x, compressed_pair& y) } // boost +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + #endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP diff --git a/boost/boost/detail/interlocked.hpp b/boost/boost/detail/interlocked.hpp index 025f3b542c..76a24c34d0 100644 --- a/boost/boost/detail/interlocked.hpp +++ b/boost/boost/detail/interlocked.hpp @@ -26,20 +26,66 @@ # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer + +#elif defined(_WIN32_WCE) + +// under Windows CE we still have old-style Interlocked* functions + +extern "C" long __cdecl InterlockedIncrement( long* ); +extern "C" long __cdecl InterlockedDecrement( long* ); +extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); +extern "C" long __cdecl InterlockedExchange( long*, long ); +extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); + +# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) extern "C" long __cdecl _InterlockedIncrement( long volatile * ); extern "C" long __cdecl _InterlockedDecrement( long volatile * ); extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long); # pragma intrinsic( _InterlockedIncrement ) # pragma intrinsic( _InterlockedDecrement ) # pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) + +# if defined(_M_IA64) || defined(_M_AMD64) + +extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* ); +extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); + +# pragma intrinsic( _InterlockedCompareExchangePointer ) +# pragma intrinsic( _InterlockedExchangePointer ) + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer + +# else + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +# endif # define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) @@ -52,14 +98,23 @@ namespace detail extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); } // namespace detail } // namespace boost -# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) #else diff --git a/boost/boost/detail/is_incrementable.hpp b/boost/boost/detail/is_incrementable.hpp index 0ae4eca84f..cb7d7a7b59 100644 --- a/boost/boost/detail/is_incrementable.hpp +++ b/boost/boost/detail/is_incrementable.hpp @@ -4,13 +4,15 @@ #ifndef IS_INCREMENTABLE_DWA200415_HPP # define IS_INCREMENTABLE_DWA200415_HPP -# include # include # include # include # include # include +// Must be the last include +# include + namespace boost { namespace detail { // is_incrementable metafunction @@ -117,5 +119,6 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable) } // namespace boost +# include #endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/boost/boost/detail/shared_count.hpp b/boost/boost/detail/shared_count.hpp index 49aca857f7..e139a7d138 100644 --- a/boost/boost/detail/shared_count.hpp +++ b/boost/boost/detail/shared_count.hpp @@ -29,7 +29,7 @@ #include #include -#include // std::auto_ptr, std::allocator +#include // std::auto_ptr #include // std::less #include // std::bad_alloc #include // std::type_info in get_deleter @@ -127,6 +127,52 @@ public: boost::throw_exception(std::bad_alloc()); } +#endif + } + + template shared_count( P p, D d, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda impl_type; + typedef typename A::template rebind< impl_type >::other A2; + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + catch(...) + { + d( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + + if( pi_ != 0 ) + { + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + else + { + d( p ); + boost::throw_exception( std::bad_alloc() ); + } + #endif } diff --git a/boost/boost/detail/sp_counted_base_gcc_ppc.hpp b/boost/boost/detail/sp_counted_base_gcc_ppc.hpp index fc2925e628..ca5cf2b39c 100644 --- a/boost/boost/detail/sp_counted_base_gcc_ppc.hpp +++ b/boost/boost/detail/sp_counted_base_gcc_ppc.hpp @@ -47,7 +47,7 @@ inline void atomic_increment( int * pw ) "bne- 0b": "=m"( *pw ), "=&b"( tmp ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "cc" ); } @@ -69,7 +69,7 @@ inline int atomic_decrement( int * pw ) "isync": "=m"( *pw ), "=&b"( rv ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "memory", "cc" ); @@ -95,7 +95,7 @@ inline int atomic_conditional_increment( int * pw ) "bne- 0b": "=m"( *pw ), "=&b"( rv ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "cc" ); diff --git a/boost/boost/detail/sp_counted_base_w32.hpp b/boost/boost/detail/sp_counted_base_w32.hpp index e84f06e7f2..fb42c4e1cf 100644 --- a/boost/boost/detail/sp_counted_base_w32.hpp +++ b/boost/boost/detail/sp_counted_base_w32.hpp @@ -25,6 +25,7 @@ // #include +#include #include namespace boost @@ -78,7 +79,19 @@ public: { long tmp = static_cast< long const volatile& >( use_count_ ); if( tmp == 0 ) return false; + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) + + // work around a code generation bug + + long tmp2 = tmp + 1; + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; + +#else + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; + +#endif } } diff --git a/boost/boost/detail/sp_counted_impl.hpp b/boost/boost/detail/sp_counted_impl.hpp index 51093b522b..6963f59590 100644 --- a/boost/boost/detail/sp_counted_impl.hpp +++ b/boost/boost/detail/sp_counted_impl.hpp @@ -31,7 +31,10 @@ #include #endif +#if defined(BOOST_SP_USE_STD_ALLOCATOR) #include // std::allocator +#endif + #include // std::type_info in get_deleter #include // std::size_t @@ -176,6 +179,48 @@ public: #endif }; +template class sp_counted_impl_pda: public sp_counted_base +{ +private: + + P p_; // copy constructor must not throw + D d_; // copy constructor must not throw + A a_; // copy constructor must not throw + + sp_counted_impl_pda( sp_counted_impl_pda const & ); + sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); + + typedef sp_counted_impl_pda this_type; + +public: + + // pre: d( p ) must not throw + + sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + virtual void dispose() // nothrow + { + d_( p_ ); + } + + virtual void destroy() // nothrow + { + typedef typename A::template rebind< this_type >::other A2; + + A2 a2( a_ ); + + this->~this_type(); + a2.deallocate( this, 1 ); + } + + virtual void * get_deleter( std::type_info const & ti ) + { + return ti == typeid( D )? &d_: 0; + } +}; + #ifdef __CODEGUARD__ # pragma option pop #endif diff --git a/boost/boost/detail/workaround.hpp b/boost/boost/detail/workaround.hpp index b5ecad7744..b10f9b58d5 100644 --- a/boost/boost/detail/workaround.hpp +++ b/boost/boost/detail/workaround.hpp @@ -9,7 +9,8 @@ // // Usage: // -// #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// // workaround for eVC4 and VC6 // ... // workaround code here // #endif // @@ -17,7 +18,7 @@ // first argument must be undefined or expand to a numeric // value. The above expands to: // -// (BOOST_MSVC) != 0 && (BOOST_MSVC) <= 1200 +// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300 // // When used for workarounds that apply to the latest known version // and all earlier versions of a compiler, the following convention diff --git a/boost/boost/enable_shared_from_this.hpp b/boost/boost/enable_shared_from_this.hpp index 0cf7854ccc..4e49f1f73b 100644 --- a/boost/boost/enable_shared_from_this.hpp +++ b/boost/boost/enable_shared_from_this.hpp @@ -58,6 +58,12 @@ public: return p; } +// Note: No, you don't need to initialize _internal_weak_this +// +// Please read the documentation, not the code +// +// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html + typedef T _internal_element_type; // for bcc 5.5.1 mutable weak_ptr<_internal_element_type> _internal_weak_this; }; diff --git a/boost/boost/filesystem/cerrno.hpp b/boost/boost/filesystem/cerrno.hpp new file mode 100644 index 0000000000..9f5391ae26 --- /dev/null +++ b/boost/boost/filesystem/cerrno.hpp @@ -0,0 +1,23 @@ +// Boost Filesystem cerrno.hpp header --------------------------------------// + +// Copyright Beman Dawes 2005. +// 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) + +// See library home page at http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM_CERRNO_HPP +#define BOOST_FILESYSTEM_CERRNO_HPP + +#include + +#if defined __BORLANDC__ +#define ENOSYS 9997 +#endif + +#define EBADHANDLE 9998 // bad handle +#define EOTHER 9999 // Other error not translatable + // to a POSIX errno value + +#endif // include guard diff --git a/boost/boost/filesystem/config.hpp b/boost/boost/filesystem/config.hpp index aed9585ea8..4b81bbc841 100644 --- a/boost/boost/filesystem/config.hpp +++ b/boost/boost/filesystem/config.hpp @@ -1,6 +1,6 @@ // boost/filesystem/config.hpp ---------------------------------------------// -// © Copyright Beman Dawes 2003 +// Copyright Beman Dawes 2003 // 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) @@ -12,11 +12,57 @@ #ifndef BOOST_FILESYSTEM_CONFIG_HPP #define BOOST_FILESYSTEM_CONFIG_HPP +#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions + +// ability to change namespace aids path_table.cpp ------------------------// +#ifndef BOOST_FILESYSTEM_NAMESPACE +# define BOOST_FILESYSTEM_NAMESPACE filesystem +#endif + // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html #include +// determine platform ------------------------------------------------------// + +// BOOST_CYGWIN_PATH implies BOOST_WINDOWS_PATH and BOOST_POSIX_API + +# if defined(BOOST_CYGWIN_PATH) +# if defined(BOOST_POSIX_PATH) +# error BOOST_POSIX_PATH is invalid when BOOST_CYGWIN_PATH is defined +# endif +# if defined(BOOST_WINDOWS_API) +# error BOOST_WINDOWS_API is invalid when BOOST_CYGWIN_PATH is defined +# endif +# define BOOST_WINDOWS_PATH +# define BOOST_POSIX_API +# endif + +// BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use + +# if defined( BOOST_WINDOWS_API ) && defined( BOOST_POSIX_API ) +# error both BOOST_WINDOWS_API and BOOST_POSIX_API are defined +# elif !defined( BOOST_WINDOWS_API ) && !defined( BOOST_POSIX_API ) +# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) +# define BOOST_WINDOWS_API +# else +# define BOOST_POSIX_API +# endif +# endif + +// BOOST_WINDOWS_PATH enables Windows path syntax recognition + +# if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) +# define BOOST_WINDOWS_PATH +# endif + +// narrow support only for badly broken compilers or libraries -------------// + +# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) +# define BOOST_FILESYSTEM_NARROW_ONLY +# endif + // enable dynamic linking on Windows ---------------------------------------// # if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__) diff --git a/boost/boost/filesystem/convenience.hpp b/boost/boost/filesystem/convenience.hpp index cae90c0c59..a11d85e523 100644 --- a/boost/boost/filesystem/convenience.hpp +++ b/boost/boost/filesystem/convenience.hpp @@ -1,7 +1,7 @@ // boost/filesystem/convenience.hpp ----------------------------------------// -// © Copyright Beman Dawes, 2002 -// © Copyright Vladimir Prus, 2002 +// Copyright Beman Dawes, 2002-2005 +// Copyright Vladimir Prus, 2002 // 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) @@ -13,27 +13,319 @@ #ifndef BOOST_FILESYSTEM_CONVENIENCE_HPP #define BOOST_FILESYSTEM_CONVENIENCE_HPP -#include // includes #include +#include +#include -#include // must be the last header +#include // must be the last #include + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY +# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ + template typename boost::enable_if, \ + BOOST_FS_TYPE>::type +# define BOOST_FS_FUNC_STRING BOOST_FS_FUNC(typename Path::string_type) +# define BOOST_FS_TYPENAME typename +# else +# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE + typedef boost::filesystem::path Path; +# define BOOST_FS_FUNC_STRING std::string +# define BOOST_FS_TYPENAME +# endif namespace boost { namespace filesystem { - BOOST_FILESYSTEM_DECL bool create_directories(const path& ph); + BOOST_FS_FUNC(bool) create_directories(const Path& ph) + { + if (ph.empty() || exists(ph)) + { + if ( !ph.empty() && !is_directory(ph) ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::create_directories", ph, -1 ) ); + return false; + } + + // First create branch, by calling ourself recursively + create_directories(ph.branch_path()); + // Now that parent's path exists, create the directory + create_directory(ph); + return true; + } + + BOOST_FS_FUNC_STRING extension(const Path& ph) + { + typedef BOOST_FS_TYPENAME Path::string_type string_type; + string_type leaf = ph.leaf(); + + BOOST_FS_TYPENAME string_type::size_type n = leaf.rfind('.'); + if (n != string_type::npos) + return leaf.substr(n); + else + return string_type(); + } + + BOOST_FS_FUNC_STRING basename(const Path& ph) + { + typedef BOOST_FS_TYPENAME Path::string_type string_type; + string_type leaf = ph.leaf(); + BOOST_FS_TYPENAME string_type::size_type n = leaf.rfind('.'); + return leaf.substr(0, n); + } + + BOOST_FS_FUNC(Path) change_extension( const Path & ph, + const BOOST_FS_TYPENAME Path::string_type & new_extension ) + { return ph.branch_path() / (basename(ph) + new_extension); } + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + // "do-the-right-thing" overloads ---------------------------------------// + + inline bool create_directories(const path& ph) + { return create_directories(ph); } + inline bool create_directories(const wpath& ph) + { return create_directories(ph); } + + inline std::string extension(const path& ph) + { return extension(ph); } + inline std::wstring extension(const wpath& ph) + { return extension(ph); } + + inline std::string basename(const path& ph) + { return basename( ph ); } + inline std::wstring basename(const wpath& ph) + { return basename( ph ); } + + inline path change_extension( const path & ph, const std::string& new_ex ) + { return change_extension( ph, new_ex ); } + inline wpath change_extension( const wpath & ph, const std::wstring& new_ex ) + { return change_extension( ph, new_ex ); } + +# endif + + + // basic_recursive_directory_iterator helpers --------------------------// + + namespace detail + { + template< class Path > + struct recur_dir_itr_imp + { + typedef basic_directory_iterator< Path > element_type; + std::stack< element_type, std::vector< element_type > > m_stack; + int m_level; + bool m_no_push; + bool m_no_throw; + + recur_dir_itr_imp() : m_level(0), m_no_push(false), m_no_throw(false) {} + }; + + } // namespace detail + + // basic_recursive_directory_iterator ----------------------------------// + + template< class Path > + class basic_recursive_directory_iterator + : public boost::iterator_facade< + basic_recursive_directory_iterator, + basic_directory_entry, + boost::single_pass_traversal_tag > + { + public: + typedef Path path_type; + + basic_recursive_directory_iterator(){} // creates the "end" iterator + + explicit basic_recursive_directory_iterator( const Path & dir_path ); + basic_recursive_directory_iterator( const Path & dir_path, system_error_type & ec ); + + int level() const { return m_imp->m_level; } + + void pop(); + void no_push() + { + BOOST_ASSERT( m_imp.get() && "attempt to no_push() on end iterator" ); + m_imp->m_no_push = true; + } + + file_status status() const + { + BOOST_ASSERT( m_imp.get() + && "attempt to call status() on end recursive_iterator" ); + return m_imp->m_stack.top()->status(); + } - BOOST_FILESYSTEM_DECL std::string extension(const path& ph); + file_status symlink_status() const + { + BOOST_ASSERT( m_imp.get() + && "attempt to call symlink_status() on end recursive_iterator" ); + return m_imp->m_stack.top()->symlink_status(); + } - BOOST_FILESYSTEM_DECL std::string basename(const path& ph); + private: - BOOST_FILESYSTEM_DECL path change_extension(const path& ph, - const std::string& new_extension); + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::recur_dir_itr_imp< Path > > m_imp; + + friend class boost::iterator_core_access; + + typename boost::iterator_facade< + basic_recursive_directory_iterator, + basic_directory_entry, + boost::single_pass_traversal_tag >::reference + dereference() const + { + BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); + return *m_imp->m_stack.top(); + } + + void increment(); + + bool equal( const basic_recursive_directory_iterator & rhs ) const + { return m_imp == rhs.m_imp; } + }; + + typedef basic_recursive_directory_iterator recursive_directory_iterator; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + typedef basic_recursive_directory_iterator wrecursive_directory_iterator; +# endif + + // basic_recursive_directory_iterator implementation -------------------// + + // constructors + template + basic_recursive_directory_iterator:: + basic_recursive_directory_iterator( const Path & dir_path ) + : m_imp( new detail::recur_dir_itr_imp ) + { + m_imp->m_stack.push( basic_directory_iterator( dir_path ) ); + } + + template + basic_recursive_directory_iterator:: + basic_recursive_directory_iterator( const Path & dir_path, system_error_type & ec ) + : m_imp( new detail::recur_dir_itr_imp ) + { + m_imp->m_stack.push( basic_directory_iterator( dir_path, std::nothrow ) ); + m_imp->m_no_throw = true; + } + + // increment + template + void basic_recursive_directory_iterator::increment() + { + BOOST_ASSERT( m_imp.get() && "increment on end iterator" ); + + static const basic_directory_iterator end_itr; + + if ( m_imp->m_no_push ) m_imp->m_no_push = false; + else if ( is_directory( m_imp->m_stack.top()->status() ) ) + { + system_error_type ec; + m_imp->m_stack.push( + m_imp->m_no_throw + ? basic_directory_iterator( *m_imp->m_stack.top(), ec ) + : basic_directory_iterator( *m_imp->m_stack.top() ) + ); + if ( m_imp->m_stack.top() != end_itr ) + { + ++m_imp->m_level; + return; + } + m_imp->m_stack.pop(); + } + + while ( !m_imp->m_stack.empty() + && ++m_imp->m_stack.top() == end_itr ) + { + m_imp->m_stack.pop(); + --m_imp->m_level; + } + + if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator + } + + // pop + template + void basic_recursive_directory_iterator::pop() + { + BOOST_ASSERT( m_imp.get() && "pop on end iterator" ); + BOOST_ASSERT( m_imp->m_level > 0 && "pop with level < 1" ); + + m_imp->m_stack.pop(); + --m_imp->m_level; + } + + // what() basic_filesystem_error_decoder -------------------------------// + + namespace detail + { + +# if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x581)) + using boost::filesystem::system_message; +# endif + + inline void decode_system_message( system_error_type ec, std::string & target ) + { + system_message( ec, target ); + } + +# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_NARROW_ONLY) + inline void decode_system_message( system_error_type ec, std::wstring & target ) + { + system_message( ec, target ); + } +# endif + + template + void decode_system_message( system_error_type ec, String & target ) + { + std::string temp; + system_message( ec, temp ); + for ( const char * p = temp.c_str(); *p != 0; ++p ) + { target += static_cast( *p ); } + } + } + + template + typename Path::string_type what( const basic_filesystem_error & ex ) + { + typename Path::string_type s; + for ( const char * p = ex.what(); *p != 0; ++p ) + { s += static_cast( *p ); } + + if ( !ex.path1().empty() ) + { + s += static_cast( ':' ); + s += static_cast( ' ' ); + s += static_cast( '\"' ); + s += ex.path1().file_string(); + s += static_cast( '\"' ); + } + if ( !ex.path2().empty() ) + { + s += static_cast( ',' ); + s += static_cast( ' ' ); + s += static_cast( '\"' ); + s += ex.path2().file_string(); + s += static_cast( '\"' ); + } + if ( ex.system_error() ) + { + s += static_cast( ' ' ); + + detail::decode_system_message( ex.system_error(), s ); + } + return s; + } } // namespace filesystem } // namespace boost -#include // pops abi_suffix.hpp pragmas +#undef BOOST_FS_FUNC_STRING +#undef BOOST_FS_FUNC + +#include // pops abi_prefix.hpp pragmas #endif // BOOST_FILESYSTEM_CONVENIENCE_HPP diff --git a/boost/boost/filesystem/exception.hpp b/boost/boost/filesystem/exception.hpp index e07429e74e..edea663b1f 100644 --- a/boost/boost/filesystem/exception.hpp +++ b/boost/boost/filesystem/exception.hpp @@ -1,106 +1,9 @@ -// boost/filesystem/exception.hpp ------------------------------------------// +// boost/filesystem/exception.hpp -------------------------------------------// -// Copyright © 2002 Beman Dawes -// Copyright © 2001 Dietmar Kühl -// -// 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) +// Copyright Beman Dawes 2003 +// 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) -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM_EXCEPTION_HPP -#define BOOST_FILESYSTEM_EXCEPTION_HPP - -#include -#include - -#include -#include -#include - -#include // must be the last header - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - namespace detail - { - BOOST_FILESYSTEM_DECL int system_error_code(); // artifact of POSIX and WINDOWS error reporting - } - - enum error_code - { - no_error = 0, - system_error, // system generated error; if possible, is translated - // to one of the more specific errors below. - other_error, // library generated error - security_error, // includes access rights, permissions failures - read_only_error, - io_error, - path_error, - not_found_error, - not_directory_error, - busy_error, // implies trying again might succeed - already_exists_error, - not_empty_error, - is_directory_error, - out_of_space_error, - out_of_memory_error, - out_of_resource_error - }; - - - class BOOST_FILESYSTEM_DECL filesystem_error : public std::exception - { - public: - - filesystem_error( - const std::string & who, - const std::string & message ); // assumed to be error_code::other_error - - filesystem_error( - const std::string & who, - const path & path1, - const std::string & message, - error_code ec = other_error ); - - filesystem_error( - const std::string & who, - const path & path1, - int sys_err_code ); - - filesystem_error( - const std::string & who, - const path & path1, - const path & path2, - int sys_err_code ); - - ~filesystem_error() throw(); - - virtual const char * what() const throw(); - - int native_error() const { return m_sys_err; } - // Note: a value of 0 implies a library (rather than system) error - error_code error() const { return m_err; } - const std::string & who() const; // name of who throwing exception - const path & path1() const; // argument 1 to who; may be empty() - const path & path2() const; // argument 2 to who; may be empty() - - private: - class m_imp; - shared_ptr m_imp_ptr; - int m_sys_err; - error_code m_err; - }; - - } // namespace filesystem -} // namespace boost - -#include // pops abi_suffix.hpp pragmas -#endif // BOOST_FILESYSTEM_EXCEPTION_HPP +// This header is no long used. The contents have been moved to path.hpp. +// It is provided so that user code #includes do not have to be changed. diff --git a/boost/boost/filesystem/fstream.hpp b/boost/boost/filesystem/fstream.hpp index 75fc9b2b2e..bdba8f051c 100644 --- a/boost/boost/filesystem/fstream.hpp +++ b/boost/boost/filesystem/fstream.hpp @@ -12,180 +12,573 @@ #ifndef BOOST_FILESYSTEM_FSTREAM_HPP #define BOOST_FILESYSTEM_FSTREAM_HPP -#include // includes +#include // for 8.3 hack (see below) +#include #include #include #include -#include // must be the last header +#include // must be the last #include + +// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for +// various compiler problems. They have been removed to ease development of the +// basic i18n functionality. Once the new interface is stable, the workarounds +// will be reinstated for any compilers that otherwise can support the rest of +// the library after internationalization. namespace boost { namespace filesystem { + namespace detail + { +# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_NARROW_ONLY) +# if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405 + // The 8.3 hack: + // C++98 does not supply a wchar_t open, so try to get an equivalent + // narrow char name based on the short, so-called 8.3, name. + // Not needed for Dinkumware 405 and later as they do supply wchar_t open. + BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, + std::ios_base::openmode mode ); // true if succeeds + BOOST_FILESYSTEM_DECL std::string narrow_path_api( + const std::wstring & ph ); // return is empty if fails + + inline std::string path_proxy( const std::wstring & file_ph, + std::ios_base::openmode mode ) + // Return a non-existant path if cannot supply narrow short path. + // An empty path doesn't work because some Dinkumware versions + // assert the path is non-empty. + { + std::string narrow_ph; + bool created_file( false ); + if ( !exists( file_ph ) + && (mode & std::ios_base::out) != 0 + && create_file_api( file_ph, mode ) ) + { + created_file = true; + } + narrow_ph = narrow_path_api( file_ph ); + if ( narrow_ph.empty() ) + { + if ( created_file ) remove_api( file_ph ); + narrow_ph = "\x01"; + } + return narrow_ph; + } +# else + // Dinkumware 405 and later does supply wchar_t functions + inline const std::wstring & path_proxy( const std::wstring & file_ph, + std::ios_base::openmode ) + { return file_ph; } +# endif +# endif + + inline const std::string & path_proxy( const std::string & file_ph, + std::ios_base::openmode ) + { return file_ph; } + + } // namespace detail + template < class charT, class traits = std::char_traits > class basic_filebuf : public std::basic_filebuf { + private: // disallow copying + basic_filebuf( const basic_filebuf & ); + const basic_filebuf & operator=( const basic_filebuf & ); public: + basic_filebuf() {} virtual ~basic_filebuf() {} -#if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - std::basic_filebuf * open( const path & file_ph, - std::ios_base::openmode mode ) - { - return std::basic_filebuf::open( - file_ph.native_file_string().c_str(), mode ); - } -#endif - }; - typedef basic_filebuf filebuf; -# ifndef BOOST_NO_STD_WSTRING - typedef basic_filebuf wfilebuf; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + template + typename boost::enable_if, + basic_filebuf *>::type + open( const Path & file_ph, std::ios_base::openmode mode ); + + basic_filebuf * + open( const wpath & file_ph, std::ios_base::openmode mode ); # endif +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + basic_filebuf * + open( const path & file_ph, std::ios_base::openmode mode ); +# endif + }; + template < class charT, class traits = std::char_traits > class basic_ifstream : public std::basic_ifstream { + private: // disallow copying + basic_ifstream( const basic_ifstream & ); + const basic_ifstream & operator=( const basic_ifstream & ); public: basic_ifstream() {} -#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) - explicit basic_ifstream( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::in ) - : std::basic_ifstream( - file_ph.native_file_string().c_str(), mode ) {} -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::in ) - { - std::basic_ifstream::open( - file_ph.native_file_string().c_str(), mode ); - } -# endif -#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 - explicit basic_ifstream( const path & file_ph ) - : std::basic_ifstream( - file_ph.native_file_string().c_str(), std::ios_base::in ) {} - basic_ifstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ifstream( - file_ph.native_file_string().c_str(), mode ) {} - void open( const path & file_ph ) - { - std::basic_ifstream::open( - file_ph.native_file_string().c_str(), std::ios_base::in ); - } - void open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream::open( - file_ph.native_file_string().c_str(), mode ); - } -#endif - virtual ~basic_ifstream() {} - }; - typedef basic_ifstream ifstream; -# ifndef BOOST_NO_STD_WSTRING - typedef basic_ifstream wifstream; + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + template + explicit basic_ifstream( const Path & file_ph, + typename boost::enable_if >::type* dummy = 0 ); + + template + basic_ifstream( const Path & file_ph, std::ios_base::openmode mode, + typename boost::enable_if >::type* dummy = 0 ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph, std::ios_base::openmode mode ); + + explicit basic_ifstream( const wpath & file_ph ); + basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode ); + void open( const wpath & file_ph ); + void open( const wpath & file_ph, std::ios_base::openmode mode ); +# endif + + explicit basic_ifstream( const path & file_ph ); + basic_ifstream( const path & file_ph, std::ios_base::openmode mode ); +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + void open( const path & file_ph ); + void open( const path & file_ph, std::ios_base::openmode mode ); # endif + virtual ~basic_ifstream() {} + }; template < class charT, class traits = std::char_traits > class basic_ofstream : public std::basic_ofstream { + private: // disallow copying + basic_ofstream( const basic_ofstream & ); + const basic_ofstream & operator=( const basic_ofstream & ); public: basic_ofstream() {} -#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) - explicit basic_ofstream( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::out ) - : std::basic_ofstream( - file_ph.native_file_string().c_str(), mode ) {} -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::out ) - { - std::basic_ofstream::open( - file_ph.native_file_string().c_str(), mode ); - } -# endif -#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 - explicit basic_ofstream( const path & file_ph ) - : std::basic_ofstream( - file_ph.native_file_string().c_str(), std::ios_base::out ) {} - basic_ofstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ofstream( - file_ph.native_file_string().c_str(), mode ) {} - void open( const path & file_ph ) - { - std::basic_ofstream::open( - file_ph.native_file_string().c_str(), std::ios_base::out ); - } - void open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream::open( - file_ph.native_file_string().c_str(), mode ); - } -#endif - virtual ~basic_ofstream() {} - }; - typedef basic_ofstream ofstream; -# ifndef BOOST_NO_STD_WSTRING - typedef basic_ofstream wofstream; + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + template + explicit basic_ofstream( const Path & file_ph, + typename boost::enable_if >::type* dummy = 0 ); + explicit basic_ofstream( const wpath & file_ph ); + + template + basic_ofstream( const Path & file_ph, std::ios_base::openmode mode, + typename boost::enable_if >::type* dummy = 0 ); + basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph ); + void open( const wpath & file_ph ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph, std::ios_base::openmode mode ); + void open( const wpath & file_ph, std::ios_base::openmode mode ); + +# endif + + explicit basic_ofstream( const path & file_ph ); + basic_ofstream( const path & file_ph, std::ios_base::openmode mode ); +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + void open( const path & file_ph ); + void open( const path & file_ph, std::ios_base::openmode mode ); # endif + virtual ~basic_ofstream() {} + }; template < class charT, class traits = std::char_traits > class basic_fstream : public std::basic_fstream { + private: // disallow copying + basic_fstream( const basic_fstream & ); + const basic_fstream & operator=( const basic_fstream & ); public: basic_fstream() {} -#if !BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) - explicit basic_fstream( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out ) - : std::basic_fstream( - file_ph.native_file_string().c_str(), mode ) {} -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph, - std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out ) - { - std::basic_fstream::open( - file_ph.native_file_string().c_str(), mode ); - } -# endif -#else // workaround for VC++ 7.1 bug id VSWhidbey 38416 - explicit basic_fstream( const path & file_ph ) - : std::basic_fstream( - file_ph.native_file_string().c_str(), - std::ios_base::in|std::ios_base::out ) {} - basic_fstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_fstream( - file_ph.native_file_string().c_str(), mode ) {} - void open( const path & file_ph ) - { - std::basic_fstream::open( - file_ph.native_file_string().c_str(), - std::ios_base::in|std::ios_base::out ); - } - void open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream::open( - file_ph.native_file_string().c_str(), mode ); - } -#endif + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + template + explicit basic_fstream( const Path & file_ph, + typename boost::enable_if >::type* dummy = 0 ); + explicit basic_fstream( const wpath & file_ph ); + + template + basic_fstream( const Path & file_ph, std::ios_base::openmode mode, + typename boost::enable_if >::type* dummy = 0 ); + basic_fstream( const wpath & file_ph, std::ios_base::openmode mode ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph ); + void open( const wpath & file_ph ); + + template + typename boost::enable_if, void>::type + open( const Path & file_ph, std::ios_base::openmode mode ); + void open( const wpath & file_ph, std::ios_base::openmode mode ); + +# endif + + explicit basic_fstream( const path & file_ph ); + basic_fstream( const path & file_ph, std::ios_base::openmode mode ); +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + void open( const path & file_ph ); + void open( const path & file_ph, std::ios_base::openmode mode ); +# endif virtual ~basic_fstream() {} + }; + typedef basic_filebuf filebuf; + typedef basic_ifstream ifstream; + typedef basic_ofstream ofstream; typedef basic_fstream fstream; -# ifndef BOOST_NO_STD_WSTRING + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + typedef basic_filebuf wfilebuf; + typedef basic_ifstream wifstream; typedef basic_fstream wfstream; + typedef basic_ofstream wofstream; +# endif + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + +// basic_filebuf definitions -----------------------------------------------// + + template + template + typename boost::enable_if, + basic_filebuf *>::type + basic_filebuf::open( const Path & file_ph, + std::ios_base::openmode mode ) + { + return (std::basic_filebuf::open( detail::path_proxy( + file_ph.external_file_string(), mode ).c_str(), mode ) + == 0) ? 0 : this; + } + + template + basic_filebuf * + basic_filebuf::open( const wpath & file_ph, + std::ios_base::openmode mode ) + { + return this->BOOST_NESTED_TEMPLATE open( file_ph, mode ); + } + +// basic_ifstream definitions ----------------------------------------------// + + template template + basic_ifstream::basic_ifstream(const Path & file_ph, + typename boost::enable_if >::type* ) + : std::basic_ifstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in ).c_str(), std::ios_base::in ) {} + + template + basic_ifstream::basic_ifstream( const wpath & file_ph ) + : std::basic_ifstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in ).c_str(), std::ios_base::in ) {} + + template template + basic_ifstream::basic_ifstream( const Path & file_ph, + std::ios_base::openmode mode, + typename boost::enable_if >::type* ) + : std::basic_ifstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in ) {} + + template + basic_ifstream::basic_ifstream( const wpath & file_ph, + std::ios_base::openmode mode ) + : std::basic_ifstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in ) {} + + template template + typename boost::enable_if, void>::type + basic_ifstream::open( const Path & file_ph ) + { + std::basic_ifstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in ).c_str(), std::ios_base::in ); + } + + template + void basic_ifstream::open( const wpath & file_ph ) + { + std::basic_ifstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in ).c_str(), std::ios_base::in ); + } + + template template + typename boost::enable_if, void>::type + basic_ifstream::open( const Path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ifstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in ); + } + + template + void basic_ifstream::open( const wpath & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ifstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in ); + } + +// basic_ofstream definitions ----------------------------------------------// + + template template + basic_ofstream::basic_ofstream(const Path & file_ph, + typename boost::enable_if >::type* ) + : std::basic_ofstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::out ).c_str(), std::ios_base::out ) {} + + template + basic_ofstream::basic_ofstream( const wpath & file_ph ) + : std::basic_ofstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::out ).c_str(), std::ios_base::out ) {} + + template template + basic_ofstream::basic_ofstream( const Path & file_ph, + std::ios_base::openmode mode, + typename boost::enable_if >::type* ) + : std::basic_ofstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::out ) {} + + template + basic_ofstream::basic_ofstream( const wpath & file_ph, + std::ios_base::openmode mode ) + : std::basic_ofstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::out ) {} + + template template + typename boost::enable_if, void>::type + basic_ofstream::open( const Path & file_ph ) + { + std::basic_ofstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::out ).c_str(), std::ios_base::out ); + } + + template + void basic_ofstream::open( const wpath & file_ph ) + { + std::basic_ofstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::out ).c_str(), std::ios_base::out ); + } + + template template + typename boost::enable_if, void>::type + basic_ofstream::open( const Path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ofstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::out ); + } + + template + void basic_ofstream::open( const wpath & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ofstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::out ); + } + +// basic_fstream definitions -----------------------------------------------// + + template template + basic_fstream::basic_fstream(const Path & file_ph, + typename boost::enable_if >::type* ) + : std::basic_fstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in|std::ios_base::out ).c_str(), + std::ios_base::in|std::ios_base::out ) {} + + template + basic_fstream::basic_fstream( const wpath & file_ph ) + : std::basic_fstream( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in|std::ios_base::out ).c_str(), + std::ios_base::in|std::ios_base::out ) {} + + template template + basic_fstream::basic_fstream( const Path & file_ph, + std::ios_base::openmode mode, + typename boost::enable_if >::type* ) + : std::basic_fstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ) {} + + template + basic_fstream::basic_fstream( const wpath & file_ph, + std::ios_base::openmode mode ) + : std::basic_fstream( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ) {} + + template template + typename boost::enable_if, void>::type + basic_fstream::open( const Path & file_ph ) + { + std::basic_fstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in|std::ios_base::out ).c_str(), + std::ios_base::in|std::ios_base::out ); + } + + template + void basic_fstream::open( const wpath & file_ph ) + { + std::basic_fstream::open( + detail::path_proxy( file_ph.external_file_string(), + std::ios_base::in|std::ios_base::out ).c_str(), + std::ios_base::in|std::ios_base::out ); + } + + template template + typename boost::enable_if, void>::type + basic_fstream::open( const Path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_fstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ); + } + + template + void basic_fstream::open( const wpath & file_ph, + std::ios_base::openmode mode ) + { + std::basic_fstream::open( + detail::path_proxy( file_ph.external_file_string(), + mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ); + } + +# endif + +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + template + basic_filebuf * + basic_filebuf::open( const path & file_ph, + std::ios_base::openmode mode ) + { + return std::basic_filebuf::open( + file_ph.file_string().c_str(), mode ) == 0 ? 0 : this; + } +# endif + + template + basic_ifstream::basic_ifstream( const path & file_ph ) + : std::basic_ifstream( + file_ph.file_string().c_str(), std::ios_base::in ) {} + + template + basic_ifstream::basic_ifstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_ifstream( + file_ph.file_string().c_str(), mode ) {} + +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + template + void basic_ifstream::open( const path & file_ph ) + { + std::basic_ifstream::open( + file_ph.file_string().c_str(), std::ios_base::in ); + } + + template + void basic_ifstream::open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ifstream::open( + file_ph.file_string().c_str(), mode ); + } # endif - } // namespace filesystem + template + basic_ofstream::basic_ofstream( const path & file_ph ) + : std::basic_ofstream( + file_ph.file_string().c_str(), std::ios_base::out ) {} + + template + basic_ofstream::basic_ofstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_ofstream( + file_ph.file_string().c_str(), mode ) {} + +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + template + void basic_ofstream::open( const path & file_ph ) + { + std::basic_ofstream::open( + file_ph.file_string().c_str(), std::ios_base::out ); + } + + template + void basic_ofstream::open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_ofstream::open( + file_ph.file_string().c_str(), mode ); + } +# endif + + template + basic_fstream::basic_fstream( const path & file_ph ) + : std::basic_fstream( + file_ph.file_string().c_str(), + std::ios_base::in|std::ios_base::out ) {} + + + template + basic_fstream::basic_fstream( const path & file_ph, + std::ios_base::openmode mode ) + : std::basic_fstream( + file_ph.file_string().c_str(), mode ) {} + +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this + template + void basic_fstream::open( const path & file_ph ) + { + std::basic_fstream::open( + file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out ); + } + + template + void basic_fstream::open( const path & file_ph, + std::ios_base::openmode mode ) + { + std::basic_fstream::open( + file_ph.file_string().c_str(), mode ); + } +# endif + } // namespace filesystem } // namespace boost -#include // pops abi_suffix.hpp pragmas +#include // pops abi_prefix.hpp pragmas #endif // BOOST_FILESYSTEM_FSTREAM_HPP diff --git a/boost/boost/filesystem/operations.hpp b/boost/boost/filesystem/operations.hpp index a9bff05bdf..a5daa9d6cb 100644 --- a/boost/boost/filesystem/operations.hpp +++ b/boost/boost/filesystem/operations.hpp @@ -1,8 +1,8 @@ -// boost/filesystem/directory.hpp ------------------------------------------// +// boost/filesystem/operations.hpp -----------------------------------------// -// Copyright © 2002, 2003 Beman Dawes -// Copyright © 2002 Jan Langer -// Copyright © 2001 Dietmar Kühl +// Copyright 2002-2005 Beman Dawes +// Copyright 2002 Jan Langer +// Copyright 2001 Dietmar Kuehl // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy @@ -12,138 +12,1088 @@ //----------------------------------------------------------------------------// -#ifndef BOOST_FILESYSTEM_DIRECTORY_HPP -#define BOOST_FILESYSTEM_DIRECTORY_HPP +#ifndef BOOST_FILESYSTEM_OPERATIONS_HPP +#define BOOST_FILESYSTEM_OPERATIONS_HPP #include // includes + #include +#include +#include #include #include +#include #include +#include // for pair #include -#include // must be the last header +#ifdef BOOST_WINDOWS_API +# include +# if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0500 +# define BOOST_FS_HARD_LINK // Default for Windows 2K or later +# endif +#endif + +#include // must be the last #include # ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::time_t; } # endif +# ifndef BOOST_FILESYSTEM_NARROW_ONLY +# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ + template typename boost::enable_if, \ + BOOST_FS_TYPE>::type +# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \ + template inline typename boost::enable_if, \ + BOOST_FS_TYPE>::type +# define BOOST_FS_TYPENAME typename +# else +# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE +# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE + typedef boost::filesystem::path Path; +# define BOOST_FS_TYPENAME +# endif + //----------------------------------------------------------------------------// namespace boost { namespace filesystem { + template class basic_directory_iterator; + + // BOOST_FILESYSTEM_NARROW_ONLY needs this: + typedef basic_directory_iterator directory_iterator; + + template class basic_directory_entry; + + enum file_type + { + status_unknown, + file_not_found, + regular_file, + directory_file, + // the following will never be reported by some operating or file systems + symlink_file, + block_file, + character_file, + fifo_file, + socket_file, + type_unknown // file does exist, but isn't one of the above types + }; + + class file_status + { + public: + explicit file_status( file_type v = status_unknown ) : m_value(v) {} + + void type( file_type v ) { m_value = v; } + file_type type() const { return m_value; } + + private: + // the internal representation is unspecified so that additional state + // information such as permissions can be added in the future; this + // implementation just uses status_type as the internal representation + + file_type m_value; + }; + + inline bool status_known( file_status f ) { return f.type() != status_unknown; } + inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; } + inline bool is_regular( file_status f ) { return f.type() == regular_file; } + inline bool is_directory( file_status f ) { return f.type() == directory_file; } + inline bool is_symlink( file_status f ) { return f.type() == symlink_file; } + inline bool is_other( file_status f ) { return exists(f) && !is_regular(f) && !is_directory(f) && !is_symlink(f); } + + struct space_info + { + // all values are byte counts + boost::uintmax_t capacity; + boost::uintmax_t free; // <= capacity + boost::uintmax_t available; // <= free + }; + + namespace detail + { + typedef std::pair< boost::filesystem::system_error_type, bool > + query_pair; + + typedef std::pair< boost::filesystem::system_error_type, boost::uintmax_t > + uintmax_pair; + + typedef std::pair< boost::filesystem::system_error_type, std::time_t > + time_pair; + + typedef std::pair< boost::filesystem::system_error_type, space_info > + space_pair; + + template< class Path > + struct directory_pair + { + typedef std::pair< boost::filesystem::system_error_type, + typename Path::external_string_type > type; + }; + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + BOOST_FILESYSTEM_DECL bool + symbolic_link_exists_api( const std::string & ); // deprecated +# endif + + BOOST_FILESYSTEM_DECL file_status + status_api( const std::string & ph, system_error_type & ec ); +# ifndef BOOST_WINDOWS_API + BOOST_FILESYSTEM_DECL file_status + symlink_status_api( const std::string & ph, system_error_type & ec ); +# endif + BOOST_FILESYSTEM_DECL query_pair + is_empty_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL query_pair + equivalent_api( const std::string & ph1, const std::string & ph2 ); + BOOST_FILESYSTEM_DECL uintmax_pair + file_size_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL space_pair + space_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL time_pair + last_write_time_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + last_write_time_api( const std::string & ph, std::time_t new_value ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_current_path_api( std::string & ph ); + BOOST_FILESYSTEM_DECL query_pair + create_directory_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_hard_link_api( const std::string & to_ph, + const std::string & from_ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_symlink_api( const std::string & to_ph, + const std::string & from_ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + remove_api( const std::string & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + rename_api( const std::string & from, const std::string & to ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + copy_file_api( const std::string & from, const std::string & to ); + +# if defined(BOOST_WINDOWS_API) + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_full_path_name_api( const std::string & ph, std::string & target ); + +# if !defined(BOOST_FILESYSTEM_NARROW_ONLY) + + BOOST_FILESYSTEM_DECL boost::filesystem::file_status + status_api( const std::wstring & ph, system_error_type & ec ); + BOOST_FILESYSTEM_DECL query_pair + is_empty_api( const std::wstring & ph ); + BOOST_FILESYSTEM_DECL query_pair + equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ); + BOOST_FILESYSTEM_DECL uintmax_pair + file_size_api( const std::wstring & ph ); + BOOST_FILESYSTEM_DECL space_pair + space_api( const std::wstring & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_full_path_name_api( const std::wstring & ph, std::wstring & target ); + BOOST_FILESYSTEM_DECL time_pair + last_write_time_api( const std::wstring & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + last_write_time_api( const std::wstring & ph, std::time_t new_value ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_current_path_api( std::wstring & ph ); + BOOST_FILESYSTEM_DECL query_pair + create_directory_api( const std::wstring & ph ); +# ifdef BOOST_FS_HARD_LINK + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_hard_link_api( const std::wstring & existing_ph, + const std::wstring & new_ph ); +# endif + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_symlink_api( const std::wstring & to_ph, + const std::wstring & from_ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + remove_api( const std::wstring & ph ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + rename_api( const std::wstring & from, const std::wstring & to ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + copy_file_api( const std::wstring & from, const std::wstring & to ); + +# endif +# endif + + template + unsigned long remove_all_aux( const Path & ph ); + + } // namespace detail + +// operations functions ----------------------------------------------------// + + // The non-template overloads enable automatic conversion from std and + // C-style strings. See basic_path constructors. The enable_if for the + // templates implements the famous "do-the-right-thing" rule. // query functions ---------------------------------------------------------// - BOOST_FILESYSTEM_DECL bool exists( const path & ph ); - BOOST_FILESYSTEM_DECL bool symbolic_link_exists( const path & ph ); - BOOST_FILESYSTEM_DECL bool is_directory( const path & ph ); + BOOST_INLINE_FS_FUNC(file_status) + status( const Path & ph, system_error_type & ec ) + { return detail::status_api( ph.external_file_string(), ec ); } + + BOOST_FS_FUNC(file_status) + status( const Path & ph ) + { + system_error_type ec; + file_status result( detail::status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::status", ph, ec ) ); + return result; + } + + BOOST_INLINE_FS_FUNC(file_status) + symlink_status( const Path & ph, system_error_type & ec ) +# ifdef BOOST_WINDOWS_API + { return detail::status_api( ph.external_file_string(), ec ); } +# else + { return detail::symlink_status_api( ph.external_file_string(), ec ); } +# endif + + BOOST_FS_FUNC(file_status) + symlink_status( const Path & ph ) + { + system_error_type ec; + file_status result( symlink_status( ph, ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::symlink_status", ph, ec ) ); + return result; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline bool symbolic_link_exists( const path & ph ) + { return is_symlink( symlink_status(ph) ); } +#endif + + BOOST_FS_FUNC(bool) exists( const Path & ph ) + { + system_error_type ec; + file_status result( detail::status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::exists", ph, ec ) ); + return exists( result ); + } + + BOOST_FS_FUNC(bool) is_directory( const Path & ph ) + { + system_error_type ec; + file_status result( detail::status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::is_directory", ph, ec ) ); + return is_directory( result ); + } + + BOOST_FS_FUNC(bool) is_regular( const Path & ph ) + { + system_error_type ec; + file_status result( detail::status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::is_regular", ph, ec ) ); + return is_regular( result ); + } + + BOOST_FS_FUNC(bool) is_other( const Path & ph ) + { + system_error_type ec; + file_status result( detail::status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::is_other", ph, ec ) ); + return is_other( result ); + } + + BOOST_FS_FUNC(bool) is_symlink( +# ifdef BOOST_WINDOWS_API + const Path & ) + { + return false; +# else + const Path & ph) + { + system_error_type ec; + file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) ); + if ( ec ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::is_symlink", ph, ec ) ); + return is_symlink( result ); +# endif + } // VC++ 7.0 and earlier has a serious namespace bug that causes a clash // between boost::filesystem::is_empty and the unrelated type trait - // boost::is_empty. The workaround for those who must use broken versions - // of VC++ is to use the function _is_empty. All others should use the - // correct is_empty name. - BOOST_FILESYSTEM_DECL bool _is_empty( const path & ph ); // deprecated + // boost::is_empty. -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 - inline bool is_empty( const path & ph ) { return _is_empty( ph ); } -# endif +# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 + BOOST_FS_FUNC(bool) is_empty( const Path & ph ) +# else + BOOST_FS_FUNC(bool) _is_empty( const Path & ph ) +# endif + { + detail::query_pair result = detail::is_empty_api( ph.external_file_string() ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::is_empty", ph, result.first ) ); + return result.second; + } + + BOOST_FS_FUNC(bool) equivalent( const Path & ph1, const Path & ph2 ) + { + detail::query_pair result = detail::equivalent_api( + ph1.external_file_string(), ph2.external_file_string() ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::equivalent", ph1, ph2, result.first ) ); + return result.second; + } + + BOOST_FS_FUNC(boost::uintmax_t) file_size( const Path & ph ) + { + detail::uintmax_pair result + = detail::file_size_api( ph.external_file_string() ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::file_size", ph, result.first ) ); + return result.second; + } + + BOOST_FS_FUNC(space_info) space( const Path & ph ) + { + detail::space_pair result + = detail::space_api( ph.external_file_string() ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::space", ph, result.first ) ); + return result.second; + } + + BOOST_FS_FUNC(std::time_t) last_write_time( const Path & ph ) + { + detail::time_pair result + = detail::last_write_time_api( ph.external_file_string() ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::last_write_time", ph, result.first ) ); + return result.second; + } - BOOST_FILESYSTEM_DECL bool equivalent( const path & ph1, const path & ph2 ); - BOOST_FILESYSTEM_DECL boost::intmax_t file_size( const path & ph ); - BOOST_FILESYSTEM_DECL std::time_t last_write_time( const path & ph ); - BOOST_FILESYSTEM_DECL void last_write_time( const path & ph, const std::time_t new_time ); // operations --------------------------------------------------------------// - BOOST_FILESYSTEM_DECL bool create_directory( const path & directory_ph ); + BOOST_FS_FUNC(bool) create_directory( const Path & dir_ph ) + { + detail::query_pair result( + detail::create_directory_api( dir_ph.external_directory_string() ) ); + if ( result.first != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::create_directory", + dir_ph, result.first ) ); + return result.second; + } + +#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) + BOOST_FS_FUNC(void) + create_hard_link( const Path & to_ph, const Path & from_ph ) + { + system_error_type result( + detail::create_hard_link_api( + to_ph.external_file_string(), + from_ph.external_file_string() ) ); + if ( result != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::create_hard_link", + to_ph, from_ph, result ) ); + } + + BOOST_FS_FUNC(system_error_type) + create_hard_link( const Path & to_ph, const Path & from_ph, + system_error_type & ec ) + { + ec = detail::create_hard_link_api( + to_ph.external_file_string(), + from_ph.external_file_string() ); + return ec; + } +#endif + + BOOST_FS_FUNC(void) + create_symlink( const Path & to_ph, const Path & from_ph ) + { + system_error_type result( + detail::create_symlink_api( + to_ph.external_file_string(), + from_ph.external_file_string() ) ); + if ( result ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::create_symlink", + to_ph, from_ph, result ) ); + } + + BOOST_FS_FUNC(system_error_type) + create_symlink( const Path & to_ph, const Path & from_ph, + system_error_type & ec ) + { + ec = detail::create_symlink_api( + to_ph.external_file_string(), + from_ph.external_file_string() ); + return ec; + } + + BOOST_FS_FUNC(bool) remove( const Path & ph ) + { + if ( exists( ph ) + || is_symlink( ph ) ) // handle dangling symbolic links + // note that the POSIX behavior for symbolic links is what we want; + // the link rather than what it points to is deleted. Windows behavior + // doesn't matter; is_symlink() is always false on Windows. + { + system_error_type result = detail::remove_api( ph.external_file_string() ); + if ( result != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::remove", + ph, result ) ); + return true; + } + return false; + } + + BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph ) + { + return exists( ph )|| is_symlink( ph ) + ? detail::remove_all_aux( ph ) : 0; + } + + BOOST_FS_FUNC(void) rename( const Path & from_path, const Path & to_path ) + { + system_error_type result = detail::rename_api( + from_path.external_directory_string(), + to_path.external_directory_string() ); + if ( result != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::rename", + from_path, to_path, result ) ); + } + + BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path ) + { + system_error_type result = detail::copy_file_api( + from_path.external_directory_string(), + to_path.external_directory_string() ); + if ( result != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::copy_file", + from_path, to_path, result ) ); + } + + template< class Path > + Path current_path() + { + typename Path::external_string_type ph; + boost::filesystem::system_error_type result; + if ( (result = detail::get_current_path_api( ph )) != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::current_path", result ) ); + return Path( Path::traits_type::to_internal( ph ) ); + } + + template< class Path > + const Path & initial_path() + { + static Path init_path; + if ( init_path.empty() ) init_path = current_path(); + return init_path; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + // legacy support + inline path current_path() // overload supports pre-i18n apps + { return current_path(); } + inline const path & initial_path() // overload supports pre-i18n apps + { return initial_path(); } +# endif + + BOOST_FS_FUNC(Path) system_complete( const Path & ph ) + { +# ifdef BOOST_WINDOWS_API + if ( ph.empty() ) return ph; + BOOST_FS_TYPENAME Path::external_string_type sys_ph; + boost::filesystem::system_error_type result; + if ( (result = detail::get_full_path_name_api( ph.external_file_string(), + sys_ph )) != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::system_complete", ph, result ) ); + return Path( Path::traits_type::to_internal( sys_ph ) ); +# else + return (ph.empty() || ph.is_complete()) + ? ph : current_path() / ph; +# endif + } + + BOOST_FS_FUNC(Path) + complete( const Path & ph, + const Path & base/* = initial_path() */) + { + BOOST_ASSERT( base.is_complete() + && (ph.is_complete() || !ph.has_root_name()) + && "boost::filesystem::complete() precondition not met" ); +# ifdef BOOST_WINDOWS_PATH + if (ph.empty() || ph.is_complete()) return ph; + if ( !ph.has_root_name() ) + return ph.has_root_directory() + ? Path( base.root_name() ) / ph + : base / ph; + return base / ph; +# else + return (ph.empty() || ph.is_complete()) ? ph : base / ph; +# endif + } + + // VC++ 7.1 had trouble with default arguments, so separate one argument + // signatures are provided as workarounds; the effect is the same. + BOOST_FS_FUNC(Path) complete( const Path & ph ) + { return complete( ph, initial_path() ); } + + BOOST_FS_FUNC(void) + last_write_time( const Path & ph, const std::time_t new_time ) + { + boost::filesystem::system_error_type result; + if ( (result = detail::last_write_time_api( ph.external_file_string(), + new_time )) != 0 ) + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::last_write_time", ph, result ) ); + } + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + // "do-the-right-thing" overloads ---------------------------------------// + + inline file_status status( const path & ph ) + { return status( ph ); } + inline file_status status( const wpath & ph ) + { return status( ph ); } + + inline file_status status( const path & ph, system_error_type & ec ) + { return status( ph, ec ); } + inline file_status status( const wpath & ph, system_error_type & ec ) + { return status( ph, ec ); } + + inline file_status symlink_status( const path & ph ) + { return symlink_status( ph ); } + inline file_status symlink_status( const wpath & ph ) + { return symlink_status( ph ); } + + inline file_status symlink_status( const path & ph, system_error_type & ec ) + { return symlink_status( ph, ec ); } + inline file_status symlink_status( const wpath & ph, system_error_type & ec ) + { return symlink_status( ph, ec ); } - BOOST_FILESYSTEM_DECL bool remove( const path & ph ); - BOOST_FILESYSTEM_DECL unsigned long remove_all( const path & ph ); + inline bool exists( const path & ph ) { return exists( ph ); } + inline bool exists( const wpath & ph ) { return exists( ph ); } - BOOST_FILESYSTEM_DECL void rename( const path & from_path, - const path & to_path ); + inline bool is_directory( const path & ph ) + { return is_directory( ph ); } + inline bool is_directory( const wpath & ph ) + { return is_directory( ph ); } + + inline bool is_regular( const path & ph ) + { return is_regular( ph ); } + inline bool is_regular( const wpath & ph ) + { return is_regular( ph ); } - BOOST_FILESYSTEM_DECL void copy_file( const path & from_file_ph, - const path & to_file_ph ); + inline bool is_other( const path & ph ) + { return is_other( ph ); } + inline bool is_other( const wpath & ph ) + { return is_other( ph ); } - BOOST_FILESYSTEM_DECL path current_path(); - BOOST_FILESYSTEM_DECL const path & initial_path(); + inline bool is_symlink( const path & ph ) + { return is_symlink( ph ); } + inline bool is_symlink( const wpath & ph ) + { return is_symlink( ph ); } - BOOST_FILESYSTEM_DECL path system_complete( const path & ph ); - BOOST_FILESYSTEM_DECL path complete( const path & ph, const path & base = initial_path() ); + inline bool is_empty( const path & ph ) + { return is_empty( ph ); } + inline bool is_empty( const wpath & ph ) + { return is_empty( ph ); } + + inline bool equivalent( const path & ph1, const path & ph2 ) + { return equivalent( ph1, ph2 ); } + inline bool equivalent( const wpath & ph1, const wpath & ph2 ) + { return equivalent( ph1, ph2 ); } + + inline boost::uintmax_t file_size( const path & ph ) + { return file_size( ph ); } + inline boost::uintmax_t file_size( const wpath & ph ) + { return file_size( ph ); } + + inline space_info space( const path & ph ) + { return space( ph ); } + inline space_info space( const wpath & ph ) + { return space( ph ); } + + inline std::time_t last_write_time( const path & ph ) + { return last_write_time( ph ); } + inline std::time_t last_write_time( const wpath & ph ) + { return last_write_time( ph ); } + + inline bool create_directory( const path & dir_ph ) + { return create_directory( dir_ph ); } + inline bool create_directory( const wpath & dir_ph ) + { return create_directory( dir_ph ); } + +#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) + inline void create_hard_link( const path & to_ph, + const path & from_ph ) + { return create_hard_link( to_ph, from_ph ); } + inline void create_hard_link( const wpath & to_ph, + const wpath & from_ph ) + { return create_hard_link( to_ph, from_ph ); } + + inline system_error_type create_hard_link( const path & to_ph, + const path & from_ph, system_error_type & ec ) + { return create_hard_link( to_ph, from_ph, ec ); } + inline system_error_type create_hard_link( const wpath & to_ph, + const wpath & from_ph, system_error_type & ec ) + { return create_hard_link( to_ph, from_ph, ec ); } +#endif + + inline void create_symlink( const path & to_ph, + const path & from_ph ) + { return create_symlink( to_ph, from_ph ); } + inline void create_symlink( const wpath & to_ph, + const wpath & from_ph ) + { return create_symlink( to_ph, from_ph ); } + + inline system_error_type create_symlink( const path & to_ph, + const path & from_ph, system_error_type & ec ) + { return create_symlink( to_ph, from_ph, ec ); } + inline system_error_type create_symlink( const wpath & to_ph, + const wpath & from_ph, system_error_type & ec ) + { return create_symlink( to_ph, from_ph, ec ); } + + inline bool remove( const path & ph ) + { return remove( ph ); } + inline bool remove( const wpath & ph ) + { return remove( ph ); } + + inline unsigned long remove_all( const path & ph ) + { return remove_all( ph ); } + inline unsigned long remove_all( const wpath & ph ) + { return remove_all( ph ); } + + inline void rename( const path & from_path, const path & to_path ) + { return rename( from_path, to_path ); } + inline void rename( const wpath & from_path, const wpath & to_path ) + { return rename( from_path, to_path ); } + + inline void copy_file( const path & from_path, const path & to_path ) + { return copy_file( from_path, to_path ); } + inline void copy_file( const wpath & from_path, const wpath & to_path ) + { return copy_file( from_path, to_path ); } + + inline path system_complete( const path & ph ) + { return system_complete( ph ); } + inline wpath system_complete( const wpath & ph ) + { return system_complete( ph ); } + + inline path complete( const path & ph, + const path & base/* = initial_path()*/ ) + { return complete( ph, base ); } + inline wpath complete( const wpath & ph, + const wpath & base/* = initial_path()*/ ) + { return complete( ph, base ); } + + inline path complete( const path & ph ) + { return complete( ph, initial_path() ); } + inline wpath complete( const wpath & ph ) + { return complete( ph, initial_path() ); } + + inline void last_write_time( const path & ph, const std::time_t new_time ) + { last_write_time( ph, new_time ); } + inline void last_write_time( const wpath & ph, const std::time_t new_time ) + { last_write_time( ph, new_time ); } + +# endif // BOOST_FILESYSTEM_NARROW_ONLY + + namespace detail + { + template + unsigned long remove_all_aux( const Path & ph ) + { + static const boost::filesystem::basic_directory_iterator end_itr; + unsigned long count = 1; + if ( !boost::filesystem::is_symlink( ph ) // don't recurse symbolic links + && boost::filesystem::is_directory( ph ) ) + { + for ( boost::filesystem::basic_directory_iterator itr( ph ); + itr != end_itr; ++itr ) + { + count += remove_all_aux( itr->path() ); + } + } + boost::filesystem::remove( ph ); + return count; + } // test helper -------------------------------------------------------------// // not part of the documented interface because false positives are possible; // there is no law that says that an OS that has large stat.st_size // actually supports large file sizes. - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); // directory_iterator helpers ----------------------------------------------// + // forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class -// directory_iterator, and so avoid iterator_facade DLL template problems - namespace detail - { - class dir_itr_imp; - // shared_ptr provides shallow-copy semantics required for InputIterators - typedef boost::shared_ptr< dir_itr_imp > dir_itr_imp_ptr; - BOOST_FILESYSTEM_DECL void dir_itr_init( dir_itr_imp_ptr & m_imp, - const path & dir_path ); - BOOST_FILESYSTEM_DECL path & dir_itr_dereference( - const dir_itr_imp_ptr & m_imp ); - BOOST_FILESYSTEM_DECL void dir_itr_increment( dir_itr_imp_ptr & m_imp ); +// basic_directory_iterator, and so avoid iterator_facade DLL template +// problems. They also overload to the proper external path character type. + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_first( void *& handle, +#if defined(BOOST_POSIX_API) + void *& buffer, +#endif + const std::string & dir_path, + std::string & target, file_status & fs, file_status & symlink_fs ); + // eof: return==0 && handle==0 + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_increment( void *& handle, +#if defined(BOOST_POSIX_API) + void *& buffer, +#endif + std::string & target, file_status & fs, file_status & symlink_fs ); + // eof: return==0 && handle==0 + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_close( void *& handle +#if defined(BOOST_POSIX_API) + , void *& buffer +#endif + ); + // Effects: none if handle==0, otherwise close handle, set handle=0 + +# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_NARROW_ONLY) + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_first( void *& handle, const std::wstring & ph, + std::wstring & target, file_status & fs, file_status & symlink_fs ); + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_increment( void *& handle, std::wstring & target, + file_status & fs, file_status & symlink_fs ); +# endif + + template< class Path > + class dir_itr_imp + { + public: + basic_directory_entry m_directory_entry; + void * m_handle; +# ifdef BOOST_POSIX_API + void * m_buffer; // see dir_itr_increment implementation +# endif + dir_itr_imp() : m_handle(0) +# ifdef BOOST_POSIX_API + , m_buffer(0) +# endif + {} + + ~dir_itr_imp() { dir_itr_close( m_handle +#if defined(BOOST_POSIX_API) + , m_buffer +#endif + ); } + }; + + BOOST_FILESYSTEM_DECL extern system_error_type not_found_error; } // namespace detail -// directory_iterator ------------------------------------------------------// +// basic_directory_iterator ------------------------------------------------// - class directory_iterator + template< class Path > + class basic_directory_iterator : public boost::iterator_facade< - directory_iterator, - path, - boost::single_pass_traversal_tag > + basic_directory_iterator, + basic_directory_entry, + boost::single_pass_traversal_tag > { public: - directory_iterator(){} // creates the "end" iterator - explicit directory_iterator( const path & p ) - { detail::dir_itr_init( m_imp, p ); } - -/* -The *r++ requirement doesn't appear to apply to the new single_pass_traversal category -Thus I'm leaving the proxy out pending confirmation from the N1477 authors -struct path_proxy // allows *r++ to work, as required by 24.1.1 - { - path pv; - explicit path_proxy( const path & p ) : pv(p) {} - path operator*() const { return pv; } - }; + typedef Path path_type; - path_proxy operator++(int) - { - path_proxy pp( m_deref() ); - ++*this; - return pp; - } -*/ + basic_directory_iterator(){} // creates the "end" iterator + + explicit basic_directory_iterator( const Path & dir_path ); + basic_directory_iterator( const Path & dir_path, system_error_type & ec ); private: - detail::dir_itr_imp_ptr m_imp; + + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::dir_itr_imp< Path > > m_imp; + friend class boost::iterator_core_access; - reference dereference() const - { return detail::dir_itr_dereference( m_imp ); } - void increment() - { detail::dir_itr_increment( m_imp ); } - bool equal( const directory_iterator & rhs ) const + + typename boost::iterator_facade< + basic_directory_iterator, + basic_directory_entry, + boost::single_pass_traversal_tag >::reference dereference() const + { + BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); + return m_imp->m_directory_entry; + } + + void increment(); + + bool equal( const basic_directory_iterator & rhs ) const { return m_imp == rhs.m_imp; } + + system_error_type m_init( const Path & dir_path ); }; + + typedef basic_directory_iterator< path > directory_iterator; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + typedef basic_directory_iterator< wpath > wdirectory_iterator; +# endif + + // basic_directory_iterator implementation ---------------------------// + + template + system_error_type basic_directory_iterator::m_init( + const Path & dir_path ) + { + if ( dir_path.empty() ) + { + m_imp.reset(); + return detail::not_found_error; + } + system_error_type sys_err; + typename Path::external_string_type name; + file_status fs, symlink_fs; + + if ( (sys_err = detail::dir_itr_first( m_imp->m_handle, +#if defined(BOOST_POSIX_API) + m_imp->m_buffer, +#endif + dir_path.external_directory_string(), + name, fs, symlink_fs )) != 0 ) + { + m_imp.reset(); + return sys_err; + } + + if ( m_imp->m_handle == 0 ) m_imp.reset(); // eof, so make end iterator + else // not eof + { + m_imp->m_directory_entry.assign( dir_path + / Path::traits_type::to_internal( name ), fs, symlink_fs ); + if ( name[0] == dot::value // dot or dot-dot + && (name.size() == 1 + || (name[1] == dot::value + && name.size() == 2)) ) + { increment(); } + } + return 0; + } + + template + basic_directory_iterator::basic_directory_iterator( + const Path & dir_path ) + : m_imp( new detail::dir_itr_imp ) + { + system_error_type ec( m_init(dir_path) ); + if ( ec != 0 ) + { + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::basic_directory_iterator constructor", + dir_path, ec ) ); + } + } + + template + basic_directory_iterator::basic_directory_iterator( + const Path & dir_path, system_error_type & ec ) + : m_imp( new detail::dir_itr_imp ) + { + ec = m_init(dir_path); + } + + template + void basic_directory_iterator::increment() + { + BOOST_ASSERT( m_imp.get() && "attempt to increment end iterator" ); + BOOST_ASSERT( m_imp->m_handle != 0 && "internal program error" ); + + system_error_type sys_err(0); + typename Path::external_string_type name; + file_status fs, symlink_fs; + + for (;;) + { + if ( (sys_err = detail::dir_itr_increment( m_imp->m_handle, +#if defined(BOOST_POSIX_API) + m_imp->m_buffer, +#endif + name, fs, symlink_fs )) != 0 ) + { + boost::throw_exception( basic_filesystem_error( + "boost::filesystem::basic_directory_iterator increment", + m_imp->m_directory_entry.path().branch_path(), sys_err ) ); + } + if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end + if ( !(name[0] == dot::value // !(dot or dot-dot) + && (name.size() == 1 + || (name[1] == dot::value + && name.size() == 2))) ) + { + m_imp->m_directory_entry.replace_leaf( + Path::traits_type::to_internal( name ), fs, symlink_fs ); + return; + } + } + } + + // basic_directory_entry -----------------------------------------------// + + template + class basic_directory_entry + { + public: + typedef Path path_type; + typedef typename Path::string_type string_type; + + // compiler generated copy-ctor, copy assignment, and destructor apply + + basic_directory_entry() {} + explicit basic_directory_entry( const path_type & p, + file_status st = file_status(), file_status symlink_st=file_status() ) + : m_path(p), m_status(st), m_symlink_status(symlink_st) + {} + + void assign( const path_type & p, + file_status st, file_status symlink_st ) + { m_path = p; m_status = st; m_symlink_status = symlink_st; } + + void replace_leaf( const string_type & s, + file_status st, file_status symlink_st ) + { + m_path.remove_leaf(); + m_path /= s; + m_status = st; + m_symlink_status = symlink_st; + } + + const Path & path() const { return m_path; } + file_status status() const; + file_status status( system_error_type & ec ) const; + file_status symlink_status() const; + file_status symlink_status( system_error_type & ec ) const; + + // conversion simplifies the most common use of basic_directory_entry + operator const path_type &() const { return m_path; } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + // deprecated functions preserve common use cases in legacy code + typename Path::string_type leaf() const + { + return path().leaf(); + } + typename Path::string_type string() const + { + return path().string(); + } +# endif + + private: + path_type m_path; + mutable file_status m_status; // stat()-like + mutable file_status m_symlink_status; // lstat()-like + // note: m_symlink_status is not used by Windows implementation + + }; // basic_directory_status + + typedef basic_directory_entry directory_entry; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + typedef basic_directory_entry wdirectory_entry; +# endif + + // basic_directory_entry implementation --------------------------------// + + template + file_status + basic_directory_entry::status() const + { + if ( !status_known( m_status ) ) + { +# ifndef BOOST_WINDOWS_API + if ( status_known( m_symlink_status ) + && !is_symlink( m_symlink_status ) ) + { m_status = m_symlink_status; } + else { m_status = boost::filesystem::status( m_path ); } +# else + m_status = boost::filesystem::status( m_path ); +# endif + } + return m_status; + } + + template + file_status + basic_directory_entry::status( system_error_type & ec ) const + { + if ( !status_known( m_status ) ) + { +# ifndef BOOST_WINDOWS_API + if ( status_known( m_symlink_status ) + && !is_symlink( m_symlink_status ) ) + { ec = 0; m_status = m_symlink_status; } + else { m_status = boost::filesystem::status( m_path, ec ); } +# else + m_status = boost::filesystem::status( m_path, ec ); +# endif + } + else ec = 0; + return m_status; + } + + template + file_status + basic_directory_entry::symlink_status() const + { +# ifndef BOOST_WINDOWS_API + if ( !status_known( m_symlink_status ) ) + { m_symlink_status = boost::filesystem::symlink_status( m_path ); } + return m_symlink_status; +# else + return status(); +# endif + } + + template + file_status + basic_directory_entry::symlink_status( system_error_type & ec ) const + { +# ifndef BOOST_WINDOWS_API + if ( !status_known( m_symlink_status ) ) + { m_symlink_status = boost::filesystem::symlink_status( m_path, ec ); } + else ec = 0; + return m_symlink_status; +# else + return status( ec ); +# endif + } } // namespace filesystem } // namespace boost +#undef BOOST_FS_FUNC + -#include // pops abi_suffix.hpp pragmas -#endif // BOOST_FILESYSTEM_DIRECTORY_HPP +#include // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM_OPERATIONS_HPP diff --git a/boost/boost/filesystem/path.hpp b/boost/boost/filesystem/path.hpp index fc4d98db4c..c1d3aaef6e 100644 --- a/boost/boost/filesystem/path.hpp +++ b/boost/boost/filesystem/path.hpp @@ -1,6 +1,6 @@ // boost/filesystem/path.hpp -----------------------------------------------// -// © Copyright Beman Dawes 2002-2003 +// Copyright Beman Dawes 2002-2005 // 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) @@ -14,158 +14,1410 @@ #include #include +#include +#include +#include +#include + #include +#include // for lexicographical_compare +#include // needed by basic_path inserter and extractor +#include #include -#include // must be the last header +# ifndef BOOST_FILESYSTEM_NARROW_ONLY +# include +# endif + +#include // must be the last #include //----------------------------------------------------------------------------// namespace boost { - namespace filesystem + namespace BOOST_FILESYSTEM_NAMESPACE { - class directory_iterator; + template class basic_path; + + struct path_traits; + typedef basic_path< std::string, path_traits > path; + + struct path_traits + { + typedef std::string internal_string_type; + typedef std::string external_string_type; + static external_string_type to_external( const path &, + const internal_string_type & src ) { return src; } + static internal_string_type to_internal( + const external_string_type & src ) { return src; } + }; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY - // path -------------------------------------------------------------------// + struct wpath_traits; + + typedef basic_path< std::wstring, wpath_traits > wpath; - class BOOST_FILESYSTEM_DECL path + struct wpath_traits + { + typedef std::wstring internal_string_type; +# ifdef BOOST_WINDOWS_API + typedef std::wstring external_string_type; + static external_string_type to_external( const wpath &, + const internal_string_type & src ) { return src; } + static internal_string_type to_internal( + const external_string_type & src ) { return src; } +# else + typedef std::string external_string_type; + static external_string_type to_external( const wpath & ph, + const internal_string_type & src ); + static internal_string_type to_internal( + const external_string_type & src ); +# endif + static void imbue( const std::locale & loc ); + static bool imbue( const std::locale & loc, const std::nothrow_t & ); + }; + +# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY + +// error reporting support -------------------------------------------------// + + typedef int errno_type; // determined by C standard + +# ifdef BOOST_WINDOWS_API + typedef unsigned system_error_type; + + BOOST_FILESYSTEM_DECL + errno_type lookup_errno( system_error_type sys_err_code ); +# else + typedef int system_error_type; + + inline errno_type lookup_errno( system_error_type sys_err_code ) + { return sys_err_code; } +# endif + + // deprecated support for legacy function name + inline errno_type lookup_error_code( system_error_type sys_err_code ) + { return lookup_errno( sys_err_code ); } + + BOOST_FILESYSTEM_DECL + void system_message( system_error_type sys_err_code, std::string & target ); + // Effects: appends error message to target + +# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_NARROW_ONLY) + BOOST_FILESYSTEM_DECL void + system_message( system_error_type sys_err_code, std::wstring & target ); +# endif + + // filesystem_error ----------------------------------------------------// + + class filesystem_error : public std::runtime_error + // see http://www.boost.org/more/error_handling.html for design rationale { public: - typedef bool (*name_check)( const std::string & name ); + filesystem_error() + : std::runtime_error("filesystem error"), m_sys_err(0) {} + explicit filesystem_error( + const std::string & what_arg, system_error_type sys_ec = 0 ) + : std::runtime_error(what_arg), m_sys_err(sys_ec) {} - // compiler generates copy constructor, copy assignment, and destructor + system_error_type system_error() const { return m_sys_err; } + // Note: system_error() == 0 implies a library (rather than system) error - path(){} + private: + system_error_type m_sys_err; + }; - path( const std::string & src ); - path( const char * src ); + // basic_filesystem_error ----------------------------------------------// - path( const std::string & src, name_check checker ); - path( const char * src, name_check checker ); + template + class basic_filesystem_error : public filesystem_error + { + // see http://www.boost.org/more/error_handling.html for design rationale + public: + // compiler generates copy constructor and copy assignment - // append operations: - path & operator /=( const path & rhs ); - path operator /( const path & rhs ) const - { return path( *this ) /= rhs; } + typedef Path path_type; - // modification functions: - path & normalize(); + basic_filesystem_error( const std::string & what, + system_error_type sys_err_code ); - // conversion functions: - const std::string & string() const { return m_path; } - std::string native_file_string() const; - std::string native_directory_string() const; + basic_filesystem_error( const std::string & what, + const path_type & path1, system_error_type sys_err_code ); - // decomposition functions: - path root_path() const; - std::string root_name() const; - std::string root_directory() const; - path relative_path() const; - std::string leaf() const; - path branch_path() const; + basic_filesystem_error( const std::string & what, const path_type & path1, + const path_type & path2, system_error_type sys_err_code ); - // query functions: - bool empty() const { return m_path.empty(); } // name consistent with std containers + ~basic_filesystem_error() throw() {} - bool is_complete() const; + const path_type & path1() const + { + static const path_type empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; + } + const path_type & path2() const + { + static const path_type empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; + } + + private: + struct m_imp + { + path_type m_path1; // may be empty() + path_type m_path2; // may be empty() + }; + boost::shared_ptr m_imp_ptr; + }; + + typedef basic_filesystem_error filesystem_path_error; + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + typedef basic_filesystem_error filesystem_wpath_error; +# endif + + // path traits ---------------------------------------------------------// + + template struct is_basic_path + { BOOST_STATIC_CONSTANT( bool, value = false ); }; + template<> struct is_basic_path + { BOOST_STATIC_CONSTANT( bool, value = true ); }; +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + template<> struct is_basic_path + { BOOST_STATIC_CONSTANT( bool, value = true ); }; +# endif + // these only have to be specialized if Path::string_type::value_type + // is not convertible from char + template struct slash + { BOOST_STATIC_CONSTANT( char, value = '/' ); }; + + template struct dot + { BOOST_STATIC_CONSTANT( char, value = '.' ); }; + + template struct colon + { BOOST_STATIC_CONSTANT( char, value = ':' ); }; + +# ifdef BOOST_WINDOWS_PATH + template struct path_alt_separator + { BOOST_STATIC_CONSTANT( char, value = '\\' ); }; +# endif + + // workaround for VC++ 7.0 and earlier issues with nested classes + namespace detail + { + template + class iterator_helper + { + public: + typedef typename Path::iterator iterator; + static void do_increment( iterator & ph ); + static void do_decrement( iterator & ph ); + }; + } + + // basic_path ----------------------------------------------------------// + + template + class basic_path + { + // invariant: m_path valid according to the portable generic path grammar + + // validate template arguments +// TODO: get these working +// BOOST_STATIC_ASSERT( ::boost::is_same::value ); +// BOOST_STATIC_ASSERT( ::boost::is_same::value || ::boost::is_same::value ); + + public: + // compiler generates copy constructor and copy assignment + + typedef basic_path path_type; + typedef String string_type; + typedef typename String::value_type value_type; + typedef Traits traits_type; + typedef typename Traits::external_string_type external_string_type; + + // constructors/destructor + basic_path() {} + basic_path( const string_type & s ) { operator/=( s ); } + basic_path( const value_type * s ) { operator/=( s ); } +# ifndef BOOST_NO_MEMBER_TEMPLATES + template + basic_path( InputIterator first, InputIterator last ) + { append( first, last ); } +# endif + ~basic_path() {} + + // assignments + basic_path & operator=( const string_type & s ) + { +# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) + m_path.clear(); +# else + m_path.erase( m_path.begin(), m_path.end() ); +# endif + operator/=( s ); + return *this; + } + basic_path & operator=( const value_type * s ) + { +# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) + m_path.clear(); +# else + m_path.erase( m_path.begin(), m_path.end() ); +# endif + operator/=( s ); + return *this; + } +# ifndef BOOST_NO_MEMBER_TEMPLATES + template + basic_path & assign( InputIterator first, InputIterator last ) + { m_path.clear(); append( first, last ); return *this; } +# endif + + // modifiers + basic_path & operator/=( const basic_path & rhs ) { return operator /=( rhs.string().c_str() ); } + basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); } + basic_path & operator/=( const value_type * s ); +# ifndef BOOST_NO_MEMBER_TEMPLATES + template + basic_path & append( InputIterator first, InputIterator last ); +# endif + + void swap( basic_path & rhs ) + { + m_path.swap( rhs.m_path ); +# ifdef BOOST_CYGWIN_PATH + std::swap( m_cygwin_root, rhs.m_cygwin_root ); +# endif + } + + basic_path & remove_leaf(); + + // observers + const string_type & string() const { return m_path; } + const string_type file_string() const; + const string_type directory_string() const { return file_string(); } + + const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); } + const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); } + + basic_path root_path() const; + string_type root_name() const; + string_type root_directory() const; + basic_path relative_path() const; + string_type leaf() const; + basic_path branch_path() const; + + bool empty() const { return m_path.empty(); } // name consistent with std containers + bool is_complete() const; bool has_root_path() const; bool has_root_name() const; bool has_root_directory() const; - bool has_relative_path() const; - bool has_leaf() const { return !m_path.empty(); } - bool has_branch_path() const; + bool has_relative_path() const { return !relative_path().empty(); } + bool has_leaf() const { return !m_path.empty(); } + bool has_branch_path() const { return !branch_path().empty(); } - // iteration over the names in the path: + // iterators class iterator : public boost::iterator_facade< iterator, - std::string const, + string_type const, boost::bidirectional_traversal_tag > { private: friend class boost::iterator_core_access; - friend class boost::filesystem::path; + friend class boost::BOOST_FILESYSTEM_NAMESPACE::basic_path; - reference dereference() const { return m_name; } + const string_type & dereference() const + { return m_name; } bool equal( const iterator & rhs ) const { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; } - BOOST_FILESYSTEM_DECL void increment(); - BOOST_FILESYSTEM_DECL void decrement(); - std::string m_name; // cache current element. - const path * m_path_ptr; // path being iterated over. - std::string::size_type m_pos; // position of name in + friend class boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper; + + void increment() + { + boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper::do_increment( + *this ); + } + void decrement() + { + boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper::do_decrement( + *this ); + } + + string_type m_name; // current element + const basic_path * m_path_ptr; // path being iterated over + typename string_type::size_type m_pos; // position of name in // path_ptr->string(). The // end() iterator is indicated by - // pos == path_ptr->string().size() - }; + // pos == path_ptr->m_path.size() + }; // iterator - iterator begin() const; - iterator end() const - { - iterator itr; - itr.m_path_ptr = this; - itr.m_pos = m_path.size(); - return itr; - } - - // default name_check mechanism: - static bool default_name_check_writable(); - static void default_name_check( name_check new_check ); - static name_check default_name_check(); + typedef iterator const_iterator; - // relational operators - bool operator<( const path & that ) const; - bool operator==( const path & that ) const { return !(*this < that) && !(that < *this); } - bool operator!=( const path & that ) const { return !(*this == that); } - bool operator>( const path & that ) const { return that < *this; } - bool operator<=( const path & that ) const { return !(that < *this); } - bool operator>=( const path & that ) const { return !(*this < that); } + iterator begin() const; + iterator end() const; private: // Note: This is an implementation for POSIX and Windows, where there - // are only minor differences between generic and system-specific - // constructor input formats. Private members might be quite different - // in other implementations, particularly where there were wide - // differences between generic and system-specific argument formats, - // or between native_file_string() and native_directory_string() formats. + // are only minor differences between generic and native path grammars. + // Private members might be quite different in other implementations, + // particularly where there were wide differences between portable and + // native path formats, or between file_string() and + // directory_string() formats, or simply that the implementation + // was willing expend additional memory to achieve greater speed for + // some operations at the expense of other operations. + + string_type m_path; // invariant: portable path grammar + // on Windows, backslashes converted to slashes + +# ifdef BOOST_CYGWIN_PATH + bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization + // done by append +# endif - std::string m_path; + void m_append_separator_if_needed(); + void m_append( value_type value ); // converts Windows alt_separator - friend class directory_iterator; // Was qualified; como433beta8 reports: // warning #427-D: qualified name is not allowed in member declaration - friend class iterator; + friend class iterator; + friend class boost::BOOST_FILESYSTEM_NAMESPACE::detail::iterator_helper; - public: // should be private, but friend functions don't work for me - void m_path_append( const std::string & src, name_check checker ); - void m_replace_leaf( const char * new_leaf ); + // Deprecated features ease transition for existing code. Don't use these + // in new code. +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + public: + typedef bool (*name_check)( const std::string & name ); + basic_path( const string_type & str, name_check ) { operator/=( str ); } + basic_path( const typename string_type::value_type * s, name_check ) + { operator/=( s );} + string_type native_file_string() const { return file_string(); } + string_type native_directory_string() const { return directory_string(); } + static bool default_name_check_writable() { return false; } + static void default_name_check( name_check ) {} + static name_check default_name_check() { return 0; } + basic_path & canonize(); + basic_path & normalize(); +# endif }; - // path non-member functions ---------------------------------------------// + // basic_path non-member functions ---------------------------------------// + + template< class String, class Traits > + inline void swap( basic_path & lhs, + basic_path & rhs ) { lhs.swap( rhs ); } + + template< class String, class Traits > + bool operator<( const basic_path & lhs, const basic_path & rhs ) + { + return std::lexicographical_compare( + lhs.begin(), lhs.end(), rhs.begin(), rhs.end() ); + } + + template< class String, class Traits > + bool operator<( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) + { + basic_path tmp( lhs ); + return std::lexicographical_compare( + tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); + } + + template< class String, class Traits > + bool operator<( const typename basic_path::string_type & lhs, + const basic_path & rhs ) + { + basic_path tmp( lhs ); + return std::lexicographical_compare( + tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); + } + + template< class String, class Traits > + bool operator<( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { + basic_path tmp( rhs ); + return std::lexicographical_compare( + lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); + } + + template< class String, class Traits > + bool operator<( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { + basic_path tmp( rhs ); + return std::lexicographical_compare( + lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); + } + + template< class String, class Traits > + inline bool operator==( const basic_path & lhs, const basic_path & rhs ) + { + return !(lhs < rhs) && !(rhs < lhs); + } + + template< class String, class Traits > + inline bool operator==( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) + { + basic_path tmp( lhs ); + return !(tmp < rhs) && !(rhs < tmp); + } + + template< class String, class Traits > + inline bool operator==( const typename basic_path::string_type & lhs, + const basic_path & rhs ) + { + basic_path tmp( lhs ); + return !(tmp < rhs) && !(rhs < tmp); + } + + template< class String, class Traits > + inline bool operator==( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { + basic_path tmp( rhs ); + return !(lhs < tmp) && !(tmp < lhs); + } + + template< class String, class Traits > + inline bool operator==( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { + basic_path tmp( rhs ); + return !(lhs < tmp) && !(tmp < lhs); + } + + template< class String, class Traits > + inline bool operator!=( const basic_path & lhs, const basic_path & rhs ) { return !(lhs == rhs); } + + template< class String, class Traits > + inline bool operator!=( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) { return !(basic_path(lhs) == rhs); } + + template< class String, class Traits > + inline bool operator!=( const typename basic_path::string_type & lhs, + const basic_path & rhs ) { return !(basic_path(lhs) == rhs); } + + template< class String, class Traits > + inline bool operator!=( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { return !(lhs == basic_path(rhs)); } + + template< class String, class Traits > + inline bool operator!=( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { return !(lhs == basic_path(rhs)); } + + template< class String, class Traits > + inline bool operator>( const basic_path & lhs, const basic_path & rhs ) { return rhs < lhs; } + + template< class String, class Traits > + inline bool operator>( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) { return rhs < basic_path(lhs); } + + template< class String, class Traits > + inline bool operator>( const typename basic_path::string_type & lhs, + const basic_path & rhs ) { return rhs < basic_path(lhs); } + + template< class String, class Traits > + inline bool operator>( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { return basic_path(rhs) < lhs; } + + template< class String, class Traits > + inline bool operator>( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { return basic_path(rhs) < lhs; } + + template< class String, class Traits > + inline bool operator<=( const basic_path & lhs, const basic_path & rhs ) { return !(rhs < lhs); } + + template< class String, class Traits > + inline bool operator<=( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) { return !(rhs < basic_path(lhs)); } - inline path operator / ( const char * lhs, const path & rhs ) - { return path( lhs ) /= rhs; } + template< class String, class Traits > + inline bool operator<=( const typename basic_path::string_type & lhs, + const basic_path & rhs ) { return !(rhs < basic_path(lhs)); } - inline path operator / ( const std::string & lhs, const path & rhs ) - { return path( lhs ) /= rhs; } + template< class String, class Traits > + inline bool operator<=( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { return !(basic_path(rhs) < lhs); } + + template< class String, class Traits > + inline bool operator<=( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { return !(basic_path(rhs) < lhs); } + + template< class String, class Traits > + inline bool operator>=( const basic_path & lhs, const basic_path & rhs ) { return !(lhs < rhs); } + + template< class String, class Traits > + inline bool operator>=( const typename basic_path::string_type::value_type * lhs, + const basic_path & rhs ) { return !(lhs < basic_path(rhs)); } + + template< class String, class Traits > + inline bool operator>=( const typename basic_path::string_type & lhs, + const basic_path & rhs ) { return !(lhs < basic_path(rhs)); } + + template< class String, class Traits > + inline bool operator>=( const basic_path & lhs, + const typename basic_path::string_type::value_type * rhs ) + { return !(basic_path(lhs) < rhs); } + + template< class String, class Traits > + inline bool operator>=( const basic_path & lhs, + const typename basic_path::string_type & rhs ) + { return !(basic_path(lhs) < rhs); } + + // operator / + + template< class String, class Traits > + inline basic_path operator/( + const basic_path & lhs, + const basic_path & rhs ) + { return basic_path( lhs ) /= rhs; } + + template< class String, class Traits > + inline basic_path operator/( + const basic_path & lhs, + const typename String::value_type * rhs ) + { return basic_path( lhs ) /= + basic_path( rhs ); } + + template< class String, class Traits > + inline basic_path operator/( + const basic_path & lhs, const String & rhs ) + { return basic_path( lhs ) /= + basic_path( rhs ); } + + template< class String, class Traits > + inline basic_path operator/( + const typename String::value_type * lhs, + const basic_path & rhs ) + { return basic_path( lhs ) /= rhs; } + + template< class String, class Traits > + inline basic_path operator/( + const String & lhs, const basic_path & rhs ) + { return basic_path( lhs ) /= rhs; } - // path::name_checks ---------------------------------------------------// + // inserters and extractors --------------------------------------------// + +// bypass VC++ 7.0 and earlier, and broken Borland compilers +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + template< class Path > + std::basic_ostream< typename Path::string_type::value_type, + typename Path::string_type::traits_type > & + operator<< + ( std::basic_ostream< typename Path::string_type::value_type, + typename Path::string_type::traits_type >& os, const Path & ph ) + { + os << ph.string(); + return os; + } + + template< class Path > + std::basic_istream< typename Path::string_type::value_type, + typename Path::string_type::traits_type > & + operator>> + ( std::basic_istream< typename Path::string_type::value_type, + typename Path::string_type::traits_type >& is, Path & ph ) + { + typename Path::string_type str; + is >> str; + ph = str; + return is; + } +# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + template< class String, class Traits > + std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, + BOOST_DEDUCED_TYPENAME String::traits_type > & + operator<< + ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, + BOOST_DEDUCED_TYPENAME String::traits_type >& os, + const basic_path< String, Traits > & ph ) + { + os << ph.string(); + return os; + } + + template< class String, class Traits > + std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, + BOOST_DEDUCED_TYPENAME String::traits_type > & + operator>> + ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, + BOOST_DEDUCED_TYPENAME String::traits_type> & is, + basic_path< String, Traits > & ph ) + { + String str; + is >> str; + ph = str; + return is; + } +# endif + + // path::name_checks -----------------------------------------------------// BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ); BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ); BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ); BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ); BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool no_check( const std::string & name ); // always returns true BOOST_FILESYSTEM_DECL bool native( const std::string & name ); - // native(name) must return true for any name which MIGHT be valid - // on the native platform. + inline bool no_check( const std::string & ) + { return true; } + +// implementation -----------------------------------------------------------// + + namespace detail + { + + // is_separator helper ------------------------------------------------// + + template + inline bool is_separator( typename Path::string_type::value_type c ) + { + return c == slash::value +# ifdef BOOST_WINDOWS_PATH + || c == path_alt_separator::value +# endif + ; + } + + // leaf_pos helper ----------------------------------------------------// + + template + typename String::size_type leaf_pos( + const String & str, // precondition: portable generic path grammar + typename String::size_type end_pos ) // end_pos is past-the-end position + // return 0 if str itself is leaf (or empty) + { + typedef typename + boost::BOOST_FILESYSTEM_NAMESPACE::basic_path path_type; + + // case: "//" + if ( end_pos == 2 + && str[0] == slash::value + && str[1] == slash::value ) return 0; + + // case: ends in "/" + if ( end_pos && str[end_pos-1] == slash::value ) + return end_pos-1; + + // set pos to start of last element + typename String::size_type pos( + str.find_last_of( slash::value, end_pos-1 ) ); +# ifdef BOOST_WINDOWS_PATH + if ( pos == String::npos ) + pos = str.find_last_of( path_alt_separator::value, end_pos-1 ); + if ( pos == String::npos ) + pos = str.find_last_of( colon::value, end_pos-2 ); +# endif + + return ( pos == String::npos // path itself must be a leaf (or empty) + || (pos == 1 && str[0] == slash::value) ) // or net + ? 0 // so leaf is entire string + : pos + 1; // or starts after delimiter + } + + // first_element helper -----------------------------------------------// + // sets pos and len of first element, excluding extra separators + // if src.empty(), sets pos,len, to 0,0. + + template + void first_element( + const String & src, // precondition: portable generic path grammar + typename String::size_type & element_pos, + typename String::size_type & element_size, +# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1 + typename String::size_type size = String::npos +# else + typename String::size_type size = -1 +# endif + ) + { + if ( size == String::npos ) size = src.size(); + element_pos = 0; + element_size = 0; + if ( src.empty() ) return; - } // namespace filesystem + typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path path_type; + + typename String::size_type cur(0); + + // deal with // [network] + if ( size >= 2 && src[0] == slash::value + && src[1] == slash::value + && (size == 2 + || src[2] != slash::value) ) + { + cur += 2; + element_size += 2; + } + + // leading (not non-network) separator + else if ( src[0] == slash::value ) + { + ++element_size; + // bypass extra leading separators + while ( cur+1 < size + && src[cur+1] == slash::value ) + { + ++cur; + ++element_pos; + } + return; + } + + // at this point, we have either a plain name, a network name, + // or (on Windows only) a device name + + // find the end + while ( cur < size +# ifdef BOOST_WINDOWS_PATH + && src[cur] != colon::value +# endif + && src[cur] != slash::value ) + { + ++cur; + ++element_size; + } + +# ifdef BOOST_WINDOWS_PATH + if ( cur == size ) return; + // include device delimiter + if ( src[cur] == colon::value ) + { ++element_size; } +# endif + + return; + } + + // root_directory_start helper ----------------------------------------// + + template + typename String::size_type root_directory_start( + const String & s, // precondition: portable generic path grammar + typename String::size_type size ) + // return npos if no root_directory found + { + typedef typename boost::BOOST_FILESYSTEM_NAMESPACE::basic_path path_type; + +# ifdef BOOST_WINDOWS_PATH + // case "c:/" + if ( size > 2 + && s[1] == colon::value + && s[2] == slash::value ) return 2; +# endif + + // case "//" + if ( size == 2 + && s[0] == slash::value + && s[1] == slash::value ) return String::npos; + + // case "//net {/}" + if ( size > 3 + && s[0] == slash::value + && s[1] == slash::value + && s[2] != slash::value ) + { + typename String::size_type pos( + s.find( slash::value, 2 ) ); + return pos < size ? pos : String::npos; + } + + // case "/" + if ( size > 0 && s[0] == slash::value ) return 0; + + return String::npos; + } + + // is_non_root_slash helper -------------------------------------------// + + template + bool is_non_root_slash( const String & str, + typename String::size_type pos ) // pos is position of the slash + { + typedef typename + boost::BOOST_FILESYSTEM_NAMESPACE::basic_path + path_type; + + assert( !str.empty() && str[pos] == slash::value + && "precondition violation" ); + + // subsequent logic expects pos to be for leftmost slash of a set + while ( pos > 0 && str[pos-1] == slash::value ) + --pos; + + return pos != 0 + && (pos <= 2 || str[1] != slash::value + || str.find( slash::value, 2 ) != pos) +# ifdef BOOST_WINDOWS_PATH + && (pos !=2 || str[1] != colon::value) +# endif + ; + } + } // namespace detail + + // decomposition functions ----------------------------------------------// + + template + String basic_path::leaf() const + { + typename String::size_type end_pos( + detail::leaf_pos( m_path, m_path.size() ) ); + return (m_path.size() + && end_pos + && m_path[end_pos] == slash::value + && detail::is_non_root_slash< String, Traits >(m_path, end_pos)) + ? String( 1, dot::value ) + : m_path.substr( end_pos ); + } + + template + basic_path basic_path::branch_path() const + { + typename String::size_type end_pos( + detail::leaf_pos( m_path, m_path.size() ) ); + + bool leaf_was_separator( m_path.size() + && m_path[end_pos] == slash::value ); + + // skip separators unless root directory + typename string_type::size_type root_dir_pos( detail::root_directory_start + ( m_path, end_pos ) ); + for ( ; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && m_path[end_pos-1] == slash::value + ; + --end_pos ) {} + + return (end_pos == 1 && root_dir_pos == 0 && leaf_was_separator) + ? path_type() + : path_type( m_path.substr( 0, end_pos ) ); + } + + template + basic_path basic_path::relative_path() const + { + iterator itr( begin() ); + for ( ; itr.m_pos != m_path.size() + && (itr.m_name[0] == slash::value +# ifdef BOOST_WINDOWS_PATH + || itr.m_name[itr.m_name.size()-1] + == colon::value +# endif + ); ++itr ) {} + + return basic_path( m_path.substr( itr.m_pos ) ); + } + + template + String basic_path::root_name() const + { + iterator itr( begin() ); + + return ( itr.m_pos != m_path.size() + && ( + ( itr.m_name.size() > 1 + && itr.m_name[0] == slash::value + && itr.m_name[1] == slash::value + ) +# ifdef BOOST_WINDOWS_PATH + || itr.m_name[itr.m_name.size()-1] + == colon::value +# endif + ) ) + ? *itr + : String(); + } + + template + String basic_path::root_directory() const + { + typename string_type::size_type start( + detail::root_directory_start( m_path, m_path.size() ) ); + + return start == string_type::npos + ? string_type() + : m_path.substr( start, 1 ); + } + + template + basic_path basic_path::root_path() const + { + // even on POSIX, root_name() is non-empty() on network paths + return basic_path( root_name() ) /= root_directory(); + } + + // path query functions -------------------------------------------------// + + template + inline bool basic_path::is_complete() const + { +# ifdef BOOST_WINDOWS_PATH + return has_root_name() && has_root_directory(); +# else + return has_root_directory(); +# endif + } + + template + inline bool basic_path::has_root_path() const + { + return !root_path().empty(); + } + + template + inline bool basic_path::has_root_name() const + { + return !root_name().empty(); + } + + template + inline bool basic_path::has_root_directory() const + { + return !root_directory().empty(); + } + + // append ---------------------------------------------------------------// + + template + void basic_path::m_append_separator_if_needed() + // requires: !empty() + { + if ( +# ifdef BOOST_WINDOWS_PATH + *(m_path.end()-1) != colon::value && +# endif + *(m_path.end()-1) != slash::value ) + { + m_path += slash::value; + } + } + + template + void basic_path::m_append( value_type value ) + { +# ifdef BOOST_CYGWIN_PATH + if ( m_path.empty() ) m_cygwin_root = (value == slash::value); +# endif + +# ifdef BOOST_WINDOWS_PATH + // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/') + m_path += ( value == path_alt_separator::value + ? slash::value + : value ); +# else + m_path += value; +# endif + } + + // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers, + // the append() member template could replace this code. + template + basic_path & basic_path::operator /= + ( const value_type * next_p ) + { + // ignore escape sequence on POSIX or Windows + if ( *next_p == slash::value + && *(next_p+1) == slash::value + && *(next_p+2) == colon::value ) next_p += 3; + + // append slash::value if needed + if ( !empty() && *next_p != 0 + && !detail::is_separator( *next_p ) ) + { m_append_separator_if_needed(); } + + for ( ; *next_p != 0; ++next_p ) m_append( *next_p ); + return *this; + } + +# ifndef BOOST_NO_MEMBER_TEMPLATES + template template + basic_path & basic_path::append( + InputIterator first, InputIterator last ) + { + // append slash::value if needed + if ( !empty() && first != last + && !detail::is_separator( *first ) ) + { m_append_separator_if_needed(); } + + // song-and-dance to avoid violating InputIterator requirements + // (which prohibit lookahead) in detecting a possible escape sequence + // (escape sequences are simply ignored on POSIX and Windows) + bool was_escape_sequence(true); + std::size_t append_count(0); + typename String::size_type initial_pos( m_path.size() ); + + for ( ; first != last && *first; ++first ) + { + if ( append_count == 0 && *first != slash::value ) + was_escape_sequence = false; + if ( append_count == 1 && *first != slash::value ) + was_escape_sequence = false; + if ( append_count == 2 && *first != colon::value ) + was_escape_sequence = false; + m_append( *first ); + ++append_count; + } + + // erase escape sequence if any + if ( was_escape_sequence && append_count >= 3 ) + m_path.erase( initial_pos, 3 ); + + return *this; + } +# endif + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + + // canonize ------------------------------------------------------------// + + template + basic_path & basic_path::canonize() + { + static const typename string_type::value_type dot_str[] + = { dot::value, 0 }; + + if ( m_path.empty() ) return *this; + + path_type temp; + + for ( iterator itr( begin() ); itr != end(); ++itr ) + { + temp /= *itr; + }; + + if ( temp.empty() ) temp /= dot_str; + m_path = temp.m_path; + return *this; + } + + // normalize ------------------------------------------------------------// + + template + basic_path & basic_path::normalize() + { + static const typename string_type::value_type dot_str[] + = { dot::value, 0 }; + + if ( m_path.empty() ) return *this; + + path_type temp; + iterator start( begin() ); + iterator last( end() ); + iterator stop( last-- ); + for ( iterator itr( start ); itr != stop; ++itr ) + { + // ignore "." except at start and last + if ( itr->size() == 1 + && (*itr)[0] == dot::value + && itr != start + && itr != last ) continue; + + // ignore a name and following ".." + if ( !temp.empty() + && itr->size() == 2 + && (*itr)[0] == dot::value + && (*itr)[1] == dot::value ) // dot dot + { + string_type lf( temp.leaf() ); + if ( lf.size() > 0 + && (lf.size() != 1 + || (lf[0] != dot::value + && lf[0] != slash::value)) + && (lf.size() != 2 + || (lf[0] != dot::value + && lf[1] != dot::value +# ifdef BOOST_WINDOWS_PATH + && lf[1] != colon::value +# endif + ) + ) + ) + { + temp.remove_leaf(); + // if not root directory, must also remove "/" if any + if ( temp.m_path.size() > 0 + && temp.m_path[temp.m_path.size()-1] + == slash::value ) + { + typename string_type::size_type rds( + detail::root_directory_start( temp.m_path, + temp.m_path.size() ) ); + if ( rds == string_type::npos + || rds != temp.m_path.size()-1 ) + { temp.m_path.erase( temp.m_path.size()-1 ); } + } + + iterator next( itr ); + if ( temp.empty() && ++next != stop + && next == last && *last == dot_str ) temp /= dot_str; + continue; + } + } + + temp /= *itr; + }; + + if ( temp.empty() ) temp /= dot_str; + m_path = temp.m_path; + return *this; + } + +# endif + + // remove_leaf ----------------------------------------------------------// + + template + basic_path & basic_path::remove_leaf() + { + m_path.erase( + detail::leaf_pos( m_path, m_path.size() ) ); + return *this; + } + + // path conversion functions --------------------------------------------// + + template + const String + basic_path::file_string() const + { +# ifdef BOOST_WINDOWS_PATH + // for Windows, use the alternate separator, and bypass extra + // root separators + + typename string_type::size_type root_dir_start( + detail::root_directory_start( m_path, m_path.size() ) ); + bool in_root( root_dir_start != string_type::npos ); + String s; + for ( typename string_type::size_type pos( 0 ); + pos != m_path.size(); ++pos ) + { + // special case // [net] + if ( pos == 0 && m_path.size() > 1 + && m_path[0] == slash::value + && m_path[1] == slash::value + && ( m_path.size() == 2 + || !detail::is_separator( m_path[2] ) + ) ) + { + ++pos; + s += path_alt_separator::value; + s += path_alt_separator::value; + continue; + } + + // bypass extra root separators + if ( in_root ) + { + if ( s.size() > 0 + && s[s.size()-1] == path_alt_separator::value + && m_path[pos] == slash::value + ) continue; + } + + if ( m_path[pos] == slash::value ) + s += path_alt_separator::value; + else + s += m_path[pos]; + + if ( pos > root_dir_start + && m_path[pos] == slash::value ) + { in_root = false; } + } +# ifdef BOOST_CYGWIN_PATH + if ( m_cygwin_root ) s[0] = slash::value; +# endif + return s; +# else + return m_path; +# endif + } + + // iterator functions ---------------------------------------------------// + + template + typename basic_path::iterator basic_path::begin() const + { + iterator itr; + itr.m_path_ptr = this; + typename string_type::size_type element_size; + detail::first_element( m_path, itr.m_pos, element_size ); + itr.m_name = m_path.substr( itr.m_pos, element_size ); + return itr; + } + + template + typename basic_path::iterator basic_path::end() const + { + iterator itr; + itr.m_path_ptr = this; + itr.m_pos = m_path.size(); + return itr; + } + + namespace detail + { + // do_increment ------------------------------------------------------// + + template + void iterator_helper::do_increment( iterator & itr ) + { + typedef typename Path::string_type string_type; + typedef typename Path::traits_type traits_type; + + assert( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" ); + + bool was_net( itr.m_name.size() > 2 + && itr.m_name[0] == slash::value + && itr.m_name[1] == slash::value + && itr.m_name[2] != slash::value ); + + // increment to position past current element + itr.m_pos += itr.m_name.size(); + + // if end reached, create end iterator + if ( itr.m_pos == itr.m_path_ptr->m_path.size() ) + { + itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() + return; + } + + // process separator (Windows drive spec is only case not a separator) + if ( itr.m_path_ptr->m_path[itr.m_pos] == slash::value ) + { + // detect root directory + if ( was_net + # ifdef BOOST_WINDOWS_PATH + // case "c:/" + || itr.m_name[itr.m_name.size()-1] == colon::value + # endif + ) + { + itr.m_name = slash::value; + return; + } + + // bypass separators + while ( itr.m_pos != itr.m_path_ptr->m_path.size() + && itr.m_path_ptr->m_path[itr.m_pos] == slash::value ) + { ++itr.m_pos; } + + // detect trailing separator, and treat it as ".", per POSIX spec + if ( itr.m_pos == itr.m_path_ptr->m_path.size() + && detail::is_non_root_slash< string_type, traits_type >( + itr.m_path_ptr->m_path, itr.m_pos-1 ) ) + { + --itr.m_pos; + itr.m_name = dot::value; + return; + } + } + + // get next element + typename string_type::size_type end_pos( + itr.m_path_ptr->m_path.find( slash::value, itr.m_pos ) ); + itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); + } + + // do_decrement ------------------------------------------------------// + + template + void iterator_helper::do_decrement( iterator & itr ) + { + assert( itr.m_pos && "basic_path::iterator decrement past begin()" ); + + typedef typename Path::string_type string_type; + typedef typename Path::traits_type traits_type; + + typename string_type::size_type end_pos( itr.m_pos ); + + typename string_type::size_type root_dir_pos( + detail::root_directory_start( + itr.m_path_ptr->m_path, end_pos ) ); + + // if at end and there was a trailing non-root '/', return "." + if ( itr.m_pos == itr.m_path_ptr->m_path.size() + && itr.m_path_ptr->m_path.size() > 1 + && itr.m_path_ptr->m_path[itr.m_pos-1] == slash::value + && detail::is_non_root_slash< string_type, traits_type >( + itr.m_path_ptr->m_path, itr.m_pos-1 ) + ) + { + --itr.m_pos; + itr.m_name = dot::value; + return; + } + + // skip separators unless root directory + for ( + ; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && itr.m_path_ptr->m_path[end_pos-1] == slash::value + ; + --end_pos ) {} + + itr.m_pos = detail::leaf_pos + ( itr.m_path_ptr->m_path, end_pos ); + itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); + } + } // namespace detail + + // basic_filesystem_error implementation --------------------------------// + + template + basic_filesystem_error::basic_filesystem_error( + const std::string & what, system_error_type sys_err_code ) + : filesystem_error(what, sys_err_code) + { + try + { + m_imp_ptr.reset( new m_imp ); + } + catch (...) { m_imp_ptr.reset(); } + } + + template + basic_filesystem_error::basic_filesystem_error( + const std::string & what, const path_type & path1, + system_error_type sys_err_code ) + : filesystem_error(what, sys_err_code) + { + try + { + m_imp_ptr.reset( new m_imp ); + m_imp_ptr->m_path1 = path1; + } + catch (...) { m_imp_ptr.reset(); } + } + + template + basic_filesystem_error::basic_filesystem_error( + const std::string & what, const path_type & path1, + const path_type & path2, system_error_type sys_err_code ) + : filesystem_error(what, sys_err_code) + { + try + { + m_imp_ptr.reset( new m_imp ); + m_imp_ptr->m_path1 = path1; + m_imp_ptr->m_path2 = path2; + } + catch (...) { m_imp_ptr.reset(); } + } + + } // namespace BOOST_FILESYSTEM_NAMESPACE } // namespace boost -#include // pops abi_suffix.hpp pragmas +#include // pops abi_prefix.hpp pragmas + #endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/boost/boost/format/feed_args.hpp b/boost/boost/format/feed_args.hpp index 0a1a0fe96f..6e3d6747b9 100644 --- a/boost/boost/format/feed_args.hpp +++ b/boost/boost/format/feed_args.hpp @@ -45,7 +45,8 @@ namespace detail { res.reserve(size + !!prefix_space); if(prefix_space) res.append(1, prefix_space); - res.append(beg, size); + if (size) + res.append(beg, size); } else { std::streamsize n=static_cast(w-size-!!prefix_space); @@ -62,7 +63,8 @@ namespace detail { if(n_before) res.append(n_before, fill_char); if(prefix_space) res.append(1, prefix_space); - res.append(beg, size); + if (size) + res.append(beg, size); if(n_after) res.append(n_after, fill_char); } } // -mk_str(..) diff --git a/boost/boost/format/format_implementation.hpp b/boost/boost/format/format_implementation.hpp index cab24e3cc7..3dd68e78d2 100644 --- a/boost/boost/format/format_implementation.hpp +++ b/boost/boost/format/format_implementation.hpp @@ -135,7 +135,7 @@ namespace boost { for(unsigned long i=0; i #include #include -#include #include -#include +#include #include +#include #ifndef BOOST_NO_SFINAE # include "boost/utility/enable_if.hpp" #else @@ -105,41 +105,35 @@ inline void swap(function& f1, namespace boost { namespace detail { namespace function { + class X; + /** - * A union of a function pointer and a void pointer. This is necessary - * because 5.2.10/6 allows reinterpret_cast<> to safely cast between - * function pointer types and 5.2.9/10 allows static_cast<> to safely - * cast between a void pointer and an object pointer. But it is not legal - * to cast between a function pointer and a void* (in either direction), - * so function requires a union of the two. */ - union any_pointer + * A buffer used to store small function objects in + * boost::function. It is a union containing function pointers, + * object pointers, and a structure that resembles a bound + * member function pointer. + */ + union function_buffer { + // For pointers to function objects void* obj_ptr; + + // For pointers to std::type_info objects + // (get_functor_type_tag, check_functor_type_tag). const void* const_obj_ptr; - void (*func_ptr)(); - char data[1]; - }; - inline any_pointer make_any_pointer(void* o) - { - any_pointer p; - p.obj_ptr = o; - return p; - } + // For function pointers of all kinds + mutable void (*func_ptr)(); - inline any_pointer make_any_pointer(const void* o) - { - any_pointer p; - p.const_obj_ptr = o; - return p; - } + // For bound member pointers + struct bound_memfunc_ptr_t { + void (X::*memfunc_ptr)(int); + void* obj_ptr; + } bound_memfunc_ptr; - inline any_pointer make_any_pointer(void (*f)()) - { - any_pointer p; - p.func_ptr = f; - return p; - } + // To relax aliasing constraints + mutable char data; + }; /** * The unusable class is a placeholder for unused function arguments @@ -169,7 +163,8 @@ namespace boost { enum functor_manager_operation_type { clone_functor_tag, destroy_functor_tag, - check_functor_type_tag + check_functor_type_tag, + get_functor_type_tag }; // Tags used to decide between different types of functions @@ -177,57 +172,79 @@ namespace boost { struct function_obj_tag {}; struct member_ptr_tag {}; struct function_obj_ref_tag {}; - struct stateless_function_obj_tag {}; template class get_function_tag { - typedef typename ct_if<(is_pointer::value), - function_ptr_tag, - function_obj_tag>::type ptr_or_obj_tag; + typedef typename mpl::if_c<(is_pointer::value), + function_ptr_tag, + function_obj_tag>::type ptr_or_obj_tag; - typedef typename ct_if<(is_member_pointer::value), - member_ptr_tag, - ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; + typedef typename mpl::if_c<(is_member_pointer::value), + member_ptr_tag, + ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - typedef typename ct_if<(is_reference_wrapper::value), - function_obj_ref_tag, - ptr_or_obj_or_mem_tag>::type or_ref_tag; + typedef typename mpl::if_c<(is_reference_wrapper::value), + function_obj_ref_tag, + ptr_or_obj_or_mem_tag>::type or_ref_tag; public: - typedef typename ct_if<(is_stateless::value), - stateless_function_obj_tag, - or_ref_tag>::type type; + typedef or_ref_tag type; }; // The trivial manager does nothing but return the same pointer (if we // are cloning) or return the null pointer (if we are deleting). template - struct trivial_manager + struct reference_manager { - static inline any_pointer - get(any_pointer f, functor_manager_operation_type op) + static inline void + get(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) { switch (op) { - case clone_functor_tag: return f; + case clone_functor_tag: + out_buffer.obj_ptr = in_buffer.obj_ptr; + return; case destroy_functor_tag: - return make_any_pointer(reinterpret_cast(0)); + out_buffer.obj_ptr = 0; + return; case check_functor_type_tag: { - std::type_info* t = static_cast(f.obj_ptr); - return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t)? - f - : make_any_pointer(reinterpret_cast(0)); + // DPG TBD: Since we're only storing a pointer, it's + // possible that the user could ask for a base class or + // derived class. Is that okay? + const std::type_info& check_type = + *static_cast(out_buffer.const_obj_ptr); + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F))) + out_buffer.obj_ptr = in_buffer.obj_ptr; + else + out_buffer.obj_ptr = 0; } - } + return; - // Clears up a warning with GCC 3.2.3 - return make_any_pointer(reinterpret_cast(0)); + case get_functor_type_tag: + out_buffer.const_obj_ptr = &typeid(F); + return; + } } }; + /** + * Determine if boost::function can use the small-object + * optimization with the function object type F. + */ + template + struct function_allows_small_object_optimization + { + BOOST_STATIC_CONSTANT + (bool, + value = ((sizeof(F) <= sizeof(function_buffer) && + (alignment_of::value + % alignment_of::value == 0)))); + }; + /** * The functor_manager class contains a static function "manage" which * can clone or destroy the given function/function object pointer. @@ -239,30 +256,59 @@ namespace boost { typedef Functor functor_type; // For function pointers, the manager is trivial - static inline any_pointer - manager(any_pointer function_ptr, - functor_manager_operation_type op, - function_ptr_tag) + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_ptr_tag) { if (op == clone_functor_tag) - return function_ptr; - else - return make_any_pointer(static_cast(0)); + out_buffer.func_ptr = in_buffer.func_ptr; + else if (op == destroy_functor_tag) + out_buffer.func_ptr = 0; + else /* op == check_functor_type_tag */ { + const std::type_info& check_type = + *static_cast(out_buffer.const_obj_ptr); + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = &in_buffer.func_ptr; + else + out_buffer.obj_ptr = 0; + } } - // For function object pointers, we clone the pointer to each - // function has its own version. - static inline any_pointer - manager(any_pointer function_obj_ptr, - functor_manager_operation_type op, - function_obj_tag) + // Function objects that fit in the small-object buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::true_) + { + if (op == clone_functor_tag) { + const functor_type* in_functor = + reinterpret_cast(&in_buffer.data); + new ((void*)&out_buffer.data) functor_type(*in_functor); + } else if (op == destroy_functor_tag) { + functor_type* out_functor = + reinterpret_cast(&out_buffer.data); + // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. + out_functor->~Functor(); + } else /* op == check_functor_type_tag */ { + const std::type_info& check_type = + *static_cast(out_buffer.const_obj_ptr); + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = &in_buffer.data; + else + out_buffer.obj_ptr = 0; + } + } + + // Function objects that require heap allocation + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::false_) { #ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other - allocator_type; - typedef typename allocator_type::pointer pointer_type; + typedef typename Allocator::template rebind::other + allocator_type; + typedef typename allocator_type::pointer pointer_type; #else - typedef functor_type* pointer_type; + typedef functor_type* pointer_type; #endif // BOOST_NO_STD_ALLOCATOR # ifndef BOOST_NO_STD_ALLOCATOR @@ -270,8 +316,10 @@ namespace boost { # endif // BOOST_NO_STD_ALLOCATOR if (op == clone_functor_tag) { - functor_type* f = - static_cast(function_obj_ptr.obj_ptr); + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + const functor_type* f = + (const functor_type*)(in_buffer.obj_ptr); // Clone the functor # ifndef BOOST_NO_STD_ALLOCATOR @@ -283,12 +331,11 @@ namespace boost { # else functor_type* new_f = new functor_type(*f); # endif // BOOST_NO_STD_ALLOCATOR - return make_any_pointer(static_cast(new_f)); - } - else { + out_buffer.obj_ptr = new_f; + } else if (op == destroy_functor_tag) { /* Cast from the void pointer to the functor pointer type */ functor_type* f = - reinterpret_cast(function_obj_ptr.obj_ptr); + static_cast(out_buffer.obj_ptr); # ifndef BOOST_NO_STD_ALLOCATOR /* Cast from the functor pointer type to the allocator's pointer @@ -301,26 +348,44 @@ namespace boost { # else delete f; # endif // BOOST_NO_STD_ALLOCATOR - - return make_any_pointer(static_cast(0)); + out_buffer.obj_ptr = 0; + } else /* op == check_functor_type_tag */ { + const std::type_info& check_type = + *static_cast(out_buffer.const_obj_ptr); + if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor))) + out_buffer.obj_ptr = in_buffer.obj_ptr; + else + out_buffer.obj_ptr = 0; } } + + // For function objects, we determine whether the function + // object can use the small-object optimization buffer or + // whether we need to allocate it on the heap. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_obj_tag) + { + manager(in_buffer, out_buffer, op, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + } + public: /* Dispatch to an appropriate manager based on whether we have a function pointer or a function object pointer. */ - static any_pointer - manage(any_pointer functor_ptr, functor_manager_operation_type op) + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) { - if (op == check_functor_type_tag) { - std::type_info* type = - static_cast(functor_ptr.obj_ptr); - return (BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)? - functor_ptr - : make_any_pointer(reinterpret_cast(0))); - } - else { - typedef typename get_function_tag::type tag_type; - return manager(functor_ptr, op, tag_type()); + typedef typename get_function_tag::type tag_type; + switch (op) { + case get_functor_type_tag: + out_buffer.const_obj_ptr = &typeid(functor_type); + return; + + default: + manager(in_buffer, out_buffer, op, tag_type()); + return; } } }; @@ -386,6 +451,18 @@ namespace boost { else return true; } #endif // BOOST_NO_SFINAE + + /** + * Stores the "manager" portion of the vtable for a + * boost::function object. + */ + struct vtable_base + { + vtable_base() : manager(0) { } + void (*manager)(const function_buffer& in_buffer, + function_buffer& out_buffer, + functor_manager_operation_type op); + }; } // end namespace function } // end namespace detail @@ -398,62 +475,61 @@ namespace boost { class function_base { public: - function_base() : manager(0) + function_base() : vtable(0) { } + + /** Determine if the function is empty (i.e., has no target). */ + bool empty() const { return !vtable; } + + /** Retrieve the type of the stored function object, or typeid(void) + if this is empty. */ + const std::type_info& target_type() const { - functor.obj_ptr = 0; - } + if (!vtable) return typeid(void); - // Is this function empty? - bool empty() const { return !manager; } + detail::function::function_buffer type; + vtable->manager(functor, type, detail::function::get_functor_type_tag); + return *static_cast(type.const_obj_ptr); + } template Functor* target() { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag::type tag; - return get_functor_pointer(tag(), 0); - } + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.const_obj_ptr = &typeid(Functor); + vtable->manager(functor, type_result, + detail::function::check_functor_type_tag); + return static_cast(type_result.obj_ptr); } template - #if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) const Functor* target( Functor * = 0 ) const #else const Functor* target() const #endif { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag::type tag; - -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - return get_functor_pointer(tag(), 0, (Functor*)0); -#else - return get_functor_pointer(tag(), 0); -#endif - } + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.const_obj_ptr = &typeid(Functor); + vtable->manager(functor, type_result, + detail::function::check_functor_type_tag); + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + return (const Functor*)(type_result.obj_ptr); } template bool contains(const F& f) const { #if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - if (const F* fp = this->target( (F*)0 )) { + if (const F* fp = this->target( (F*)0 )) #else - if (const F* fp = this->template target()) { + if (const F* fp = this->template target()) #endif + { return function_equal(*fp, f); } else { return false; @@ -484,44 +560,8 @@ public: #endif public: // should be protected, but GCC 2.95.3 will fail to allow access - detail::function::any_pointer (*manager)( - detail::function::any_pointer, - detail::function::functor_manager_operation_type); - detail::function::any_pointer functor; - -private: - template -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - Functor* get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) -#else - Functor* get_functor_pointer(detail::function::function_ptr_tag, int) -#endif - { return reinterpret_cast(&functor.func_ptr); } - - template -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - Functor* get_functor_pointer(Tag, long, Functor * = 0) -#else - Functor* get_functor_pointer(Tag, long) -#endif - { return static_cast(functor.obj_ptr); } - - template - const Functor* -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) const -#else - get_functor_pointer(detail::function::function_ptr_tag, int) const -#endif - { return reinterpret_cast(&functor.func_ptr); } - - template -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - const Functor* get_functor_pointer(Tag, long, Functor * = 0) const -#else - const Functor* get_functor_pointer(Tag, long) const -#endif - { return static_cast(functor.const_obj_ptr); } + detail::function::vtable_base* vtable; + mutable detail::function::function_buffer functor; }; /** diff --git a/boost/boost/function/function_template.hpp b/boost/boost/function/function_template.hpp index 3730f421ce..3aacea1cf5 100644 --- a/boost/boost/function/function_template.hpp +++ b/boost/boost/function/function_template.hpp @@ -1,6 +1,6 @@ // Boost.Function library -// Copyright Douglas Gregor 2001-2003. Use, modification and +// Copyright Douglas Gregor 2001-2006. 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) @@ -22,7 +22,7 @@ #define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) #define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ - typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(arg, BOOST_PP_CAT(BOOST_PP_INC(I),_type)); + typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); #define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) @@ -50,22 +50,23 @@ BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_REF_INVOKER \ + BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ + BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) #define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ + BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) #ifndef BOOST_NO_VOID_RETURNS # define BOOST_FUNCTION_VOID_RETURN_TYPE void # define BOOST_FUNCTION_RETURN(X) X #else -# define BOOST_FUNCTION_VOID_RETURN_TYPE ::boost::detail::function::unusable +# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable # define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () #endif @@ -79,7 +80,7 @@ namespace boost { > struct BOOST_FUNCTION_FUNCTION_INVOKER { - static R invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) { FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); @@ -95,7 +96,7 @@ namespace boost { struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) { @@ -111,11 +112,15 @@ namespace boost { > struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER { - static R invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(&function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.obj_ptr); return (*f)(BOOST_FUNCTION_ARGS); } }; @@ -128,11 +133,15 @@ namespace boost { struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(&function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.obj_ptr); BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); } }; @@ -142,12 +151,15 @@ namespace boost { typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS > - struct BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER + struct BOOST_FUNCTION_FUNCTION_REF_INVOKER { - static R invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + { - FunctionObj f = FunctionObj(); - return f(BOOST_FUNCTION_ARGS); + FunctionObj* f = + reinterpret_cast(function_obj_ptr.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); } }; @@ -156,14 +168,16 @@ namespace boost { typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS > - struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER + struct BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER { static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) { - FunctionObj f = FunctionObj(); - BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); + FunctionObj* f = + reinterpret_cast(function_obj_ptr.obj_ptr); + BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); } }; @@ -174,7 +188,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_FUNCTION_INVOKER { - typedef typename ct_if<(is_void::value), + typedef typename mpl::if_c<(is_void::value), BOOST_FUNCTION_VOID_FUNCTION_INVOKER< FunctionPtr, R BOOST_FUNCTION_COMMA @@ -195,7 +209,7 @@ namespace boost { > struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER { - typedef typename ct_if<(is_void::value), + typedef typename mpl::if_c<(is_void::value), BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA @@ -214,15 +228,15 @@ namespace boost { typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS > - struct BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER + struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER< + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS >, - BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER< + BOOST_FUNCTION_FUNCTION_REF_INVOKER< FunctionObj, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS @@ -230,6 +244,199 @@ namespace boost { >::type type; }; + /** + * vtable for a specific boost::function instance. + */ + template + struct BOOST_FUNCTION_VTABLE : vtable_base + { +#ifndef BOOST_NO_VOID_RETURNS + typedef R result_type; +#else + typedef typename function_return_type::type result_type; +#endif // BOOST_NO_VOID_RETURNS + + typedef result_type (*invoker_type)(function_buffer& + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS); + + template + BOOST_FUNCTION_VTABLE(F f) : vtable_base(), invoker(0) + { + init(f); + } + + template + bool assign_to(F f, function_buffer& functor) + { + typedef typename get_function_tag::type tag; + return assign_to(f, functor, tag()); + } + + void clear(function_buffer& functor) + { + if (manager) + manager(functor, functor, destroy_functor_tag); + } + + private: + template + void init(F f) + { + typedef typename get_function_tag::type tag; + init(f, tag()); + } + + // Function pointers + template + void init(FunctionPtr /*f*/, function_ptr_tag) + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + actual_invoker_type; + + invoker = &actual_invoker_type::invoke; + manager = &functor_manager::manage; + } + + template + bool + assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) + { + this->clear(functor); + if (f) { + // should be a reinterpret cast, but some compilers insist + // on giving cv-qualifiers to free functions + functor.func_ptr = (void (*)())(f); + return true; + } else { + return false; + } + } + + // Member pointers +#if BOOST_FUNCTION_NUM_ARGS > 0 + template + void init(MemberPtr f, member_ptr_tag) + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + this->init(mem_fn(f)); + } + + template + bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + if (f) { + this->assign_to(mem_fn(f), functor); + return true; + } else { + return false; + } + } +#endif // BOOST_FUNCTION_NUM_ARGS > 0 + + // Function objects + template + void init(FunctionObj /*f*/, function_obj_tag) + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + actual_invoker_type; + + invoker = &actual_invoker_type::invoke; + manager = &functor_manager::manage; + } + + // Assign to a function object using the small object optimization + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) + { + new ((void*)&functor.data) FunctionObj(f); + } + + // Assign to a function object allocated on the heap. + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) + { +#ifndef BOOST_NO_STD_ALLOCATOR + typedef typename Allocator::template rebind::other + allocator_type; + typedef typename allocator_type::pointer pointer_type; + + allocator_type allocator; + pointer_type copy = allocator.allocate(1); + allocator.construct(copy, f); + + // Get back to the original pointer type + functor.obj_ptr = static_cast(copy); +# else + functor.obj_ptr = new FunctionObj(f); +# endif // BOOST_NO_STD_ALLOCATOR + } + + template + bool + assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) + { + if (!boost::detail::function::has_empty_target(boost::addressof(f))) { + assign_functor(f, functor, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + return true; + } else { + return false; + } + } + + // Reference to a function object + template + void + init(const reference_wrapper& /*f*/, function_obj_ref_tag) + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + actual_invoker_type; + + invoker = &actual_invoker_type::invoke; + manager = &reference_manager::get; + } + + template + bool + assign_to(const reference_wrapper& f, + function_buffer& functor, function_obj_ref_tag) + { + if (!boost::detail::function::has_empty_target(f.get_pointer())) { + // DPG TBD: We might need to detect constness of + // FunctionObj to assign into obj_ptr or const_obj_ptr to + // be truly legit, but no platform in existence makes + // const void* different from void*. + functor.const_obj_ptr = f.get_pointer(); + return true; + } else { + return false; + } + } + + public: + invoker_type invoker; + }; } // end namespace function } // end namespace detail @@ -244,11 +451,15 @@ namespace boost { #ifndef BOOST_NO_VOID_RETURNS typedef R result_type; #else - typedef typename detail::function::function_return_type::type + typedef typename boost::detail::function::function_return_type::type result_type; #endif // BOOST_NO_VOID_RETURNS private: + typedef boost::detail::function::BOOST_FUNCTION_VTABLE< + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, Allocator> + vtable_type; + struct clear_type {}; public: @@ -274,8 +485,7 @@ namespace boost { typedef Allocator allocator_type; typedef BOOST_FUNCTION_FUNCTION self_type; - BOOST_FUNCTION_FUNCTION() : function_base() - , invoker(0) {} + BOOST_FUNCTION_FUNCTION() : function_base() { } // MSVC chokes if the following two constructors are collapsed into // one with a default parameter. @@ -283,36 +493,33 @@ namespace boost { BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f #ifndef BOOST_NO_SFINAE ,typename enable_if_c< - (::boost::type_traits::ice_not< + (boost::type_traits::ice_not< (is_integral::value)>::value), int>::type = 0 #endif // BOOST_NO_SFINAE ) : - function_base(), - invoker(0) + function_base() { this->assign_to(f); } #ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {} + BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } #else - BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0) + BOOST_FUNCTION_FUNCTION(int zero) : function_base() { BOOST_ASSERT(zero == 0); } #endif - BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : - function_base(), - invoker(0) + BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() { this->assign_to_own(f); } ~BOOST_FUNCTION_FUNCTION() { clear(); } -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // MSVC 6.0 and prior require all definitions to be inline, but // these definitions can become very costly. result_type operator()(BOOST_FUNCTION_PARMS) const @@ -320,7 +527,8 @@ namespace boost { if (this->empty()) boost::throw_exception(bad_function_call()); - return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + return static_cast(vtable)->invoker + (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #else result_type operator()(BOOST_FUNCTION_PARMS) const; @@ -334,7 +542,7 @@ namespace boost { template #ifndef BOOST_NO_SFINAE typename enable_if_c< - (::boost::type_traits::ice_not< + (boost::type_traits::ice_not< (is_integral::value)>::value), BOOST_FUNCTION_FUNCTION&>::type #else @@ -342,7 +550,13 @@ namespace boost { #endif operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { - self_type(f).swap(*this); + this->clear(); + try { + this->assign_to(f); + } catch (...) { + vtable = 0; + throw; + } return *this; } @@ -367,7 +581,13 @@ namespace boost { if (&f == this) return *this; - self_type(f).swap(*this); + this->clear(); + try { + this->assign_to_own(f); + } catch (...) { + vtable = 0; + throw; + } return *this; } @@ -376,21 +596,18 @@ namespace boost { if (&other == this) return; - std::swap(this->manager, other.manager); - std::swap(this->functor, other.functor); - std::swap(invoker, other.invoker); + BOOST_FUNCTION_FUNCTION tmp = *this; + *this = other; + other = tmp; } // Clear out a target, if there is one void clear() { - if (this->manager) { - function_base::functor = - this->manager(this->functor, detail::function::destroy_functor_tag); + if (vtable) { + static_cast(vtable)->clear(this->functor); + vtable = 0; } - - this->manager = 0; - invoker = 0; } #if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) @@ -416,131 +633,19 @@ namespace boost { void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) { if (!f.empty()) { - invoker = f.invoker; - this->manager = f.manager; - this->functor = - f.manager(f.functor, detail::function::clone_functor_tag); + this->vtable = f.vtable; + f.vtable->manager(f.functor, this->functor, + boost::detail::function::clone_functor_tag); } } template void assign_to(Functor f) { - typedef typename detail::function::get_function_tag::type tag; - this->assign_to(f, tag()); - } - - template - void assign_to(FunctionPtr f, detail::function::function_ptr_tag) - { - clear(); - - if (f) { - typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = - &detail::function::functor_manager::manage; - this->functor = - this->manager(detail::function::make_any_pointer( - // should be a reinterpret cast, but some compilers - // insist on giving cv-qualifiers to free functions - (void (*)())(f) - ), - detail::function::clone_functor_tag); - } + static vtable_type stored_vtable(f); + if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable; + else vtable = 0; } - -#if BOOST_FUNCTION_NUM_ARGS > 0 - template - void assign_to(MemberPtr f, detail::function::member_ptr_tag) - { - this->assign_to(mem_fn(f)); - } -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - - template - void assign_to(FunctionObj f, detail::function::function_obj_tag) - { - if (!detail::function::has_empty_target(boost::addressof(f))) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::functor_manager< - FunctionObj, Allocator>::manage; -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other - rebound_allocator_type; - typedef typename rebound_allocator_type::pointer pointer_type; - rebound_allocator_type allocator; - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, f); - - // Get back to the original pointer type - FunctionObj* new_f = static_cast(copy); -#else - FunctionObj* new_f = new FunctionObj(f); -#endif // BOOST_NO_STD_ALLOCATOR - this->functor = - detail::function::make_any_pointer(static_cast(new_f)); - } - } - - template - void assign_to(const reference_wrapper& f, - detail::function::function_obj_ref_tag) - { - if (!detail::function::has_empty_target(f.get_pointer())) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager::get; - this->functor = - this->manager( - detail::function::make_any_pointer( - const_cast(f.get_pointer())), - detail::function::clone_functor_tag); - } - } - - template - void assign_to(FunctionObj, detail::function::stateless_function_obj_tag) - { - typedef - typename detail::function:: - BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager::get; - this->functor = detail::function::make_any_pointer(this); - } - - typedef result_type (*invoker_type)(detail::function::any_pointer - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); - - invoker_type invoker; }; template typename BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, Allocator>::result_type BOOST_FUNCTION_FUNCTIONempty()) boost::throw_exception(bad_function_call()); - - return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + + return static_cast(vtable)->invoker + (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #endif @@ -629,7 +735,7 @@ public: function(Functor f #ifndef BOOST_NO_SFINAE ,typename enable_if_c< - (::boost::type_traits::ice_not< + (boost::type_traits::ice_not< (is_integral::value)>::value), int>::type = 0 #endif @@ -655,7 +761,7 @@ public: template #ifndef BOOST_NO_SFINAE typename enable_if_c< - (::boost::type_traits::ice_not< + (boost::type_traits::ice_not< (is_integral::value)>::value), self_type&>::type #else @@ -688,6 +794,7 @@ public: } // end namespace boost // Cleanup after ourselves... +#undef BOOST_FUNCTION_VTABLE #undef BOOST_FUNCTION_DEFAULT_ALLOCATOR #undef BOOST_FUNCTION_COMMA #undef BOOST_FUNCTION_FUNCTION @@ -695,11 +802,11 @@ public: #undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER #undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER #undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER #undef BOOST_FUNCTION_GET_FUNCTION_INVOKER #undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER #undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER #undef BOOST_FUNCTION_TEMPLATE_PARMS #undef BOOST_FUNCTION_TEMPLATE_ARGS diff --git a/boost/boost/integer_traits.hpp b/boost/boost/integer_traits.hpp index 71761e3e71..2accb2f63f 100644 --- a/boost/boost/integer_traits.hpp +++ b/boost/boost/integer_traits.hpp @@ -5,7 +5,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * $Id: integer_traits.hpp,v 1.27.2.1 2005/08/24 15:45:17 johnmaddock Exp $ + * $Id: integer_traits.hpp,v 1.30 2006/02/05 10:19:42 johnmaddock Exp $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ @@ -21,9 +21,9 @@ // These are an implementation detail and not part of the interface #include -// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, +// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, // and some may have but not ... -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun)) +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__)) #include #endif diff --git a/boost/boost/intrusive_ptr.hpp b/boost/boost/intrusive_ptr.hpp index 7efbadeea3..b03b9013d7 100644 --- a/boost/boost/intrusive_ptr.hpp +++ b/boost/boost/intrusive_ptr.hpp @@ -174,22 +174,22 @@ template inline bool operator!=(intrusive_ptr const & a, in return a.get() != b.get(); } -template inline bool operator==(intrusive_ptr const & a, T * b) +template inline bool operator==(intrusive_ptr const & a, U * b) { return a.get() == b; } -template inline bool operator!=(intrusive_ptr const & a, T * b) +template inline bool operator!=(intrusive_ptr const & a, U * b) { return a.get() != b; } -template inline bool operator==(T * a, intrusive_ptr const & b) +template inline bool operator==(T * a, intrusive_ptr const & b) { return a == b.get(); } -template inline bool operator!=(T * a, intrusive_ptr const & b) +template inline bool operator!=(T * a, intrusive_ptr const & b) { return a != b.get(); } @@ -249,7 +249,7 @@ template std::ostream & operator<< (std::ostream & os, intrusive_ptr #else -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT) +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) // MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL using std::basic_ostream; template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) diff --git a/boost/boost/iostreams/chain.hpp b/boost/boost/iostreams/chain.hpp index 647f1082da..a88f8f48c4 100644 --- a/boost/boost/iostreams/chain.hpp +++ b/boost/boost/iostreams/chain.hpp @@ -162,26 +162,6 @@ public: std::streamsize write(const char_type* s, std::streamsize n); std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); - //----------Additional i/o functions--------------------------------------// - - // Returns true if this chain is non-empty and its final link - // is a source or sink, i.e., if it is ready to perform i/o. - bool is_complete() const; - bool auto_close() const; - void set_auto_close(bool close); - bool sync() { return front().BOOST_IOSTREAMS_PUBSYNC() != -1; } - bool strict_sync(); - - //----------Container-like interface--------------------------------------// - - typedef typename list_type::size_type size_type; - streambuf_type& front() { return *list().front(); } - BOOST_IOSTREAMS_DEFINE_PUSH(push, mode, char_type, push_impl) - void pop(); - bool empty() const { return list().empty(); } - size_type size() const { return list().size(); } - void reset(); - //----------Direct component access---------------------------------------// const std::type_info& component_type(int n) const @@ -218,6 +198,27 @@ public: else return 0; } +public: + + //----------Container-like interface--------------------------------------// + + typedef typename list_type::size_type size_type; + streambuf_type& front() { return *list().front(); } + BOOST_IOSTREAMS_DEFINE_PUSH(push, mode, char_type, push_impl) + void pop(); + bool empty() const { return list().empty(); } + size_type size() const { return list().size(); } + void reset(); + + //----------Additional i/o functions--------------------------------------// + + // Returns true if this chain is non-empty and its final link + // is a source or sink, i.e., if it is ready to perform i/o. + bool is_complete() const; + bool auto_close() const; + void set_auto_close(bool close); + bool sync() { return front().BOOST_IOSTREAMS_PUBSYNC() != -1; } + bool strict_sync(); private: template void push_impl(const T& t, int buffer_size = -1, int pback_size = -1) @@ -420,26 +421,6 @@ public: const std::type_info& component_type(int n) const { return chain_->component_type(n); } -//#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) -// // Deprecated. -// template -// const std::type_info& component_type() const -// { return chain_->component_type(N); } -// -// template -// T* component(int n) const // Tru64 needs boost::type. -// { return chain_->component(n, boost::type()); } -// -// // Deprecated. -// template -// T* component() const // Tru64 needs boost::type. -// { return chain_->component(N, boost::type()); } -//#else -// template -// T* component(int n, boost::type t) const -// { return chain_->component(n, t); } -//#endif - #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) // Deprecated. template diff --git a/boost/boost/iostreams/checked_operations.hpp b/boost/boost/iostreams/checked_operations.hpp index f82f70f305..f78fb3a8bc 100644 --- a/boost/boost/iostreams/checked_operations.hpp +++ b/boost/boost/iostreams/checked_operations.hpp @@ -127,7 +127,7 @@ struct read_write_if_impl { template<> struct seek_if_impl { template - static std::streampos + static stream_offset seek( T& t, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { return iostreams::seek(t, off, way, which); } @@ -136,7 +136,7 @@ struct seek_if_impl { template<> struct seek_if_impl { template - static std::streampos + static stream_offset seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode) { throw cant_seek(); } }; diff --git a/boost/boost/iostreams/detail/adapter/concept_adapter.hpp b/boost/boost/iostreams/detail/adapter/concept_adapter.hpp index 929fd85884..7522eab719 100644 --- a/boost/boost/iostreams/detail/adapter/concept_adapter.hpp +++ b/boost/boost/iostreams/detail/adapter/concept_adapter.hpp @@ -80,16 +80,16 @@ public: std::streamsize write(const char_type* s, std::streamsize n, Sink* snk) { return output_impl::write(t_, snk, s, n); } - std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which ) + stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) { return this->seek( off, way, which, (basic_null_device*) 0); } template - std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which, Device* dev ) + stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which, Device* dev ) { return any_impl::seek(t_, dev, off, way, which); } void close(BOOST_IOS::openmode which) @@ -122,7 +122,7 @@ public: template<> struct device_wrapper_impl { template - static std::streampos + static stream_offset seek( Device& dev, Dummy*, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { @@ -131,7 +131,7 @@ struct device_wrapper_impl { } template - static std::streampos + static stream_offset seek( Device&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) { @@ -139,7 +139,7 @@ struct device_wrapper_impl { } template - static std::streampos + static stream_offset seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access ) @@ -191,7 +191,7 @@ struct device_wrapper_impl { template<> struct flt_wrapper_impl { template - static std::streampos + static stream_offset seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { @@ -200,13 +200,13 @@ struct flt_wrapper_impl { } template - static std::streampos + static stream_offset seek( Filter&, Device*, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) { throw cant_seek(); } template - static std::streampos + static stream_offset seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access tag ) @@ -216,14 +216,14 @@ struct flt_wrapper_impl { } template - static std::streampos + static stream_offset seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access, any_tag ) { return f.seek(*dev, off, way); } template - static std::streampos + static stream_offset seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access, two_sequence ) diff --git a/boost/boost/iostreams/detail/adapter/mode_adapter.hpp b/boost/boost/iostreams/detail/adapter/mode_adapter.hpp index d490985cd6..de757ac8ac 100644 --- a/boost/boost/iostreams/detail/adapter/mode_adapter.hpp +++ b/boost/boost/iostreams/detail/adapter/mode_adapter.hpp @@ -48,9 +48,9 @@ public: std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ); + stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out); #endif @@ -66,12 +66,12 @@ public: { return iostreams::write(t_, snk, s, n); } template - std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) + stream_offset seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) { return iostreams::seek(t_, dev, off, way); } template - std::streampos seek( Device& dev, stream_offset off, - BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) + stream_offset seek( Device& dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { return iostreams::seek(t_, dev, off, way, which); } template @@ -102,7 +102,7 @@ std::streamsize mode_adapter::write { return boost::iostreams::write(t_, s, n); } template -std::streampos mode_adapter::seek +stream_offset mode_adapter::seek (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { return boost::iostreams::seek(t_, off, way, which); } diff --git a/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp b/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp index 9768d654dd..294358e12e 100644 --- a/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp +++ b/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp @@ -44,9 +44,9 @@ public: } return result; } - std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ) + stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) { return iostreams::seek(device_, off, way, which); } public: Device& device_; diff --git a/boost/boost/iostreams/detail/adapter/range_adapter.hpp b/boost/boost/iostreams/detail/adapter/range_adapter.hpp index 15888af46e..dbc6229e78 100644 --- a/boost/boost/iostreams/detail/adapter/range_adapter.hpp +++ b/boost/boost/iostreams/detail/adapter/range_adapter.hpp @@ -62,7 +62,7 @@ public: range_adapter(iterator first, iterator last); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); + stream_offset seek(stream_offset off, BOOST_IOS::seekdir way); private: iterator first_, cur_, last_; }; @@ -89,11 +89,11 @@ inline std::streamsize range_adapter::write template -std::streampos range_adapter::seek +stream_offset range_adapter::seek (stream_offset off, BOOST_IOS::seekdir way) { impl::seek(first_, cur_, last_, off, way); - return offset_to_position(cur_ - first_); + return static_cast(cur_ - first_); } //------------------Implementation of range_adapter_impl----------------------// diff --git a/boost/boost/iostreams/detail/bool_trait_def.hpp b/boost/boost/iostreams/detail/bool_trait_def.hpp index 030288db15..625233a221 100644 --- a/boost/boost/iostreams/detail/bool_trait_def.hpp +++ b/boost/boost/iostreams/detail/bool_trait_def.hpp @@ -20,7 +20,7 @@ // Description: Used to generate the traits classes is_istream, is_ostream, // etc. // -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) #else # define BOOST_IOSTREAMS_TRAIT_NAMESPACE(trait) BOOST_PP_CAT(trait, _impl_):: diff --git a/boost/boost/iostreams/detail/config/codecvt.hpp b/boost/boost/iostreams/detail/config/codecvt.hpp index 14da6d8392..48ffb9c012 100644 --- a/boost/boost/iostreams/detail/config/codecvt.hpp +++ b/boost/boost/iostreams/detail/config/codecvt.hpp @@ -63,7 +63,7 @@ namespace std { #if defined(__LIBCOMO__) using ::mbstate_t; -#elif defined(BOOST_DINKUMWARE_STDLIB) +#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__) using ::mbstate_t; #elif defined(__SGI_STL_PORT) #elif defined(BOOST_NO_STDC_NAMESPACE) diff --git a/boost/boost/iostreams/detail/resolve.hpp b/boost/boost/iostreams/detail/resolve.hpp index 997403cd3c..169b89a864 100644 --- a/boost/boost/iostreams/detail/resolve.hpp +++ b/boost/boost/iostreams/detail/resolve.hpp @@ -47,7 +47,10 @@ template struct resolve_traits { typedef typename mpl::if_< - boost::detail::is_incrementable, + mpl::and_< + boost::detail::is_incrementable, // Must come first + is_dereferenceable // for CW 9.[0-4] + >, output_iterator_adapter, const T& >::type type; @@ -160,7 +163,10 @@ struct resolve_traits { mode_adapter, is_iterator_range, range_adapter, - is_dereferenceable, + mpl::and_< + is_dereferenceable, + boost::detail::is_incrementable + >, output_iterator_adapter, is_array, array_adapter, diff --git a/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp b/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp index 5f7a69562b..9099dd0e6a 100644 --- a/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp +++ b/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include // Must come last. @@ -53,7 +52,7 @@ private: ) streambuf_type; public: // stream needs access. void open(const T& t, int buffer_size, int pback_size); - bool is_open() const; + bool is_open(); void close(); bool auto_close() const { return auto_close_; } void set_auto_close(bool close) { auto_close_ = close; } @@ -86,7 +85,7 @@ protected: BOOST_IOS::openmode which ); pos_type seekpos(pos_type sp, BOOST_IOS::openmode which); private: - pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way, + pos_type seek_impl( off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ); void init_input(any_tag) { } void init_input(input); @@ -119,8 +118,7 @@ void direct_streambuf::open(const T& t, int, int) } template -bool direct_streambuf::is_open() const -{ return ibeg_ != 0 && !obeg_ != 0; } +bool direct_streambuf::is_open() { return ibeg_ != 0 && !obeg_ != 0; } template void direct_streambuf::close() @@ -187,10 +185,7 @@ template inline typename direct_streambuf::pos_type direct_streambuf::seekpos (pos_type sp, BOOST_IOS::openmode) -{ - return seek_impl( position_to_offset(sp), BOOST_IOS::beg, - BOOST_IOS::in | BOOST_IOS::out ); -} +{ return seek_impl(sp, BOOST_IOS::beg, BOOST_IOS::in | BOOST_IOS::out); } template void direct_streambuf::close(BOOST_IOS::openmode which) @@ -209,13 +204,13 @@ void direct_streambuf::close(BOOST_IOS::openmode which) template typename direct_streambuf::pos_type direct_streambuf::seek_impl - (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) + (off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { using namespace std; BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out; if (two_head() && (which & both) == both) throw bad_seek(); - stream_offset result = -1; + off_type result = -1; bool one = one_head(); if (one && (pptr() != 0 || gptr()== 0)) init_get_area(); // Switch to input mode, for code reuse. @@ -247,7 +242,7 @@ typename direct_streambuf::pos_type direct_streambuf::seek_impl pbump(static_cast(next - (pptr() - obeg_))); result = next; } - return offset_to_position(result); + return result; } template diff --git a/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp b/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp index 4f65a33f6b..f2b866a233 100644 --- a/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp +++ b/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp @@ -58,7 +58,7 @@ public: indirect_streambuf(); void open(const T& t BOOST_IOSTREAMS_PUSH_PARAMS()); - bool is_open() const; + bool is_open(); void close(); bool auto_close() const; void set_auto_close(bool close); @@ -118,7 +118,7 @@ private: void sync_impl(); void close_impl(BOOST_IOS::openmode); - enum flag_type { + enum { f_open = 1, f_input_closed = f_open << 1, f_output_closed = f_input_closed << 1, @@ -189,7 +189,7 @@ void indirect_streambuf::open } template -inline bool indirect_streambuf::is_open() const +inline bool indirect_streambuf::is_open() { return (flags_ & f_open) != 0; } template @@ -328,10 +328,7 @@ template inline typename indirect_streambuf::pos_type indirect_streambuf::seekpos (pos_type sp, BOOST_IOS::openmode) -{ - return seek_impl( position_to_offset(sp), BOOST_IOS::beg, - BOOST_IOS::in | BOOST_IOS::out ); -} +{ return seek_impl(sp, BOOST_IOS::beg, BOOST_IOS::in | BOOST_IOS::out); } template typename indirect_streambuf::pos_type diff --git a/boost/boost/iostreams/device/file.hpp b/boost/boost/iostreams/device/file.hpp index 479858271a..29a9be9e92 100644 --- a/boost/boost/iostreams/device/file.hpp +++ b/boost/boost/iostreams/device/file.hpp @@ -51,9 +51,9 @@ public: BOOST_IOS::in | BOOST_IOS::out ); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ); + stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); void open( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, @@ -154,7 +154,7 @@ inline std::streamsize basic_file::write { return pimpl_->file_.sputn(s, n); } template -std::streampos basic_file::seek +stream_offset basic_file::seek ( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode ) { return iostreams::seek(pimpl_->file_, off, way); } diff --git a/boost/boost/iostreams/device/file_descriptor.hpp b/boost/boost/iostreams/device/file_descriptor.hpp index 13e1c68411..15128d5c6e 100644 --- a/boost/boost/iostreams/device/file_descriptor.hpp +++ b/boost/boost/iostreams/device/file_descriptor.hpp @@ -63,7 +63,7 @@ public: bool is_open() const { return pimpl_->flags_ != 0; } std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); + stream_offset seek(stream_offset off, BOOST_IOS::seekdir way); void close(); private: struct impl { diff --git a/boost/boost/iostreams/device/mapped_file.hpp b/boost/boost/iostreams/device/mapped_file.hpp index 38046f9a85..e04830c7b7 100644 --- a/boost/boost/iostreams/device/mapped_file.hpp +++ b/boost/boost/iostreams/device/mapped_file.hpp @@ -137,7 +137,7 @@ private: //------------------Definition of mapped_file---------------------------------// -class BOOST_IOSTREAMS_DECL mapped_file { +class mapped_file { private: typedef mapped_file_source delegate_type; delegate_type delegate_; @@ -202,7 +202,7 @@ public: static int alignment() { return mapped_file_source::alignment(); } }; -struct BOOST_IOSTREAMS_DECL mapped_file_sink : private mapped_file { +struct mapped_file_sink : private mapped_file { friend struct operations; typedef char char_type; struct category diff --git a/boost/boost/iostreams/device/null.hpp b/boost/boost/iostreams/device/null.hpp index c17704bd6c..2a45252daa 100644 --- a/boost/boost/iostreams/device/null.hpp +++ b/boost/boost/iostreams/device/null.hpp @@ -30,9 +30,9 @@ public: { }; std::streamsize read(Ch*, std::streamsize) { return 0; } std::streamsize write(const Ch*, std::streamsize n) { return n; } - std::streampos seek( stream_offset, BOOST_IOS::seekdir, - BOOST_IOS::openmode = - BOOST_IOS::in | BOOST_IOS::out ) + stream_offset seek( stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode = + BOOST_IOS::in | BOOST_IOS::out ) { return -1; } void close(BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out) { } }; diff --git a/boost/boost/iostreams/filter/gzip.hpp b/boost/boost/iostreams/filter/gzip.hpp index f8a5a9555f..a9ae48f8f9 100644 --- a/boost/boost/iostreams/filter/gzip.hpp +++ b/boost/boost/iostreams/filter/gzip.hpp @@ -234,20 +234,14 @@ public: template void close(Sink& snk, BOOST_IOS::openmode m) { - namespace io = boost::iostreams; - if (m & BOOST_IOS::out) { - // Close zlib compressor. - base_type::close(snk, BOOST_IOS::out); - - if (flags_ & f_header_done) { - - // Write final fields of gzip file format. - write_long(this->crc(), snk); - write_long(this->total_in(), snk); - } + // Close zlib compressor. + base_type::close(snk, BOOST_IOS::out); + // Write final fields of gzip file format. + write_long(this->crc(), snk); + write_long(this->total_in(), snk); } #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \ BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \ @@ -273,7 +267,7 @@ private: boost::iostreams::put(next, static_cast(0xFF & (n >> 24))); } - enum flag_type { + enum { f_header_done = 1, f_body_done = f_header_done << 1, f_footer_done = f_body_done << 1 @@ -462,7 +456,7 @@ private: if (static_cast(read_uint32(rng, gzip::bad_footer)) != this->total_out()) throw gzip_error(gzip::bad_length); } - enum flag_type { + enum { f_header_read = 1, f_footer_read = f_header_read << 1, f_text = f_footer_read << 1 @@ -553,11 +547,11 @@ std::streamsize basic_gzip_compressor::read_string static_cast(str.size() - offset_); streamsize amt = (std::min)(avail, n); std::copy( str.data() + offset_, - str.data() + offset_ + amt, - s ); + str.data() + offset_ + amt, + s ); offset_ += amt; if ( !(flags_ & f_header_done) && - offset_ == static_cast(str.size()) ) + offset_ == static_cast(str.size()) ) { flags_ |= f_header_done; } diff --git a/boost/boost/iostreams/filter/symmetric.hpp b/boost/boost/iostreams/filter/symmetric.hpp index 8aa987c0ea..1154c9a5d9 100644 --- a/boost/boost/iostreams/filter/symmetric.hpp +++ b/boost/boost/iostreams/filter/symmetric.hpp @@ -231,7 +231,7 @@ private: void close(); - enum flag_type { + enum { f_read = 1, f_write = f_read << 1, f_eof = f_write << 1, diff --git a/boost/boost/iostreams/filter/zlib.hpp b/boost/boost/iostreams/filter/zlib.hpp index cc6ccea397..375d67a9e7 100644 --- a/boost/boost/iostreams/filter/zlib.hpp +++ b/boost/boost/iostreams/filter/zlib.hpp @@ -332,7 +332,7 @@ zlib_compressor_impl::zlib_compressor_impl(const zlib_params& p) template zlib_compressor_impl::~zlib_compressor_impl() -{ reset(true, false); } +{ /*reset(true, false);*/ } template bool zlib_compressor_impl::filter @@ -357,7 +357,7 @@ zlib_decompressor_impl::zlib_decompressor_impl(const zlib_params& p) template zlib_decompressor_impl::~zlib_decompressor_impl() -{ reset(false, false); } +{ /*reset(false, false);*/ } template zlib_decompressor_impl::zlib_decompressor_impl(int window_bits) diff --git a/boost/boost/iostreams/positioning.hpp b/boost/boost/iostreams/positioning.hpp index a468a2cb05..540326bde0 100644 --- a/boost/boost/iostreams/positioning.hpp +++ b/boost/boost/iostreams/positioning.hpp @@ -46,7 +46,7 @@ inline std::streampos offset_to_position(stream_offset off) return std::streampos(std::mbstate_t(), off); } -inline stream_offset fpos_t_to_offset(fpos_t pos) +inline stream_offset fpos_t_to_offset(std::fpos_t pos) { // Helper function. #if defined(_POSIX_) || (_INTEGRAL_MAX_BITS >= 64) return pos; diff --git a/boost/boost/iterator.hpp b/boost/boost/iterator.hpp index d3844e71c0..a43cfe138e 100644 --- a/boost/boost/iterator.hpp +++ b/boost/boost/iterator.hpp @@ -52,7 +52,7 @@ namespace boost template - struct iterator : detail::iterator_base {}; + struct iterator : boost::detail::iterator_base {}; # endif } // namespace boost diff --git a/boost/boost/iterator/detail/config_def.hpp b/boost/boost/iterator/detail/config_def.hpp index 82b3b52cb3..3aba895b71 100644 --- a/boost/boost/iterator/detail/config_def.hpp +++ b/boost/boost/iterator/detail/config_def.hpp @@ -109,11 +109,6 @@ #endif -#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ - || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -# define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" -#endif #if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY diff --git a/boost/boost/iterator/detail/enable_if.hpp b/boost/boost/iterator/detail/enable_if.hpp index 45428a5bb2..0fd36fc4bc 100644 --- a/boost/boost/iterator/detail/enable_if.hpp +++ b/boost/boost/iterator/detail/enable_if.hpp @@ -72,7 +72,7 @@ namespace boost : mpl::identity # endif { -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef Return type; # endif }; diff --git a/boost/boost/iterator/detail/minimum_category.hpp b/boost/boost/iterator/detail/minimum_category.hpp index 74cef63f35..96501ddd46 100644 --- a/boost/boost/iterator/detail/minimum_category.hpp +++ b/boost/boost/iterator/detail/minimum_category.hpp @@ -22,7 +22,7 @@ namespace boost { namespace detail { // template struct minimum_category_impl -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) { template struct apply { @@ -77,12 +77,12 @@ template struct minimum_category { typedef minimum_category_impl< -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround is_same::value || # endif ::boost::is_convertible::value , ::boost::is_convertible::value -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround || is_same::value # endif > outer; @@ -103,7 +103,7 @@ struct minimum_category BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) }; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround template <> struct minimum_category { diff --git a/boost/boost/iterator/filter_iterator.hpp b/boost/boost/iterator/filter_iterator.hpp index 96fb84359f..14d640bf09 100644 --- a/boost/boost/iterator/filter_iterator.hpp +++ b/boost/boost/iterator/filter_iterator.hpp @@ -53,14 +53,14 @@ namespace boost public: filter_iterator() { } - filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) - : super_t(x), m_predicate(f), m_end(end) + filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(f), m_end(end_) { satisfy_predicate(); } - filter_iterator(Iterator x, Iterator end = Iterator()) - : super_t(x), m_predicate(), m_end(end) + filter_iterator(Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(), m_end(end_) { // Pro8 is a little too aggressive about instantiating the // body of this function. @@ -122,7 +122,7 @@ namespace boost , Iterator >::type x , Iterator end = Iterator() -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) , Predicate* = 0 #endif ) diff --git a/boost/boost/iterator/iterator_categories.hpp b/boost/boost/iterator/iterator_categories.hpp index 085936f7ab..564ae50004 100644 --- a/boost/boost/iterator/iterator_categories.hpp +++ b/boost/boost/iterator/iterator_categories.hpp @@ -97,7 +97,7 @@ namespace detail > {}; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct old_category_to_traversal { @@ -131,7 +131,7 @@ namespace detail { }; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct pure_traversal_tag { diff --git a/boost/boost/iterator/iterator_facade.hpp b/boost/boost/iterator/iterator_facade.hpp index ddb237d324..462bd8bc25 100644 --- a/boost/boost/iterator/iterator_facade.hpp +++ b/boost/boost/iterator/iterator_facade.hpp @@ -327,7 +327,7 @@ namespace boost } }; -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Deal with ETI template<> struct operator_arrow_result @@ -410,7 +410,7 @@ namespace boost : # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP iterator_difference -# elif BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300) mpl::if_< is_convertible , typename I1::difference_type @@ -431,14 +431,14 @@ namespace boost // Macros which describe the declarations of binary operators # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ - template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ - > \ - prefix typename mpl::apply2::type \ - operator op( \ - iterator_facade const& lhs \ +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class R1, class D1 \ + , class Derived2, class V2, class TC2, class R2, class D2 \ + > \ + prefix typename mpl::apply2::type \ + operator op( \ + iterator_facade const& lhs \ , iterator_facade const& rhs) # else # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ @@ -446,7 +446,7 @@ namespace boost class Derived1, class V1, class TC1, class R1, class D1 \ , class Derived2, class V2, class TC2, class R2, class D2 \ > \ - prefix typename detail::enable_if_interoperable< \ + prefix typename detail::enable_if_interoperable< \ Derived1, Derived2 \ , typename mpl::apply2::type \ >::type \ @@ -496,14 +496,14 @@ namespace boost ; BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend + friend inline , (iterator_facade const& , typename Derived::difference_type) ) ; BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend + friend inline , (typename Derived::difference_type , iterator_facade const&) ) @@ -620,7 +620,7 @@ namespace boost protected: // For use by derived classes - typedef iterator_facade iterator_facade_; + typedef iterator_facade iterator_facade_; public: @@ -666,7 +666,7 @@ namespace boost return this->derived(); } -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) typename detail::postfix_increment_result::type operator++(int) { @@ -708,7 +708,7 @@ namespace boost return result -= x; } -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // There appears to be a bug which trashes the data of classes // derived from iterator_facade when they are assigned unless we // define this assignment operator. This bug is only revealed @@ -721,9 +721,9 @@ namespace boost # endif }; -# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template - typename detail::postfix_increment_result::type + inline typename detail::postfix_increment_result::type operator++( iterator_facade& i , int diff --git a/boost/boost/iterator/iterator_traits.hpp b/boost/boost/iterator/iterator_traits.hpp index 93e282efb2..1352710eda 100644 --- a/boost/boost/iterator/iterator_traits.hpp +++ b/boost/boost/iterator/iterator_traits.hpp @@ -55,7 +55,7 @@ struct BOOST_ITERATOR_CATEGORY typedef typename detail::iterator_traits::iterator_category type; }; -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct iterator_value { diff --git a/boost/boost/mem_fn.hpp b/boost/boost/mem_fn.hpp index 7097d43bec..9695f57e80 100644 --- a/boost/boost/mem_fn.hpp +++ b/boost/boost/mem_fn.hpp @@ -328,11 +328,6 @@ private: return (u.*f_); } - template R & call(U & u, T *) const - { - return (u.*f_); - } - template R const & call(U & u, void const *) const { return (get_pointer(u)->*f_); @@ -352,7 +347,7 @@ public: return (p->*f_); } - template R const & operator()(U & u) const + template R const & operator()(U const & u) const { return call(u, &u); } @@ -364,13 +359,13 @@ public: return (t.*f_); } -#endif - R const & operator()(T const & t) const { return (t.*f_); } +#endif + bool operator==(dm const & rhs) const { return f_ == rhs.f_; diff --git a/boost/boost/mpl/apply_fwd.hpp b/boost/boost/mpl/apply_fwd.hpp index 5b850d331c..2092ff9ce0 100644 --- a/boost/boost/mpl/apply_fwd.hpp +++ b/boost/boost/mpl/apply_fwd.hpp @@ -15,8 +15,8 @@ // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/boost/boost/boost/mpl/apply_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Date: 2005/08/25 16:27:21 $ +// $Revision: 1.3 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include @@ -44,7 +44,7 @@ // agurt, 15/jan/02: top-level 'apply' template gives an ICE on MSVC // (for known reasons) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) # define BOOST_MPL_CFG_NO_APPLY_TEMPLATE #endif diff --git a/boost/boost/mpl/aux_/lambda_support.hpp b/boost/boost/mpl/aux_/lambda_support.hpp index 4b9b235906..338358bae8 100644 --- a/boost/boost/mpl/aux_/lambda_support.hpp +++ b/boost/boost/mpl/aux_/lambda_support.hpp @@ -11,8 +11,8 @@ // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_support.hpp,v $ -// $Date: 2004/11/28 01:37:05 $ -// $Revision: 1.12 $ +// $Date: 2005/08/25 16:27:21 $ +// $Revision: 1.13 $ #include @@ -122,7 +122,7 @@ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ , name< BOOST_MPL_PP_ENUM(i,::boost::mpl::na) >* \ ); \ /**/ -#elif !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300) # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ ::boost::mpl::aux::yes_tag operator|( \ diff --git a/boost/boost/mpl/aux_/preprocessed/gcc/quote.hpp b/boost/boost/mpl/aux_/preprocessed/gcc/quote.hpp index d7d0420e4d..020f093965 100644 --- a/boost/boost/mpl/aux_/preprocessed/gcc/quote.hpp +++ b/boost/boost/mpl/aux_/preprocessed/gcc/quote.hpp @@ -13,8 +13,8 @@ namespace boost { namespace mpl { template< typename T, bool has_type_ > struct quote_impl - : T { + typedef typename T::type type; }; template< typename T > diff --git a/boost/boost/mpl/aux_/preprocessed/plain/vector_c.hpp b/boost/boost/mpl/aux_/preprocessed/plain/vector_c.hpp index 840c2e1ab9..0f1560d7f1 100644 --- a/boost/boost/mpl/aux_/preprocessed/plain/vector_c.hpp +++ b/boost/boost/mpl/aux_/preprocessed/plain/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/boost/boost/mpl/aux_/yes_no.hpp b/boost/boost/mpl/aux_/yes_no.hpp index c2c1e6aebf..71504e940b 100644 --- a/boost/boost/mpl/aux_/yes_no.hpp +++ b/boost/boost/mpl/aux_/yes_no.hpp @@ -11,8 +11,8 @@ // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/boost/boost/boost/mpl/aux_/yes_no.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.7 $ +// $Date: 2005/08/25 16:27:21 $ +// $Revision: 1.8 $ #include #include @@ -38,7 +38,7 @@ template<> struct yes_no_tag template< BOOST_MPL_AUX_NTTP_DECL(long, n) > struct weighted_tag { -#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef char (&type)[n]; #else char buf[n]; diff --git a/boost/boost/mpl/quote.hpp b/boost/boost/mpl/quote.hpp index f2e8976366..37228f5ff2 100644 --- a/boost/boost/mpl/quote.hpp +++ b/boost/boost/mpl/quote.hpp @@ -15,8 +15,8 @@ // See http://www.boost.org/libs/mpl for documentation. // $Source: /cvsroot/boost/boost/boost/mpl/quote.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Date: 2006/05/03 03:27:58 $ +// $Revision: 1.5.14.2 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include @@ -60,9 +60,19 @@ namespace boost { namespace mpl { template< typename T, bool has_type_ > struct quote_impl +// GCC has a problem with metafunction forwarding when T is a +// specialization of a template called 'type'. +# if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4)) \ + && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) \ + && BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, BOOST_TESTED_AT(2)) +{ + typedef typename T::type type; +}; +# else : T { }; +# endif template< typename T > struct quote_impl diff --git a/boost/boost/multi_array.hpp b/boost/boost/multi_array.hpp index 1fa737a1d2..e6a91e2f62 100644 --- a/boost/boost/multi_array.hpp +++ b/boost/boost/multi_array.hpp @@ -42,9 +42,10 @@ namespace boost { struct populate_index_ranges { multi_array_types::index_range + // RG: underscore on extent_ to stifle strange MSVC warning. operator()(multi_array_types::index base, - multi_array_types::size_type extent) { - return multi_array_types::index_range(base,base+extent); + multi_array_types::size_type extent_) { + return multi_array_types::index_range(base,base+extent_); } }; @@ -379,12 +380,30 @@ public: } + template + multi_array& resize(const ExtentList& extents) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); + + typedef detail::multi_array::extent_gen gen_type; + gen_type ranges; + + for (int i=0; i != NumDims; ++i) { + typedef typename gen_type::range range_type; + ranges.ranges_[i] = range_type(0,extents[i]); + } + + return this->resize(ranges); + } + + + multi_array& resize(const detail::multi_array ::extent_gen& ranges) { // build a multi_array with the specs given - multi_array new_array(ranges); + multi_array new_array(ranges,this->storage_order()); // build a view of tmp with the minimum extents diff --git a/boost/boost/multi_array/base.hpp b/boost/boost/multi_array/base.hpp index f741baaf02..5341be5824 100644 --- a/boost/boost/multi_array/base.hpp +++ b/boost/boost/multi_array/base.hpp @@ -25,6 +25,7 @@ #include "boost/multi_array/storage_order.hpp" #include "boost/multi_array/types.hpp" #include "boost/config.hpp" +#include "boost/multi_array/concept_checks.hpp" //for ignore_unused_... #include "boost/mpl/eval_if.hpp" #include "boost/mpl/if.hpp" #include "boost/mpl/size_t.hpp" @@ -32,7 +33,7 @@ #include "boost/iterator/reverse_iterator.hpp" #include "boost/static_assert.hpp" #include "boost/type.hpp" -#include +#include "boost/assert.hpp" #include #include @@ -129,11 +130,13 @@ protected: Reference access(boost::type,index idx,TPtr base, const size_type* extents, const index* strides, - const index* index_base) const { + const index* index_bases) const { + BOOST_ASSERT(idx - index_bases[0] >= 0); + BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]); // return a sub_array proxy object TPtr newbase = base + idx * strides[0]; - return Reference(newbase,extents+1,strides+1,index_base+1); + return Reference(newbase,extents+1,strides+1,index_bases+1); } @@ -165,9 +168,14 @@ protected: // used by array operator[] and iterators to get reference types. template Reference access(boost::type,index idx,TPtr base, - const size_type*, + const size_type* extents, const index* strides, - const index*) const { + const index* index_bases) const { + + ignore_unused_variable_warning(index_bases); + ignore_unused_variable_warning(extents); + BOOST_ASSERT(idx - index_bases[0] >= 0); + BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]); return *(base + idx * strides[0]); } @@ -201,7 +209,7 @@ struct value_accessor_generator { >::type type; }; -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) struct eti_value_accessor { @@ -251,7 +259,7 @@ struct associated_types template class multi_array_impl_base : -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) public mpl::aux::msvc_eti_base< typename value_accessor_generator >::type >::type @@ -307,9 +315,22 @@ protected: // Used by operator() in our array classes template - Reference access_element(boost::type, TPtr base, + Reference access_element(boost::type, const IndexList& indices, - const index* strides) const { + TPtr base, + const size_type* extents, + const index* strides, + const index* index_bases) const { + + ignore_unused_variable_warning(index_bases); + ignore_unused_variable_warning(extents); +#if !defined(NDEBUG) && !defined(BOOST_DISABLE_ASSERTS) + for (size_type i = 0; i != NumDims; ++i) { + BOOST_ASSERT(indices[i] - index_bases[i] >= 0); + BOOST_ASSERT(size_type(indices[i] - index_bases[i]) < extents[i]); + } +#endif + index offset = 0; for (size_type n = 0; n != NumDims; ++n) offset += indices[n] * strides[n]; @@ -418,6 +439,12 @@ protected: index index_factor = current_range.stride(); index len = (finish - start + (index_factor - 1)) / index_factor; + BOOST_ASSERT(index_bases[n] <= start && + start <= index_bases[n]+index(extents[n])); + BOOST_ASSERT(index_bases[n] <= finish && + finish <= index_bases[n]+index(extents[n])); + BOOST_ASSERT(index_factor > 0); + // the array data pointer is modified to account for non-zero // bases during slicing (see [Garcia] for the math involved) offset += start * strides[n]; @@ -433,7 +460,7 @@ protected: ++dim; } } - assert (dim == NDims); + BOOST_ASSERT(dim == NDims); return ArrayRef(base+offset, diff --git a/boost/boost/multi_array/extent_gen.hpp b/boost/boost/multi_array/extent_gen.hpp index 0b4183ff11..b009f66fd0 100644 --- a/boost/boost/multi_array/extent_gen.hpp +++ b/boost/boost/multi_array/extent_gen.hpp @@ -29,8 +29,8 @@ class extent_gen { public: typedef boost::detail::multi_array::index index; typedef boost::detail::multi_array::size_type size_type; -private: typedef extent_range range; +private: typedef typename range_list_generator::type range_list; public: template diff --git a/boost/boost/multi_array/index_gen.hpp b/boost/boost/multi_array/index_gen.hpp index 78b649a313..da8e1fdda7 100644 --- a/boost/boost/multi_array/index_gen.hpp +++ b/boost/boost/multi_array/index_gen.hpp @@ -28,9 +28,9 @@ namespace multi_array { template struct index_gen { private: - typedef ::boost::detail::multi_array::index Index; - typedef std::size_t SizeType; - typedef index_range range; + typedef ::boost::detail::multi_array::index index; + typedef ::boost::detail::multi_array::size_type size_type; + typedef index_range range; public: template struct gen_type { @@ -44,27 +44,27 @@ public: template explicit index_gen(const index_gen& rhs, - const index_range& range) + const range& r) { std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin()); - *ranges_.rbegin() = range; + *ranges_.rbegin() = r; } index_gen - operator[](const index_range& range) const + operator[](const range& r) const { index_gen tmp; std::copy(ranges_.begin(),ranges_.end(),tmp.ranges_.begin()); - *tmp.ranges_.rbegin() = range; + *tmp.ranges_.rbegin() = r; return tmp; } index_gen - operator[](Index idx) const + operator[](index idx) const { index_gen tmp; std::copy(ranges_.begin(),ranges_.end(),tmp.ranges_.begin()); - *tmp.ranges_.rbegin() = index_range(idx); + *tmp.ranges_.rbegin() = range(idx); return tmp; } diff --git a/boost/boost/multi_array/index_range.hpp b/boost/boost/multi_array/index_range.hpp index 2eb0f68d3a..3d6035e744 100644 --- a/boost/boost/multi_array/index_range.hpp +++ b/boost/boost/multi_array/index_range.hpp @@ -35,6 +35,15 @@ namespace multi_array { typedef Index index; typedef SizeType size_type; + private: + static index from_start() + { return (std::numeric_limits::min)(); } + + static index to_end() + { return (std::numeric_limits::max)(); } + + public: + index_range() { start_ = from_start(); @@ -46,7 +55,7 @@ namespace multi_array { explicit index_range(index pos) { start_ = pos; - finish_ = pos; + finish_ = pos+1; stride_ = 1; degenerate_ = true; } @@ -60,13 +69,13 @@ namespace multi_array { // These are for chaining assignments to an index_range index_range& start(index s) { start_ = s; - degenerate_ = (start_ == finish_); + degenerate_ = false; return *this; } index_range& finish(index f) { finish_ = f; - degenerate_ = (start_ == finish_); + degenerate_ = false; return *this; } @@ -77,7 +86,7 @@ namespace multi_array { return start_; } - index get_start(index low_index_range = 0) const + index get_start(index low_index_range = index_range::from_start()) const { if (start_ == from_start()) return low_index_range; @@ -89,28 +98,15 @@ namespace multi_array { return finish_; } - index get_finish(index high_index_range = 0) const + index get_finish(index high_index_range = index_range::to_end()) const { if (finish_ == to_end()) return high_index_range; return finish_; } - size_type size(index recommended_length = 0) const - { - if ((start_ == from_start()) || (finish_ == to_end())) - return recommended_length; - else - return (finish_ - start_) / stride_; - } - index stride() const { return stride_; } - bool is_ascending_contiguous() const - { - return (start_ < finish_) && is_unit_stride(); - } - void set_index_range(index start, index finish, index stride=1) { start_ = start; @@ -121,9 +117,6 @@ namespace multi_array { static index_range all() { return index_range(from_start(), to_end(), 1); } - bool is_unit_stride() const - { return stride_ == 1; } - bool is_degenerate() const { return degenerate_; } index_range operator-(index shift) const @@ -148,12 +141,6 @@ namespace multi_array { // add conversion to std::slice? - private: - static index from_start() - { return (std::numeric_limits::min)(); } - - static index to_end() - { return (std::numeric_limits::max)(); } public: index start_, finish_, stride_; bool degenerate_; diff --git a/boost/boost/multi_array/iterator.hpp b/boost/boost/multi_array/iterator.hpp index 756bb8645c..59e7724f55 100644 --- a/boost/boost/multi_array/iterator.hpp +++ b/boost/boost/multi_array/iterator.hpp @@ -21,6 +21,7 @@ #include "boost/multi_array/base.hpp" #include "boost/iterator/iterator_facade.hpp" #include "boost/mpl/aux_/msvc_eti_base.hpp" +#include #include #include @@ -56,11 +57,11 @@ class array_iterator , Reference > , private -#if BOOST_WORKAROUND(BOOST_MSVC,==1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) mpl::aux::msvc_eti_base::type -#if BOOST_WORKAROUND(BOOST_MSVC,==1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) >::type #endif { @@ -137,11 +138,15 @@ public: template bool equal(IteratorAdaptor& rhs) const { + const std::size_t N = NumDims::value; return (idx_ == rhs.idx_) && (base_ == rhs.base_) && - (extents_ == rhs.extents_) && - (strides_ == rhs.strides_) && - (index_base_ == rhs.index_base_); + ( (extents_ == rhs.extents_) || + std::equal(extents_,extents_+N,rhs.extents_) ) && + ( (strides_ == rhs.strides_) || + std::equal(strides_,strides_+N,rhs.strides_) ) && + ( (index_base_ == rhs.index_base_) || + std::equal(index_base_,index_base_+N,rhs.index_base_) ); } template diff --git a/boost/boost/multi_array/multi_array_ref.hpp b/boost/boost/multi_array/multi_array_ref.hpp index 08cf8668b8..41b962a8eb 100644 --- a/boost/boost/multi_array/multi_array_ref.hpp +++ b/boost/boost/multi_array/multi_array_ref.hpp @@ -25,6 +25,7 @@ #include "boost/multi_array/subarray.hpp" #include "boost/multi_array/view.hpp" #include "boost/multi_array/algorithm.hpp" +#include "boost/type_traits/is_integral.hpp" #include "boost/array.hpp" #include "boost/concept_check.hpp" #include "boost/functional.hpp" @@ -137,7 +138,13 @@ public: } template - void reindex(const BaseList& values) { +#ifdef BOOST_NO_SFINAE + void +#else + typename + disable_if::type,void >::type +#endif // BOOST_NO_SFINAE + reindex(const BaseList& values) { boost::function_requires< detail::multi_array::CollectionConcept >(); boost::detail::multi_array:: @@ -206,8 +213,8 @@ public: boost::function_requires< detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,strides()); + indices,origin(), + shape(),strides(),index_bases()); } // Only allow const element access @@ -503,11 +510,12 @@ public: template element& operator()(const IndexList& indices) { - boost::function_requires< - detail::multi_array::CollectionConcept >(); - return super_type::access_element(boost::type(), - origin(), - indices,this->strides()); + boost::function_requires< + detail::multi_array::CollectionConcept >(); + return super_type::access_element(boost::type(), + indices,origin(), + this->shape(),this->strides(), + this->index_bases()); } diff --git a/boost/boost/multi_array/subarray.hpp b/boost/boost/multi_array/subarray.hpp index 3784f48e3f..359d00e951 100644 --- a/boost/boost/multi_array/subarray.hpp +++ b/boost/boost/multi_array/subarray.hpp @@ -79,9 +79,11 @@ public: template const element& operator()(const IndexList& indices) const { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,strides()); + indices,origin(), + shape(),strides(),index_bases()); } // see generate_array_view in base.hpp @@ -284,9 +286,12 @@ public: template element& operator()(const IndexList& indices) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,this->strides()); + indices,origin(), + this->shape(),this->strides(), + this->index_bases()); } iterator begin() { @@ -316,6 +321,8 @@ public: template const element& operator()(const IndexList& indices) const { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::operator()(indices); } diff --git a/boost/boost/multi_array/types.hpp b/boost/boost/multi_array/types.hpp index ceb452f488..5ef173b623 100644 --- a/boost/boost/multi_array/types.hpp +++ b/boost/boost/multi_array/types.hpp @@ -26,7 +26,7 @@ namespace multi_array{ // needed typedefs typedef std::size_t size_type; -typedef int index; +typedef std::ptrdiff_t index; } // namespace multi_array } // namespace detail diff --git a/boost/boost/multi_array/view.hpp b/boost/boost/multi_array/view.hpp index 1744cb3b28..067fb02098 100644 --- a/boost/boost/multi_array/view.hpp +++ b/boost/boost/multi_array/view.hpp @@ -23,6 +23,7 @@ #include "boost/multi_array/storage_order.hpp" #include "boost/multi_array/subarray.hpp" #include "boost/multi_array/algorithm.hpp" +#include "boost/type_traits/is_integral.hpp" #include "boost/array.hpp" #include "boost/limits.hpp" #include @@ -72,7 +73,15 @@ public: template - void reindex(const BaseList& values) { +#ifdef BOOST_NO_SFINAE + void +#else + typename + disable_if::type,void >::type +#endif + reindex(const BaseList& values) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); boost::detail::multi_array:: copy_n(values.begin(),num_dimensions(),index_base_list_.begin()); origin_offset_ = @@ -109,9 +118,11 @@ public: template const element& operator()(IndexList indices) const { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,strides()); + indices,origin(), + shape(),strides(),index_bases()); } // Only allow const element access @@ -318,9 +329,12 @@ public: template element& operator()(const IndexList& indices) { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::access_element(boost::type(), - origin(), - indices,this->strides()); + indices,origin(), + this->shape(),this->strides(), + this->index_bases()); } @@ -379,6 +393,8 @@ public: template const element& operator()(const IndexList& indices) const { + boost::function_requires< + detail::multi_array::CollectionConcept >(); return super_type::operator()(indices); } diff --git a/boost/boost/optional/optional.hpp b/boost/boost/optional/optional.hpp index 8ef2e31f5d..4421f4aa63 100644 --- a/boost/boost/optional/optional.hpp +++ b/boost/boost/optional/optional.hpp @@ -66,7 +66,7 @@ #endif #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ - && BOOST_WORKAROUND(__BORLANDC__, <= 0x564) + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581) ) // BCB (up to 5.64) has the following bug: // If there is a member function/operator template of the form // template mfunc( Expr expr ) ; @@ -133,7 +133,11 @@ class optional_base : public optional_tag { private : - typedef BOOST_DEDUCED_TYPENAME detail::make_reference_content::type internal_type ; + typedef +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + BOOST_DEDUCED_TYPENAME +#endif + ::boost::detail::make_reference_content::type internal_type ; typedef aligned_storage storage_type ; @@ -401,7 +405,7 @@ class optional_base : public optional_tag reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } #else void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; } diff --git a/boost/boost/preprocessor/config/config.hpp b/boost/boost/preprocessor/config/config.hpp index 06b3c5a6e1..ab1f6384a1 100644 --- a/boost/boost/preprocessor/config/config.hpp +++ b/boost/boost/preprocessor/config/config.hpp @@ -24,7 +24,11 @@ # define BOOST_PP_CONFIG_DMC() 0x0040 # # ifndef BOOST_PP_CONFIG_FLAGS -# if defined(__SPIRIT_PP__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200 +# if defined(__GCCXML__) +# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) +# elif defined(__WAVE__) +# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) +# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200 # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) # elif defined(__EDG__) || defined(__EDG_VERSION__) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) @@ -32,6 +36,8 @@ # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MWCC()) # elif defined(__DMC__) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_DMC()) +# elif defined(__BORLANDC__) && __BORLANDC__ >= 0x581 +# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) # elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_BCC()) # elif defined(_MSC_VER) diff --git a/boost/boost/preprocessor/stringize.hpp b/boost/boost/preprocessor/stringize.hpp index 01f283e852..64dd5fde3e 100644 --- a/boost/boost/preprocessor/stringize.hpp +++ b/boost/boost/preprocessor/stringize.hpp @@ -20,8 +20,7 @@ # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text)) -# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_B ## (arg) -# define BOOST_PP_STRINGIZE_B(arg) BOOST_PP_STRINGIZE_I ## arg +# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_I arg # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text)) # define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par diff --git a/boost/boost/range/begin.hpp b/boost/boost/range/begin.hpp index 57ee344517..d16ce1e2f8 100644 --- a/boost/boost/range/begin.hpp +++ b/boost/boost/range/begin.hpp @@ -190,7 +190,7 @@ namespace boost inline BOOST_DEDUCED_TYPENAME range_const_iterator::type const_begin( const T& r ) { - return begin( r ); + return boost::begin( r ); } } diff --git a/boost/boost/range/config.hpp b/boost/boost/range/config.hpp index 63f9078a53..5f856bbb02 100644 --- a/boost/boost/range/config.hpp +++ b/boost/boost/range/config.hpp @@ -37,7 +37,7 @@ #error "macro already defined!" #endif -//#if BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) || __MWERKS__ <= 0x3003 +//#if BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) || __MWERKS__ <= 0x3003 #if _MSC_VER <= 1300 && !defined( __COMO__ ) && !defined( __GNUC__ ) && __MWERKS__ <= 0x3003 #define BOOST_RANGE_NO_ARRAY_SUPPORT 1 #endif diff --git a/boost/boost/range/detail/common.hpp b/boost/boost/range/detail/common.hpp index 38ef7c8293..36fada16eb 100644 --- a/boost/boost/range/detail/common.hpp +++ b/boost/boost/range/detail/common.hpp @@ -78,35 +78,35 @@ namespace boost template< typename C > class range { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_pair_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_pair_, boost::range_detail::std_pair_, void >::type pair_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_array_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_array_, boost::range_detail::array_, pair_t >::type array_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_string_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_string_, boost::range_detail::string_, array_t >::type string_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_const_char_ptr_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_char_ptr_, boost::range_detail::const_char_ptr_, string_t >::type const_char_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_char_ptr_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_ptr_, boost::range_detail::char_ptr_, const_char_ptr_t >::type char_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_const_wchar_t_ptr_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_wchar_t_ptr_, boost::range_detail::const_wchar_t_ptr_, char_ptr_t >::type const_wchar_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_wchar_t_ptr_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_ptr_, boost::range_detail::wchar_t_ptr_, const_wchar_ptr_t >::type wchar_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_wchar_t_array_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_array_, boost::range_detail::wchar_t_array_, wchar_ptr_t >::type wchar_array_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::range_detail::range_helper::is_char_array_, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_array_, boost::range_detail::char_array_, wchar_array_t >::type char_array_t; public: - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< boost::is_void::value, + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::is_void::value, boost::range_detail::std_container_, char_array_t >::type type; }; // class 'range' diff --git a/boost/boost/range/detail/implementation_help.hpp b/boost/boost/range/detail/implementation_help.hpp index 4db8be4183..77cc8ccb2f 100644 --- a/boost/boost/range/detail/implementation_help.hpp +++ b/boost/boost/range/detail/implementation_help.hpp @@ -54,7 +54,7 @@ namespace boost template< class Char > inline Char* str_end( Char* s ) { - return (Char*)str_end( s, s ); + return const_cast( str_end( s, s ) ); } template< class T, std::size_t sz > diff --git a/boost/boost/range/end.hpp b/boost/boost/range/end.hpp index f7eb2f8725..493208f636 100644 --- a/boost/boost/range/end.hpp +++ b/boost/boost/range/end.hpp @@ -194,7 +194,7 @@ namespace boost inline BOOST_DEDUCED_TYPENAME range_const_iterator::type const_end( const T& r ) { - return end( r ); + return boost::end( r ); } } diff --git a/boost/boost/range/iterator_range.hpp b/boost/boost/range/iterator_range.hpp index 75727a1c85..bd77ffaff2 100644 --- a/boost/boost/range/iterator_range.hpp +++ b/boost/boost/range/iterator_range.hpp @@ -57,15 +57,13 @@ namespace boost template< class ForwardRange > static IteratorT adl_begin( ForwardRange& r ) { - using boost::begin; - return IteratorT( begin( r ) ); + return IteratorT( boost::begin( r ) ); } template< class ForwardRange > static IteratorT adl_end( ForwardRange& r ) { - using boost::end; - return IteratorT( end( r ) ); + return IteratorT( boost::end( r ) ); } }; @@ -74,23 +72,23 @@ namespace boost { typedef BOOST_DEDUCED_TYPENAME boost::range_size::type sz_type; - sz_type l_size = size( l ), - r_size = size( r ); + sz_type l_size = boost::size( l ), + r_size = boost::size( r ); if( l_size != r_size ) return false; - return std::equal( begin(l), end(l), - begin(r) ); + return std::equal( boost::begin(l), boost::end(l), + boost::begin(r) ); } template< class Left, class Right > inline bool less_than( const Left& l, const Right& r ) { - return std::lexicographical_compare( begin(l), - end(l), - begin(r), - end(r) ); + return std::lexicographical_compare( boost::begin(l), + boost::end(l), + boost::begin(r), + boost::end(r) ); } struct range_tag { }; @@ -142,6 +140,14 @@ namespace boost //! This type typedef iterator_range this_type; + + //! Refence type + // + // Needed because value-type is the same for + // const and non-const iterators + // + typedef BOOST_DEDUCED_TYPENAME + iterator_reference::type reference; //! const_iterator type /*! @@ -255,8 +261,12 @@ namespace boost { if( singular ) return 0; - + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + return std::distance( m_Begin, m_End ); +#else return std::distance( m_Begin, m_End ); +#endif } bool empty() const @@ -306,26 +316,38 @@ namespace boost #endif public: // convenience - value_type& front() const + reference front() const { BOOST_ASSERT( !empty() ); return *m_Begin; } - value_type& back() const + reference back() const { BOOST_ASSERT( !empty() ); IteratorT last( m_End ); return *--last; } - value_type& operator[]( size_type sz ) const + reference operator[]( size_type sz ) const { //BOOST_STATIC_ASSERT( is_random_access ); BOOST_ASSERT( sz < size() ); return m_Begin[sz]; } - + + iterator_range& advance_begin( difference_type n ) + { + std::advance( m_Begin, n ); + return *this; + } + + iterator_range& advance_end( difference_type n ) + { + std::advance( m_End, n ); + return *this; + } + private: // begin and end iterators IteratorT m_Begin; @@ -360,7 +382,10 @@ namespace boost std::basic_ostream& Os, const iterator_range& r ) { - std::copy( r.begin(), r.end(), std::ostream_iterator(Os)); + std::copy( r.begin(), r.end(), + std::ostream_iterator< BOOST_DEDUCED_TYPENAME + iterator_value::type, + Elem, Traits>(Os) ); return Os; } @@ -479,7 +504,7 @@ namespace boost make_iterator_range( Range& r ) { return iterator_range< BOOST_DEDUCED_TYPENAME range_result_iterator::type > - ( begin( r ), end( r ) ); + ( boost::begin( r ), boost::end( r ) ); } #else @@ -518,8 +543,8 @@ namespace boost return make_iterator_range( r ); BOOST_DEDUCED_TYPENAME range_result_iterator::type - new_begin = begin( r ), - new_end = end( r ); + new_begin = boost::begin( r ), + new_end = boost::end( r ); std::advance( new_begin, advance_begin ); std::advance( new_end, advance_end ); return make_iterator_range( new_begin, new_end ); @@ -573,7 +598,7 @@ namespace boost template< typename SeqT, typename Range > inline SeqT copy_range( const Range& r ) { - return SeqT( begin( r ), end( r ) ); + return SeqT( boost::begin( r ), boost::end( r ) ); } } // namespace 'boost' diff --git a/boost/boost/range/rbegin.hpp b/boost/boost/range/rbegin.hpp index f87717ad12..0fcf00c931 100644 --- a/boost/boost/range/rbegin.hpp +++ b/boost/boost/range/rbegin.hpp @@ -42,7 +42,7 @@ rbegin( C& c ) typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< typename remove_const::type >::type iter_type; - return iter_type( end( c ) ); + return iter_type( boost::end( c ) ); } template< class C > @@ -51,7 +51,7 @@ rbegin( const C& c ) { typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type iter_type; - return iter_type( end( c ) ); + return iter_type( boost::end( c ) ); } #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING @@ -60,7 +60,7 @@ template< class T > inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type const_rbegin( const T& r ) { - return rbegin( r ); + return boost::rbegin( r ); } } // namespace 'boost' diff --git a/boost/boost/range/rend.hpp b/boost/boost/range/rend.hpp index e654c606ac..3e91ff7196 100644 --- a/boost/boost/range/rend.hpp +++ b/boost/boost/range/rend.hpp @@ -29,7 +29,7 @@ template< class C > inline BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type rend( C& c ) { - return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type( begin( c ) ); + return BOOST_DEDUCED_TYPENAME range_reverse_result_iterator::type( boost::begin( c ) ); } #else @@ -42,7 +42,7 @@ rend( C& c ) typedef BOOST_DEDUCED_TYPENAME range_reverse_iterator< typename remove_const::type >::type iter_type; - return iter_type( begin( c ) ); + return iter_type( boost::begin( c ) ); } template< class C > @@ -51,7 +51,7 @@ rend( const C& c ) { typedef BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type iter_type; - return iter_type( begin( c ) ); + return iter_type( boost::begin( c ) ); } #endif @@ -60,7 +60,7 @@ template< class T > inline BOOST_DEDUCED_TYPENAME range_const_reverse_iterator::type const_rend( const T& r ) { - return rend( r ); + return boost::rend( r ); } } // namespace 'boost' diff --git a/boost/boost/rational.hpp b/boost/boost/rational.hpp index 1d969abeda..c53bc41859 100644 --- a/boost/boost/rational.hpp +++ b/boost/boost/rational.hpp @@ -17,6 +17,7 @@ // Nickolay Mladenov, for the implementation of operator+= // Revision History +// 27 Dec 05 Add Boolean conversion operator (Daryle Walker) // 28 Sep 02 Use _left versions of operators from operators.hpp // 05 Jul 01 Recode gcd(), avoiding std::swap (Helmut Zeisel) // 03 Mar 01 Workarounds for Intel C++ 5.0 (David Abrahams) @@ -129,6 +130,10 @@ class rational : > > > > > > > > > > > > > > > > { typedef typename boost::call_traits::param_type param_type; + + struct helper { IntType parts[2]; }; + typedef IntType (helper::* bool_type)[2]; + public: typedef IntType int_type; rational() : num(0), den(1) {} @@ -165,6 +170,9 @@ public: // Operator not bool operator!() const { return !num; } + // Boolean conversion + operator bool_type() const { return operator !() ? 0 : &helper::parts; } + // Comparison operators bool operator< (const rational& r) const; bool operator== (const rational& r) const; diff --git a/boost/boost/ref.hpp b/boost/boost/ref.hpp index 3745e7ca0f..ab09ae7412 100644 --- a/boost/boost/ref.hpp +++ b/boost/boost/ref.hpp @@ -10,6 +10,7 @@ #include #include #include +#include // // ref.hpp - ref/cref, useful helper functions @@ -33,7 +34,7 @@ template class reference_wrapper public: typedef T type; -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) explicit reference_wrapper(T& t): t_(&t) {} @@ -54,7 +55,7 @@ private: T* t_; }; -# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x570) +# if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) # define BOOST_REF_CONST # else # define BOOST_REF_CONST const diff --git a/boost/boost/regex/config.hpp b/boost/boost/regex/config.hpp index 3b78bddaa3..0e229f5070 100644 --- a/boost/boost/regex/config.hpp +++ b/boost/boost/regex/config.hpp @@ -205,7 +205,7 @@ ****************************************************************************/ #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS) -#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) +#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) # define BOOST_REGEX_CALL __cdecl #else # define BOOST_REGEX_CALL __fastcall diff --git a/boost/boost/regex/pending/object_cache.hpp b/boost/boost/regex/pending/object_cache.hpp index 561b08e875..8bac298aae 100644 --- a/boost/boost/regex/pending/object_cache.hpp +++ b/boost/boost/regex/pending/object_cache.hpp @@ -83,7 +83,7 @@ template boost::shared_ptr object_cache::do_get(const Key& k, size_type max_cache_size) { typedef typename object_cache::data object_data; - typedef typename list_type::size_type list_size_type; + typedef typename map_type::size_type map_size_type; static object_data s_data; // @@ -122,7 +122,7 @@ boost::shared_ptr object_cache::do_get(const Key& k, size_t s_data.cont.push_back(value_type(result, 0)); s_data.index.insert(std::make_pair(k, --(s_data.cont.end()))); s_data.cont.back().second = &(s_data.index.find(k)->first); - list_size_type s = s_data.cont.size(); + map_size_type s = s_data.index.size(); BOOST_ASSERT(s_data.index[k]->first.get() == result.get()); BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second); BOOST_ASSERT(s_data.index.find(k)->first == k); diff --git a/boost/boost/regex/v4/basic_regex.hpp b/boost/boost/regex/v4/basic_regex.hpp index 4d1aef27e6..851f9e84ee 100644 --- a/boost/boost/regex/v4/basic_regex.hpp +++ b/boost/boost/regex/v4/basic_regex.hpp @@ -66,6 +66,7 @@ struct regex_data unsigned char m_startmap[1 << CHAR_BIT]; // which characters can start a match unsigned int m_can_be_null; // whether we can match a null string re_detail::raw_storage m_data; // the buffer in which our states are constructed + typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character }; // // class basic_regex_implementation diff --git a/boost/boost/regex/v4/basic_regex_creator.hpp b/boost/boost/regex/v4/basic_regex_creator.hpp index a45b382c0e..22a2377550 100644 --- a/boost/boost/regex/v4/basic_regex_creator.hpp +++ b/boost/boost/regex/v4/basic_regex_creator.hpp @@ -194,10 +194,10 @@ public: { return static_cast(static_cast(static_cast(base) + off)); } - void init(unsigned flags) + void init(unsigned l_flags) { - m_pdata->m_flags = flags; - m_icase = flags & regex_constants::icase; + m_pdata->m_flags = l_flags; + m_icase = l_flags & regex_constants::icase; } regbase::flag_type flags() { @@ -265,6 +265,7 @@ basic_regex_creator::basic_regex_creator(regex_datam_word_mask = m_word_mask; BOOST_ASSERT(m_word_mask != 0); BOOST_ASSERT(m_mask_space != 0); BOOST_ASSERT(m_lower_mask != 0); @@ -571,9 +572,10 @@ re_syntax_base* basic_regex_creator::append_set( // Oops error: return 0; } + BOOST_ASSERT(c3[1] == charT(0)); for(unsigned i = 0; i < (1u << CHAR_BIT); ++i) { - charT c3[2] = { static_cast(i), charT(0), }; + c3[0] = static_cast(i); string_type s3 = this->m_traits.transform(c3, c3 +1); if((s1 <= s3) && (s3 <= s2)) result->_map[i] = true; @@ -795,6 +797,7 @@ void basic_regex_creator::create_startmaps(re_syntax_base* state) v.pop_back(); // Build maps: + m_bad_repeats = 0; create_startmap(state->next.p, static_cast(state)->_map, &static_cast(state)->can_be_null, mask_take); m_bad_repeats = 0; create_startmap(static_cast(state)->alt.p, static_cast(state)->_map, &static_cast(state)->can_be_null, mask_skip); @@ -1062,6 +1065,8 @@ void basic_regex_creator::create_startmap(re_syntax_base* state, if(is_bad_repeat(state)) { set_all_masks(l_map, mask); + if(pnull) + *pnull |= mask; return; } set_bad_repeat(state); @@ -1180,7 +1185,8 @@ bool basic_regex_creator::is_bad_repeat(re_syntax_base* pt) unsigned id = static_cast(pt)->id; if(id > sizeof(m_bad_repeats) * CHAR_BIT) return true; // run out of bits, assume we can't traverse this one. - return m_bad_repeats & static_cast(1uL << id); + static const boost::uintmax_t one = 1uL; + return m_bad_repeats & (one << id); } default: return false; @@ -1199,8 +1205,9 @@ void basic_regex_creator::set_bad_repeat(re_syntax_base* pt) case syntax_element_long_set_rep: { unsigned id = static_cast(pt)->id; + static const boost::uintmax_t one = 1uL; if(id <= sizeof(m_bad_repeats) * CHAR_BIT) - m_bad_repeats |= static_cast(1uL << id); + m_bad_repeats |= (one << id); } default: break; diff --git a/boost/boost/regex/v4/basic_regex_parser.hpp b/boost/boost/regex/v4/basic_regex_parser.hpp index 41ec0f330c..5010275162 100644 --- a/boost/boost/regex/v4/basic_regex_parser.hpp +++ b/boost/boost/regex/v4/basic_regex_parser.hpp @@ -3,8 +3,8 @@ * Copyright (c) 2004 * John Maddock * - * Use, modification and distribution are subject to the - * Boost Software License, Version 1.0. (See accompanying file + * 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) * */ @@ -94,10 +94,10 @@ basic_regex_parser::basic_regex_parser(regex_data* } template -void basic_regex_parser::parse(const charT* p1, const charT* p2, unsigned flags) +void basic_regex_parser::parse(const charT* p1, const charT* p2, unsigned l_flags) { - // pass flags on to base class: - this->init(flags); + // pass l_flags on to base class: + this->init(l_flags); // set up pointers: m_position = m_base = p1; m_end = p2; @@ -108,7 +108,7 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2, return; } // select which parser to use: - switch(flags & regbase::main_option_type) + switch(l_flags & regbase::main_option_type) { case regbase::perl_syntax_group: m_parser_proc = &basic_regex_parser::parse_extended; @@ -127,8 +127,8 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2, // Unwind our alternatives: // unwind_alts(-1); - // reset flags as a global scope (?imsx) may have altered them: - this->flags(flags); + // reset l_flags as a global scope (?imsx) may have altered them: + this->flags(l_flags); // if we haven't gobbled up all the characters then we must // have had an unexpected ')' : if(!result) @@ -291,7 +291,7 @@ bool basic_regex_parser::parse_extended() // If we have a mod_x flag set, then skip until // we get to a newline character: // - if((this->flags() + if((this->flags() & (regbase::no_perl_ex|regbase::mod_x)) == regbase::mod_x) { @@ -315,8 +315,8 @@ bool basic_regex_parser::parse_literal() // append this as a literal provided it's not a space character // or the perl option regbase::mod_x is not set: if( - ((this->flags() - & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) + ((this->flags() + & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) != regbase::mod_x) || !this->m_traits.isctype(*m_position, this->m_mask_space)) this->append_literal(*m_position); @@ -698,8 +698,8 @@ bool basic_regex_parser::parse_match_any() ++m_position; static_cast( this->append_state(syntax_element_wild, sizeof(re_dot)) - )->mask = static_cast(this->flags() & regbase::no_mod_s - ? re_detail::force_not_newline + )->mask = static_cast(this->flags() & regbase::no_mod_s + ? re_detail::force_not_newline : this->flags() & regbase::mod_s ? re_detail::force_newline : re_detail::dont_care); return true; @@ -710,10 +710,10 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ { bool greedy = true; std::size_t insert_point; - // + // // when we get to here we may have a non-greedy ? mark still to come: // - if((m_position != m_end) + if((m_position != m_end) && ( (0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) || ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex))) @@ -889,7 +889,7 @@ bool basic_regex_parser::parse_repeat_range(bool isbasic) // if(min > max) { - fail(regex_constants::error_range, this->m_position - this->m_base); + fail(regex_constants::error_badbrace, this->m_position - this->m_base); return false; } return parse_repeat(min, max); @@ -909,7 +909,7 @@ bool basic_regex_parser::parse_alt() } ++m_position; // - // we need to append a trailing jump: + // we need to append a trailing jump: // re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump)); std::ptrdiff_t jump_offset = this->getoffset(pj); @@ -995,7 +995,7 @@ bool basic_regex_parser::parse_set() return true; case regex_constants::syntax_escape: { - // + // // look ahead and see if this is a character class shortcut // \d \w \s etc... // @@ -1061,7 +1061,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setflags() & (regbase::main_option_type | regbase::no_char_classes)) + if((this->flags() & (regbase::main_option_type | regbase::no_char_classes)) == (regbase::basic_syntax_group | regbase::no_char_classes)) { --m_position; @@ -1081,8 +1081,8 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1090,7 +1090,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base); @@ -1113,18 +1113,18 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) + if( (m_position != m_end) + && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set)) { - if(this->m_traits.escape_syntax_type(*name_first) + if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_left_word) { ++m_position; this->append_state(syntax_element_word_start); return false; } - if(this->m_traits.escape_syntax_type(*name_first) + if(this->m_traits.escape_syntax_type(*name_first) == regex_constants::escape_type_right_word) { ++m_position; @@ -1158,8 +1158,8 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1167,7 +1167,7 @@ bool basic_regex_parser::parse_inner_set(basic_char_setm_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_brack, m_position - m_base); @@ -1220,17 +1220,17 @@ void basic_regex_parser::parse_set_literal(basic_char_setm_traits.syntax_type(*m_position) == regex_constants::syntax_dash) { - if(m_end == ++m_position) - { - fail(regex_constants::error_brack, m_position - m_base); - return; - } - if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) - { + if(m_end == ++m_position) + { + fail(regex_constants::error_brack, m_position - m_base); + return; + } + if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) + { // trailing - : --m_position; return; - } + } fail(regex_constants::error_range, m_position - m_base); return; } @@ -1244,7 +1244,6 @@ void basic_regex_parser::parse_set_literal(basic_char_set digraph basic_regex_parser::get_next_set_literal(basic_char_set& char_set) { - typedef typename traits::string_type string_type; digraph result; switch(this->m_traits.syntax_type(*m_position)) { @@ -1297,8 +1296,8 @@ digraph basic_regex_parser::get_next_set_literal(basic_cha fail(regex_constants::error_collate, name_first - m_base); return result; } - while((m_position != m_end) - && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) + while((m_position != m_end) + && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) ++m_position; const charT* name_last = m_position; if(m_end == m_position) @@ -1306,7 +1305,7 @@ digraph basic_regex_parser::get_next_set_literal(basic_cha fail(regex_constants::error_collate, name_first - m_base); return result; } - if((m_end == ++m_position) + if((m_end == ++m_position) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) { fail(regex_constants::error_collate, name_first - m_base); @@ -1462,7 +1461,7 @@ charT basic_regex_parser::unescape_character() return result; } val = this->m_traits.toi(m_position, m_position + len, 8); - if(val < 0) + if(val < 0) { fail(regex_constants::error_escape, m_position - m_base); return result; @@ -1556,14 +1555,14 @@ bool basic_regex_parser::parse_QE() const charT* end; do { - while((m_position != m_end) + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape)) ++m_position; if(m_position == m_end) { // a \Q...\E sequence may terminate with the end of the expression: end = m_position; - break; + break; } if(++m_position == m_end) // skip the escape { @@ -1608,9 +1607,9 @@ bool basic_regex_parser::parse_perl_extension() // if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash) { - while((m_position != m_end) + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) - {} + {} return true; } // @@ -1908,44 +1907,44 @@ bool basic_regex_parser::add_emacs_code(bool negate) char_set.add_class(this->m_word_mask); break; case '_': - char_set.add_single(digraph(charT('$'))); - char_set.add_single(digraph(charT('&'))); - char_set.add_single(digraph(charT('*'))); - char_set.add_single(digraph(charT('+'))); - char_set.add_single(digraph(charT('-'))); - char_set.add_single(digraph(charT('_'))); - char_set.add_single(digraph(charT('<'))); - char_set.add_single(digraph(charT('>'))); + char_set.add_single(digraph(charT('$'))); + char_set.add_single(digraph(charT('&'))); + char_set.add_single(digraph(charT('*'))); + char_set.add_single(digraph(charT('+'))); + char_set.add_single(digraph(charT('-'))); + char_set.add_single(digraph(charT('_'))); + char_set.add_single(digraph(charT('<'))); + char_set.add_single(digraph(charT('>'))); break; case '.': char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5)); break; case '(': - char_set.add_single(digraph(charT('('))); - char_set.add_single(digraph(charT('['))); - char_set.add_single(digraph(charT('{'))); + char_set.add_single(digraph(charT('('))); + char_set.add_single(digraph(charT('['))); + char_set.add_single(digraph(charT('{'))); break; case ')': - char_set.add_single(digraph(charT(')'))); - char_set.add_single(digraph(charT(']'))); - char_set.add_single(digraph(charT('}'))); + char_set.add_single(digraph(charT(')'))); + char_set.add_single(digraph(charT(']'))); + char_set.add_single(digraph(charT('}'))); break; case '"': - char_set.add_single(digraph(charT('"'))); - char_set.add_single(digraph(charT('\''))); - char_set.add_single(digraph(charT('`'))); + char_set.add_single(digraph(charT('"'))); + char_set.add_single(digraph(charT('\''))); + char_set.add_single(digraph(charT('`'))); break; case '\'': - char_set.add_single(digraph(charT('\''))); - char_set.add_single(digraph(charT(','))); - char_set.add_single(digraph(charT('#'))); + char_set.add_single(digraph(charT('\''))); + char_set.add_single(digraph(charT(','))); + char_set.add_single(digraph(charT('#'))); break; case '<': - char_set.add_single(digraph(charT(';'))); + char_set.add_single(digraph(charT(';'))); break; case '>': - char_set.add_single(digraph(charT('\n'))); - char_set.add_single(digraph(charT('\f'))); + char_set.add_single(digraph(charT('\n'))); + char_set.add_single(digraph(charT('\f'))); break; default: fail(regex_constants::error_ctype, m_position - m_base); @@ -2038,7 +2037,7 @@ template bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_start) { // - // If we didn't actually add any states after the last + // If we didn't actually add any states after the last // alternative then that's an error: // if((this->m_alt_insert_point == static_cast(this->m_pdata->m_data.size())) @@ -2047,7 +2046,7 @@ bool basic_regex_parser::unwind_alts(std::ptrdiff_t last_paren_st fail(regex_constants::error_empty, this->m_position - this->m_base); return false; } - // + // // Fix up our alternatives: // while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start)) diff --git a/boost/boost/regex/v4/match_results.hpp b/boost/boost/regex/v4/match_results.hpp index 72538fc015..f56c494139 100644 --- a/boost/boost/regex/v4/match_results.hpp +++ b/boost/boost/regex/v4/match_results.hpp @@ -88,13 +88,13 @@ public: return m_subs[sub].length(); return 0; } - difference_type position(unsigned int sub = 0) const + difference_type position(size_type sub = 0) const { sub += 2; if(sub < m_subs.size()) { const sub_match& s = m_subs[sub]; - if(s.matched) + if(s.matched || (sub == 2)) { return ::boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first)); } @@ -310,8 +310,8 @@ void BOOST_REGEX_CALL match_results::maybe_assign(const // whether a sub-expression is a valid match, because partial matches set this // to false for sub-expression 0. // - BidiIterator end = this->suffix().second; - BidiIterator base = (p1->first == end) ? this->prefix().first : (*this)[0].first; + BidiIterator l_end = this->suffix().second; + BidiIterator l_base = (p1->first == l_end) ? this->prefix().first : (*this)[0].first; difference_type len1 = 0; difference_type len2 = 0; difference_type base1 = 0; @@ -326,9 +326,9 @@ void BOOST_REGEX_CALL match_results::maybe_assign(const // compute the length of the whole sequence, as this can be really // expensive). // - if(p1->first == end) + if(p1->first == l_end) { - if(p2->first != end) + if(p2->first != l_end) { // p2 must be better than p1, and no need to calculate // actual distances: @@ -347,13 +347,13 @@ void BOOST_REGEX_CALL match_results::maybe_assign(const continue; } } - else if(p2->first == end) + else if(p2->first == l_end) { // p1 better than p2, and no need to calculate distances: return; } - base1 = ::boost::re_detail::distance(base, p1->first); - base2 = ::boost::re_detail::distance(base, p2->first); + base1 = ::boost::re_detail::distance(l_base, p1->first); + base2 = ::boost::re_detail::distance(l_base, p2->first); BOOST_ASSERT(base1 >= 0); BOOST_ASSERT(base2 >= 0); if(base1 < base2) return; @@ -410,3 +410,4 @@ std::ostream& operator << (std::ostream& os, #endif + diff --git a/boost/boost/regex/v4/perl_matcher.hpp b/boost/boost/regex/v4/perl_matcher.hpp index 82f8a26d90..15d284d0d3 100644 --- a/boost/boost/regex/v4/perl_matcher.hpp +++ b/boost/boost/regex/v4/perl_matcher.hpp @@ -29,7 +29,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex_constants::sy // function can_start: // template -bool can_start(charT c, const unsigned char* map, unsigned char mask) +inline bool can_start(charT c, const unsigned char* map, unsigned char mask) { return ((c < static_cast(0)) ? true : ((c >= static_cast(1 << CHAR_BIT)) ? true : map[c] & mask)); } @@ -327,7 +327,13 @@ public: match_results& what, const basic_regex& e, match_flag_type f, - BidiIterator base); + BidiIterator l_base) + : m_result(what), base(first), last(end), + position(first), backstop(l_base), re(e), traits_inst(e.get_traits()), + m_independent(false), next_count(&rep_obj), rep_obj(&next_count) + { + construct_init(e, f); + } bool match(); bool find(); @@ -339,6 +345,7 @@ public: private: void construct_init(const basic_regex& e, match_flag_type f); + bool find_imp(); bool match_imp(); #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD diff --git a/boost/boost/regex/v4/perl_matcher_common.hpp b/boost/boost/regex/v4/perl_matcher_common.hpp index 54edaa15d8..d43422b0c6 100644 --- a/boost/boost/regex/v4/perl_matcher_common.hpp +++ b/boost/boost/regex/v4/perl_matcher_common.hpp @@ -31,23 +31,11 @@ namespace boost{ namespace re_detail{ -template -perl_matcher::perl_matcher(BidiIterator first, BidiIterator end, - match_results& what, - const basic_regex& e, - match_flag_type f, - BidiIterator b) - : m_result(what), base(first), last(end), - position(first), backstop(b), re(e), traits_inst(e.get_traits()), - m_independent(false), next_count(&rep_obj), rep_obj(&next_count) -{ - construct_init(e, f); -} - template void perl_matcher::construct_init(const basic_regex& e, match_flag_type f) { typedef typename regex_iterator_traits::iterator_category category; + typedef typename basic_regex::flag_type expression_flag_type; if(e.empty()) { @@ -57,13 +45,14 @@ void perl_matcher::construct_init(const basic_r } pstate = 0; m_match_flags = f; - icase = re.flags() & regex_constants::icase; estimate_max_state_count(static_cast(0)); + expression_flag_type re_f = re.flags(); + icase = re_f & regex_constants::icase; if(!(m_match_flags & (match_perl|match_posix))) { - if((re.flags() & (regbase::main_option_type|regbase::no_perl_ex)) == 0) + if((re_f & (regbase::main_option_type|regbase::no_perl_ex)) == 0) m_match_flags |= match_perl; - else if((re.flags() & (regbase::main_option_type|regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex)) + else if((re_f & (regbase::main_option_type|regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex)) m_match_flags |= match_perl; else m_match_flags |= match_posix; @@ -80,8 +69,7 @@ void perl_matcher::construct_init(const basic_r m_backup_state = 0; #endif // find the value to use for matching word boundaries: - const char_type w = static_cast('w'); - m_word_mask = traits_inst.lookup_classname(&w, &w+1); + m_word_mask = re.get_data().m_word_mask; // find bitmask to use for matching '.': match_any_mask = static_cast((f & match_not_dot_newline) ? re_detail::test_not_newline : re_detail::test_newline); } @@ -101,7 +89,7 @@ void perl_matcher::estimate_max_state_count(std } template -void perl_matcher::estimate_max_state_count(void*) +inline void perl_matcher::estimate_max_state_count(void*) { // we don't know how long the sequence is: max_state_count = BOOST_REGEX_MAX_STATE_COUNT; @@ -109,21 +97,9 @@ void perl_matcher::estimate_max_state_count(voi #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD template -bool perl_matcher::protected_call( +inline bool perl_matcher::protected_call( protected_proc_type proc) { - /* - __try{ - return (this->*proc)(); - }__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode()) - { - reset_stack_guard_page(); - } - // we only get here after a stack overflow: - raise_error(traits_inst, regex_constants::error_size); - // and we never really get here at all: - return false; - */ ::boost::re_detail::concrete_protected_call > obj(this, proc); @@ -133,7 +109,7 @@ bool perl_matcher::protected_call( #endif template -bool perl_matcher::match() +inline bool perl_matcher::match() { #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD return protected_call(&perl_matcher::match_imp); @@ -182,7 +158,7 @@ bool perl_matcher::match_imp() } template -bool perl_matcher::find() +inline bool perl_matcher::find() { #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD return protected_call(&perl_matcher::find_imp); @@ -589,7 +565,12 @@ bool perl_matcher::match_buffer_end() template bool perl_matcher::match_backref() { - // compare with what we previously matched: + // + // Compare with what we previously matched. + // Note that this succeeds if the backref did not partisipate + // in the match, this is in line with ECMAScript, but not Perl + // or PCRE. + // BidiIterator i = (*m_presult)[static_cast(pstate)->index].first; BidiIterator j = (*m_presult)[static_cast(pstate)->index].second; while(i != j) diff --git a/boost/boost/regex/v4/perl_matcher_non_recursive.hpp b/boost/boost/regex/v4/perl_matcher_non_recursive.hpp index 791c5d93f4..c055b38359 100644 --- a/boost/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/boost/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -1066,6 +1066,8 @@ bool perl_matcher::unwind_slow_dot_repeat(bool { // can't repeat any more, remove the pushed state: destroy_single_repeat(); + if((m_match_flags & match_partial) && (position == last) && (position != search_base)) + m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } @@ -1118,6 +1120,8 @@ bool perl_matcher::unwind_fast_dot_repeat(bool { // can't repeat any more, remove the pushed state: destroy_single_repeat(); + if((m_match_flags & match_partial) && (position == last) && (position != search_base)) + m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } @@ -1182,6 +1186,8 @@ bool perl_matcher::unwind_char_repeat(bool r) { // can't repeat any more, remove the pushed state: destroy_single_repeat(); + if((m_match_flags & match_partial) && (position == last) && (position != search_base)) + m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } @@ -1246,6 +1252,8 @@ bool perl_matcher::unwind_short_set_repeat(bool { // can't repeat any more, remove the pushed state: destroy_single_repeat(); + if((m_match_flags & match_partial) && (position == last) && (position != search_base)) + m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } @@ -1311,6 +1319,8 @@ bool perl_matcher::unwind_long_set_repeat(bool { // can't repeat any more, remove the pushed state: destroy_single_repeat(); + if((m_match_flags & match_partial) && (position == last) && (position != search_base)) + m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } diff --git a/boost/boost/regex/v4/perl_matcher_recursive.hpp b/boost/boost/regex/v4/perl_matcher_recursive.hpp index 3a76309490..691f2a6fc9 100644 --- a/boost/boost/regex/v4/perl_matcher_recursive.hpp +++ b/boost/boost/regex/v4/perl_matcher_recursive.hpp @@ -494,6 +494,7 @@ bool perl_matcher::match_char_repeat() #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) +#pragma warning(disable:4267) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 @@ -501,25 +502,39 @@ bool perl_matcher::match_char_repeat() const re_repeat* rep = static_cast(pstate); BOOST_ASSERT(1 == static_cast(rep->next.p)->length); const char_type what = *reinterpret_cast(static_cast(rep->next.p) + 1); - unsigned count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); - std::size_t desired = greedy ? rep->max : rep->min; + std::size_t count, desired; if(::boost::is_random_access_iterator::value) { - BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); - BidiIterator origin(position); - while((position != end) && (traits_inst.translate(*position, icase) == what)) + desired = + (std::min)( + (std::size_t)(greedy ? rep->max : rep->min), + (std::size_t)::boost::re_detail::distance(position, last)); + count = desired; + ++desired; + if(icase) + { + while(--desired && (traits_inst.translate_nocase(*position) == what)) + { + ++position; + } + } + else { - ++position; + while(--desired && (traits_inst.translate(*position) == what)) + { + ++position; + } } - count = (unsigned)::boost::re_detail::distance(origin, position); + count = count - desired; } else { + count = 0; + desired = greedy ? rep->max : rep->min; while((count < desired) && (position != last) && (traits_inst.translate(*position, icase) == what)) { ++position; diff --git a/boost/boost/regex/v4/regex_format.hpp b/boost/boost/regex/v4/regex_format.hpp index f0e327f34f..5bd47cf69c 100644 --- a/boost/boost/regex/v4/regex_format.hpp +++ b/boost/boost/regex/v4/regex_format.hpp @@ -243,7 +243,8 @@ void basic_regex_formatter::format_perl() default: // see if we have a number: { - std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); + std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); + len = (std::min)(static_cast(2), len); int v = m_traits.toi(m_position, m_position + len, 10); if(v < 0) { @@ -327,7 +328,8 @@ void basic_regex_formatter::format_escape() } else { - std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); + std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); + len = (std::min)(static_cast(2), len); int val = m_traits.toi(m_position, m_position + len, 16); if(val < 0) { @@ -398,7 +400,8 @@ void basic_regex_formatter::format_escape() { // octal ecape sequence: --m_position; - std::ptrdiff_t len = (std::min)(static_cast(4), ::boost::re_detail::distance(m_position, m_end)); + std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); + len = (std::min)(static_cast(4), len); v = m_traits.toi(m_position, m_position + len, 8); BOOST_ASSERT(v >= 0); put(static_cast(v)); @@ -419,7 +422,8 @@ void basic_regex_formatter::format_conditional( put(static_cast('?')); return; } - std::ptrdiff_t len = (std::min)(static_cast(2), ::boost::re_detail::distance(m_position, m_end)); + std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); + len = (std::min)(static_cast(2), len); int v = m_traits.toi(m_position, m_position + len, 10); if(v < 0) { diff --git a/boost/boost/regex/v4/regex_replace.hpp b/boost/boost/regex/v4/regex_replace.hpp index a852ffec08..0dabba1608 100644 --- a/boost/boost/regex/v4/regex_replace.hpp +++ b/boost/boost/regex/v4/regex_replace.hpp @@ -45,7 +45,7 @@ OutputIterator regex_replace(OutputIterator out, } else { - BidirectionalIterator last_m = first; + BidirectionalIterator last_m(first); while(i != j) { if(!(flags & regex_constants::format_no_copy)) diff --git a/boost/boost/regex/v4/regex_traits_defaults.hpp b/boost/boost/regex/v4/regex_traits_defaults.hpp index 095c2b350e..44b9aed844 100644 --- a/boost/boost/regex/v4/regex_traits_defaults.hpp +++ b/boost/boost/regex/v4/regex_traits_defaults.hpp @@ -142,7 +142,11 @@ struct character_pointer_range } bool operator == (const character_pointer_range& r)const { - return ((p2 - p1) == (r.p2 - r.p1)) && std::equal(p1, p2, r.p1); + // Not only do we check that the ranges are of equal size before + // calling std::equal, but there is no other algorithm available: + // not even a non-standard MS one. So forward to unchecked_equal + // in the MS case. + return ((p2 - p1) == (r.p2 - r.p1)) && re_detail::equal(p1, p2, r.p1); } }; template diff --git a/boost/boost/regex/v4/regex_workaround.hpp b/boost/boost/regex/v4/regex_workaround.hpp index 695e8f65e6..3659c0720b 100644 --- a/boost/boost/regex/v4/regex_workaround.hpp +++ b/boost/boost/regex/v4/regex_workaround.hpp @@ -128,7 +128,7 @@ inline void pointer_construct(T* p, const T& t) #ifdef __cplusplus namespace boost{ namespace re_detail{ -#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) +#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(_CPPLIB_VER) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) // // MSVC 8 will either emit warnings or else refuse to compile // code that makes perfectly legitimate use of std::copy, when @@ -144,12 +144,22 @@ namespace boost{ namespace re_detail{ { return stdext::unchecked_copy(first, last, dest); } + template + inline bool equal( + InputIterator1 first, + InputIterator1 last, + InputIterator2 with + ) + { + return stdext::unchecked_equal(first, last, with); + } // use safe versions of strcpy etc: using ::strcpy_s; using ::strcat_s; #else using std::copy; + using std::equal; inline std::size_t strcpy_s( char *strDestination, diff --git a/boost/boost/regex/v4/w32_regex_traits.hpp b/boost/boost/regex/v4/w32_regex_traits.hpp index 0d3d6ce3bd..192cb535d8 100644 --- a/boost/boost/regex/v4/w32_regex_traits.hpp +++ b/boost/boost/regex/v4/w32_regex_traits.hpp @@ -533,8 +533,9 @@ typename w32_regex_traits_implementation::char_class_type return pos->second; } std::size_t id = 1 + re_detail::get_default_class_id(p1, p2); - BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0])); - return masks[id]; + if(id < sizeof(masks) / sizeof(masks[0])) + return masks[id]; + return masks[0]; } diff --git a/boost/boost/shared_ptr.hpp b/boost/boost/shared_ptr.hpp index 8d6196cadb..1924c9fe04 100644 --- a/boost/boost/shared_ptr.hpp +++ b/boost/boost/shared_ptr.hpp @@ -5,7 +5,7 @@ // shared_ptr.hpp // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002, 2003 Peter Dimov +// Copyright (c) 2001-2006 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -20,13 +20,14 @@ #include #else +#include // for std::auto_ptr + #include #include #include #include #include -#include // for std::auto_ptr #include // for std::swap #include // for std::less #include // for std::bad_cast @@ -87,10 +88,34 @@ template void sp_enable_shared_from_this( shared_count const & if(pe != 0) pe->_internal_weak_this._internal_assign(const_cast(px), pn); } +#ifdef sgi +// Turn off: the last argument of the varargs function "sp_enable_shared_from_this" is unnamed +# pragma set woff 3506 +#endif + inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... ) { } +#ifdef sgi +# pragma reset woff 3506 +#endif + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) + +// rvalue auto_ptr support based on a technique by Dave Abrahams + +template< class T, class R > struct sp_enable_if_auto_ptr +{ +}; + +template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > +{ + typedef R type; +}; + +#endif + } // namespace detail @@ -114,7 +139,7 @@ public: typedef T element_type; typedef T value_type; typedef T * pointer; - typedef typename detail::shared_ptr_traits::reference reference; + typedef typename boost::detail::shared_ptr_traits::reference reference; shared_ptr(): px(0), pn() // never throws in 1.30+ { @@ -123,7 +148,7 @@ public: template explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete { - detail::sp_enable_shared_from_this( pn, p, p ); + boost::detail::sp_enable_shared_from_this( pn, p, p ); } // @@ -134,7 +159,14 @@ public: template shared_ptr(Y * p, D d): px(p), pn(p, d) { - detail::sp_enable_shared_from_this( pn, p, p ); + boost::detail::sp_enable_shared_from_this( pn, p, p ); + } + + // As above, but with allocator. A's copy constructor shall not throw. + + template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) + { + boost::detail::sp_enable_shared_from_this( pn, p, p ); } // generated copy constructor, assignment, destructor are fine... @@ -164,26 +196,26 @@ public: } template - shared_ptr(shared_ptr const & r, detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) + shared_ptr(shared_ptr const & r, boost::detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) { } template - shared_ptr(shared_ptr const & r, detail::const_cast_tag): px(const_cast(r.px)), pn(r.pn) + shared_ptr(shared_ptr const & r, boost::detail::const_cast_tag): px(const_cast(r.px)), pn(r.pn) { } template - shared_ptr(shared_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) + shared_ptr(shared_ptr const & r, boost::detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if(px == 0) // need to allocate new counter -- the cast failed { - pn = detail::shared_count(); + pn = boost::detail::shared_count(); } } template - shared_ptr(shared_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) + shared_ptr(shared_ptr const & r, boost::detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) { if(px == 0) { @@ -197,13 +229,26 @@ public: explicit shared_ptr(std::auto_ptr & r): px(r.get()), pn() { Y * tmp = r.get(); - pn = detail::shared_count(r); - detail::sp_enable_shared_from_this( pn, tmp, tmp ); + pn = boost::detail::shared_count(r); + boost::detail::sp_enable_shared_from_this( pn, tmp, tmp ); } -#endif +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() + { + typename Ap::element_type * tmp = r.get(); + pn = boost::detail::shared_count( r ); + boost::detail::sp_enable_shared_from_this( pn, tmp, tmp ); + } -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) template shared_ptr & operator=(shared_ptr const & r) // never throws @@ -218,13 +263,25 @@ public: #ifndef BOOST_NO_AUTO_PTR template - shared_ptr & operator=(std::auto_ptr & r) + shared_ptr & operator=( std::auto_ptr & r ) { this_type(r).swap(*this); return *this; } -#endif +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) + { + this_type( r ).swap( *this ); + return *this; + } + + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR void reset() // never throws in 1.30+ { @@ -237,9 +294,14 @@ public: this_type(p).swap(*this); } - template void reset(Y * p, D d) + template void reset( Y * p, D d ) { - this_type(p, d).swap(*this); + this_type( p, d ).swap( *this ); + } + + template void reset( Y * p, D d, A a ) + { + this_type( p, d, a ).swap( *this ); } reference operator* () const // never throws @@ -261,13 +323,26 @@ public: // implicit conversion to "bool" -#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) +#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) operator bool () const { return px != 0; } +#elif defined( _MANAGED ) + + static void unspecified_bool( this_type*** ) + { + } + + typedef void (*unspecified_bool_type)( this_type*** ); + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: unspecified_bool; + } + #elif \ ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) @@ -337,7 +412,7 @@ private: #endif T * px; // contained pointer - detail::shared_count pn; // reference counter + boost::detail::shared_count pn; // reference counter }; // shared_ptr @@ -374,34 +449,34 @@ template inline void swap(shared_ptr & a, shared_ptr & b) template shared_ptr static_pointer_cast(shared_ptr const & r) { - return shared_ptr(r, detail::static_cast_tag()); + return shared_ptr(r, boost::detail::static_cast_tag()); } template shared_ptr const_pointer_cast(shared_ptr const & r) { - return shared_ptr(r, detail::const_cast_tag()); + return shared_ptr(r, boost::detail::const_cast_tag()); } template shared_ptr dynamic_pointer_cast(shared_ptr const & r) { - return shared_ptr(r, detail::dynamic_cast_tag()); + return shared_ptr(r, boost::detail::dynamic_cast_tag()); } // shared_*_cast names are deprecated. Use *_pointer_cast instead. template shared_ptr shared_static_cast(shared_ptr const & r) { - return shared_ptr(r, detail::static_cast_tag()); + return shared_ptr(r, boost::detail::static_cast_tag()); } template shared_ptr shared_dynamic_cast(shared_ptr const & r) { - return shared_ptr(r, detail::dynamic_cast_tag()); + return shared_ptr(r, boost::detail::dynamic_cast_tag()); } template shared_ptr shared_polymorphic_cast(shared_ptr const & r) { - return shared_ptr(r, detail::polymorphic_cast_tag()); + return shared_ptr(r, boost::detail::polymorphic_cast_tag()); } template shared_ptr shared_polymorphic_downcast(shared_ptr const & r) @@ -429,7 +504,7 @@ template std::ostream & operator<< (std::ostream & os, shared_ptr co #else -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT) +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) // MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL using std::basic_ostream; template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) diff --git a/boost/boost/signal.hpp b/boost/boost/signal.hpp index 2268397117..d1538e110d 100644 --- a/boost/boost/signal.hpp +++ b/boost/boost/signal.hpp @@ -1,6 +1,6 @@ // Boost.Signals library -// Copyright Douglas Gregor 2001-2004. Use, modification and +// Copyright Douglas Gregor 2001-2006. 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) @@ -10,7 +10,9 @@ #ifndef BOOST_SIGNAL_HPP #define BOOST_SIGNAL_HPP -#define BOOST_SIGNALS_MAX_ARGS 10 +#ifndef BOOST_SIGNALS_MAX_ARGS +# define BOOST_SIGNALS_MAX_ARGS 10 +#endif #include #include diff --git a/boost/boost/spirit/attribute/closure.hpp b/boost/boost/spirit/attribute/closure.hpp index 60886b8afc..0443791364 100644 --- a/boost/boost/spirit/attribute/closure.hpp +++ b/boost/boost/spirit/attribute/closure.hpp @@ -13,8 +13,10 @@ /////////////////////////////////////////////////////////////////////////////// #include #include +#include #include #include +#include #include #include @@ -177,30 +179,29 @@ namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// template < typename DerivedT - , typename T0 = phoenix::nil_t - , typename T1 = phoenix::nil_t - , typename T2 = phoenix::nil_t + , typename T0 + , typename T1 + , typename T2 #if BOOST_SPIRIT_CLOSURE_LIMIT > 3 - , typename T3 = phoenix::nil_t - , typename T4 = phoenix::nil_t - , typename T5 = phoenix::nil_t + , typename T3 + , typename T4 + , typename T5 #if BOOST_SPIRIT_CLOSURE_LIMIT > 6 - , typename T6 = phoenix::nil_t - , typename T7 = phoenix::nil_t - , typename T8 = phoenix::nil_t + , typename T6 + , typename T7 + , typename T8 #if BOOST_SPIRIT_CLOSURE_LIMIT > 9 - , typename T9 = phoenix::nil_t - , typename T10 = phoenix::nil_t - , typename T11 = phoenix::nil_t + , typename T9 + , typename T10 + , typename T11 #if BOOST_SPIRIT_CLOSURE_LIMIT > 12 - , typename T12 = phoenix::nil_t - , typename T13 = phoenix::nil_t - , typename T14 = phoenix::nil_t - + , typename T12 + , typename T13 + , typename T14 #endif #endif #endif diff --git a/boost/boost/spirit/core/composite/directives.hpp b/boost/boost/spirit/core/composite/directives.hpp index 232100933d..546382de58 100644 --- a/boost/boost/spirit/core/composite/directives.hpp +++ b/boost/boost/spirit/core/composite/directives.hpp @@ -14,34 +14,13 @@ #include #include +#include #include #include #include namespace boost { namespace spirit { - /////////////////////////////////////////////////////////////////////////// - // - // no_skipper_iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - template - struct no_skipper_iteration_policy : public BaseT - { - typedef BaseT base_t; - - no_skipper_iteration_policy() - : BaseT() {} - - template - no_skipper_iteration_policy(PolicyT const& other) - : BaseT(other) {} - - template - void - skip(ScannerT const& /*scan*/) const {} - }; - /////////////////////////////////////////////////////////////////////////// // // contiguous class diff --git a/boost/boost/spirit/core/composite/epsilon.hpp b/boost/boost/spirit/core/composite/epsilon.hpp index b7d4b1b39e..71d962e136 100644 --- a/boost/boost/spirit/core/composite/epsilon.hpp +++ b/boost/boost/spirit/core/composite/epsilon.hpp @@ -60,8 +60,10 @@ namespace boost { namespace spirit { }; #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || \ - BOOST_WORKAROUND(BOOST_MSVC, == 1400) -// VC 7.1 and VC8 + BOOST_WORKAROUND(BOOST_MSVC, == 1400) || \ + BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) +// VC 7.1, VC8 and Sun CC <= 5.8 do not support general +// expressions of non-type template parameters in instantiations template inline condition_parser operator~(condition_parser const& p) diff --git a/boost/boost/spirit/core/composite/no_actions.hpp b/boost/boost/spirit/core/composite/no_actions.hpp index 32a766f4f6..4b5f6bc949 100644 --- a/boost/boost/spirit/core/composite/no_actions.hpp +++ b/boost/boost/spirit/core/composite/no_actions.hpp @@ -47,13 +47,29 @@ struct no_actions_action_policy: //----------------------------------------------------------------------------- // no_actions_scanner + +namespace detail +{ + template + struct compute_no_actions_action_policy + { + typedef no_actions_action_policy type; + }; + + template + struct compute_no_actions_action_policy > + { + typedef no_actions_action_policy type; + }; +} + template > struct no_actions_scanner { typedef scanner_policies< typename ScannerT::iteration_policy_t, typename ScannerT::match_policy_t, - no_actions_action_policy + typename detail::compute_no_actions_action_policy::type > policies_t; typedef typename diff --git a/boost/boost/spirit/core/non_terminal/impl/grammar.ipp b/boost/boost/spirit/core/non_terminal/impl/grammar.ipp index 32a4265219..6811260661 100644 --- a/boost/boost/spirit/core/non_terminal/impl/grammar.ipp +++ b/boost/boost/spirit/core/non_terminal/impl/grammar.ipp @@ -30,7 +30,7 @@ namespace boost { namespace spirit { template struct grammar; -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) BOOST_SPIRIT_DEPENDENT_TEMPLATE_WRAPPER(grammar_definition_wrapper, definition); @@ -299,7 +299,7 @@ struct grammar_definition self->helpers; # endif -# if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)) \ +# if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \ || defined(BOOST_INTEL_CXX_VERSION) for (iterator_t i = helpers.rbegin(); i != helpers.rend(); ++i) (*i)->undefine(self); diff --git a/boost/boost/spirit/core/non_terminal/subrule.hpp b/boost/boost/spirit/core/non_terminal/subrule.hpp index bde2f103db..7509d204e9 100644 --- a/boost/boost/spirit/core/non_terminal/subrule.hpp +++ b/boost/boost/spirit/core/non_terminal/subrule.hpp @@ -15,6 +15,8 @@ #include #include + +#include #include namespace boost { namespace spirit { @@ -166,9 +168,6 @@ namespace boost { namespace spirit { // subrule_parser class // /////////////////////////////////////////////////////////////////////////// - template > - struct subrule; // Forward declaration - template struct subrule_parser : public parser > diff --git a/boost/boost/spirit/core/primitives/impl/primitives.ipp b/boost/boost/spirit/core/primitives/impl/primitives.ipp index 198770eba9..17ff2ce029 100644 --- a/boost/boost/spirit/core/primitives/impl/primitives.ipp +++ b/boost/boost/spirit/core/primitives/impl/primitives.ipp @@ -126,7 +126,7 @@ namespace boost { namespace spirit { }; # define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE impl -# ifndef BOOST_NO_CWCHAR +# ifndef BOOST_NO_CWCTYPE template<> struct char_traits @@ -150,22 +150,96 @@ namespace boost { namespace spirit { # endif #endif // BOOST_SPIRIT_NO_CHAR_TRAITS + // Use char_traits for char and wchar_t only, as these are the only + // specializations provided in the standard. Other types are on their + // own. + // + // For UDT, one may override: + // + // isalnum + // isalpha + // iscntrl + // isdigit + // isgraph + // islower + // isprint + // ispunct + // isspace + // isupper + // isxdigit + // isblank + // isupper + // tolower + // toupper + // + // in a namespace suitable for Argument Dependent lookup or in + // namespace std (disallowed by the standard). + template - inline typename - BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE::char_traits::int_type + struct char_type_char_traits_helper + { + typedef CharT char_type; + typedef typename BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits::int_type int_type; + + static int_type to_int_type(CharT c) + { + return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits::to_int_type(c); + } + + static char_type to_char_type(int_type i) + { + return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE + ::char_traits::to_char_type(i); + } + }; + + template + struct char_traits_helper + { + typedef CharT char_type; + typedef CharT int_type; + + static CharT & to_int_type(CharT & c) + { + return c; + } + + static CharT & to_char_type(CharT & c) + { + return c; + } + }; + + template <> + struct char_traits_helper + : char_type_char_traits_helper + { + }; + +#if !defined(BOOST_NO_CWCTYPE) + + template <> + struct char_traits_helper + : char_type_char_traits_helper + { + }; + +#endif + + template + inline typename char_traits_helper::int_type to_int_type(CharT c) { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits::to_int_type(c); + return char_traits_helper::to_int_type(c); } - + template inline CharT - to_char_type(typename - BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE::char_traits::int_type c) + to_char_type(typename char_traits_helper::int_type c) { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits::to_char_type(c); + return char_traits_helper::to_char_type(c); } /////////////////////////////////////////////////////////////////////// @@ -174,101 +248,115 @@ namespace boost { namespace spirit { // /////////////////////////////////////////////////////////////////////// + template inline bool - isalnum_(char c) + isalnum_(CharT c) { using namespace std; return isalnum(to_int_type(c)) ? true : false; } + template inline bool - isalpha_(char c) + isalpha_(CharT c) { using namespace std; return isalpha(to_int_type(c)) ? true : false; } + template inline bool - iscntrl_(char c) + iscntrl_(CharT c) { using namespace std; return iscntrl(to_int_type(c)) ? true : false; } + template inline bool - isdigit_(char c) + isdigit_(CharT c) { using namespace std; return isdigit(to_int_type(c)) ? true : false; } + template inline bool - isgraph_(char c) + isgraph_(CharT c) { using namespace std; return isgraph(to_int_type(c)) ? true : false; } + template inline bool - islower_(char c) + islower_(CharT c) { using namespace std; return islower(to_int_type(c)) ? true : false; } + template inline bool - isprint_(char c) + isprint_(CharT c) { using namespace std; return isprint(to_int_type(c)) ? true : false; } + template inline bool - ispunct_(char c) + ispunct_(CharT c) { using namespace std; return ispunct(to_int_type(c)) ? true : false; } + template inline bool - isspace_(char c) + isspace_(CharT c) { using namespace std; return isspace(to_int_type(c)) ? true : false; } + template inline bool - isupper_(char c) + isupper_(CharT c) { using namespace std; return isupper(to_int_type(c)) ? true : false; } + template inline bool - isxdigit_(char c) + isxdigit_(CharT c) { using namespace std; return isxdigit(to_int_type(c)) ? true : false; } + template inline bool - isblank_(char c) + isblank_(CharT c) { return (c == ' ' || c == '\t'); } - inline char - tolower_(char c) + template + inline CharT + tolower_(CharT c) { using namespace std; - return to_char_type(tolower(to_int_type(c))); + return to_char_type(tolower(to_int_type(c))); } - inline char - toupper_(char c) + template + inline CharT + toupper_(CharT c) { using namespace std; - return to_char_type(toupper(to_int_type(c))); + return to_char_type(toupper(to_int_type(c))); } #if !defined(BOOST_NO_CWCTYPE) diff --git a/boost/boost/spirit/core/primitives/numerics.hpp b/boost/boost/spirit/core/primitives/numerics.hpp index f737549300..58e552aaba 100644 --- a/boost/boost/spirit/core/primitives/numerics.hpp +++ b/boost/boost/spirit/core/primitives/numerics.hpp @@ -13,6 +13,8 @@ #include #include #include + +#include #include namespace boost { namespace spirit @@ -23,10 +25,10 @@ namespace boost { namespace spirit // /////////////////////////////////////////////////////////////////////////// template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 + typename T, + int Radix, + unsigned MinDigits, + int MaxDigits > struct uint_parser : parser > { @@ -54,10 +56,10 @@ namespace boost { namespace spirit // /////////////////////////////////////////////////////////////////////////// template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 + typename T, + int Radix, + unsigned MinDigits, + int MaxDigits > struct int_parser : parser > { @@ -217,8 +219,8 @@ namespace boost { namespace spirit // /////////////////////////////////////////////////////////////////////////// template < - typename T = double, - typename RealPoliciesT = ureal_parser_policies + typename T, + typename RealPoliciesT > struct real_parser : public parser > diff --git a/boost/boost/spirit/core/primitives/primitives.hpp b/boost/boost/spirit/core/primitives/primitives.hpp index f491028a68..89be6ccf1a 100644 --- a/boost/boost/spirit/core/primitives/primitives.hpp +++ b/boost/boost/spirit/core/primitives/primitives.hpp @@ -16,6 +16,10 @@ #include #include +#ifdef BOOST_MSVC +#pragma warning(disable : 4512) +#endif + namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// diff --git a/boost/boost/spirit/core/scanner/impl/skipper.ipp b/boost/boost/spirit/core/scanner/impl/skipper.ipp index 267dadb533..b809e64cb1 100644 --- a/boost/boost/spirit/core/scanner/impl/skipper.ipp +++ b/boost/boost/spirit/core/scanner/impl/skipper.ipp @@ -105,7 +105,6 @@ namespace boost { namespace spirit { IteratorT first = first_; scanner_t scan(first, last, policies); match hit = p.parse(scan); - scan.skip(scan); return parse_info( first, hit, hit && (first == last), hit.length()); @@ -130,7 +129,6 @@ namespace boost { namespace spirit { IteratorT first = first_; scanner_t scan(first, last); match hit = p.parse(scan); - scan.skip(scan); return parse_info( first, hit, hit && (first == last), hit.length()); diff --git a/boost/boost/spirit/core/scanner/scanner.hpp b/boost/boost/spirit/core/scanner/scanner.hpp index 525949cdaf..e369dc4eb8 100644 --- a/boost/boost/spirit/core/scanner/scanner.hpp +++ b/boost/boost/spirit/core/scanner/scanner.hpp @@ -15,6 +15,8 @@ #include #include // for boost::detail::iterator_traits +#include + namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// @@ -166,9 +168,9 @@ namespace boost { namespace spirit // /////////////////////////////////////////////////////////////////////////// template < - typename IterationPolicyT = iteration_policy, - typename MatchPolicyT = match_policy, - typename ActionPolicyT = action_policy> + typename IterationPolicyT, + typename MatchPolicyT, + typename ActionPolicyT> struct scanner_policies : public IterationPolicyT, public MatchPolicyT, @@ -206,8 +208,8 @@ namespace boost { namespace spirit // /////////////////////////////////////////////////////////////////////////// template < - typename IteratorT = char const*, - typename PoliciesT = scanner_policies<> > + typename IteratorT, + typename PoliciesT> class scanner : public PoliciesT, public scanner_base { public: diff --git a/boost/boost/spirit/core/scanner/skipper.hpp b/boost/boost/spirit/core/scanner/skipper.hpp index 33547bdc20..9fe2a73ead 100644 --- a/boost/boost/spirit/core/scanner/skipper.hpp +++ b/boost/boost/spirit/core/scanner/skipper.hpp @@ -15,17 +15,16 @@ #include #include +#include + namespace boost { namespace spirit { - template - struct no_skipper_iteration_policy; // forward - /////////////////////////////////////////////////////////////////////////// // // skipper_iteration_policy class // /////////////////////////////////////////////////////////////////////////// - template + template struct skipper_iteration_policy : public BaseT { typedef BaseT base_t; @@ -64,7 +63,29 @@ namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // - // skipper_iteration_policy class + // no_skipper_iteration_policy class + // + /////////////////////////////////////////////////////////////////////////// + template + struct no_skipper_iteration_policy : public BaseT + { + typedef BaseT base_t; + + no_skipper_iteration_policy() + : BaseT() {} + + template + no_skipper_iteration_policy(PolicyT const& other) + : BaseT(other) {} + + template + void + skip(ScannerT const& /*scan*/) const {} + }; + + /////////////////////////////////////////////////////////////////////////// + // + // skip_parser_iteration_policy class // /////////////////////////////////////////////////////////////////////////// namespace impl @@ -91,7 +112,7 @@ namespace boost { namespace spirit { iteration_policy const&); } - template + template class skip_parser_iteration_policy : public skipper_iteration_policy { public: diff --git a/boost/boost/spirit/error_handling/exceptions.hpp b/boost/boost/spirit/error_handling/exceptions.hpp index 0186a3ac6d..a848a0f231 100644 --- a/boost/boost/spirit/error_handling/exceptions.hpp +++ b/boost/boost/spirit/error_handling/exceptions.hpp @@ -15,6 +15,8 @@ #include #include +#include + namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// @@ -61,7 +63,7 @@ namespace boost { namespace spirit { // an iterator and an error descriptor. // /////////////////////////////////////////////////////////////////////////// - template + template struct parser_error : public parser_error_base { typedef ErrorDescrT error_descr_t; @@ -211,7 +213,7 @@ namespace boost { namespace spirit { // rethrow: rethrows the error. // /////////////////////////////////////////////////////////////////////////// - template + template struct error_status { enum result_t { fail, retry, accept, rethrow }; @@ -310,9 +312,6 @@ namespace boost { namespace spirit { // fallback_parser's HandlerT (see above). // /////////////////////////////////////////////////////////////////////////// - template - struct guard; - template struct guard_gen : public unary { diff --git a/boost/boost/spirit/iterator/file_iterator.hpp b/boost/boost/spirit/iterator/file_iterator.hpp index 8d79629d6b..07b4997be9 100644 --- a/boost/boost/spirit/iterator/file_iterator.hpp +++ b/boost/boost/spirit/iterator/file_iterator.hpp @@ -55,6 +55,8 @@ #include #include +#include + #if !defined(BOOST_SPIRIT_FILEITERATOR_STD) # if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \ && !defined(BOOST_DISABLE_WIN32) @@ -78,21 +80,6 @@ extern "C" /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { -/////////////////////////////////////////////////////////////////////////////// -namespace fileiter_impl { - - // Forward declarations - template - class std_file_iterator; - -#if !defined(BOOST_SPIRIT_FILEITERATOR_STD) - template - class mmap_file_iterator; -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace fileiter_impl - template < typename CharT = char, typename BaseIterator = diff --git a/boost/boost/spirit/iterator/impl/file_iterator.ipp b/boost/boost/spirit/iterator/impl/file_iterator.ipp index 385067698e..f5d9dd5df1 100644 --- a/boost/boost/spirit/iterator/impl/file_iterator.ipp +++ b/boost/boost/spirit/iterator/impl/file_iterator.ipp @@ -38,8 +38,6 @@ namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// namespace fileiter_impl { -using namespace std; - /////////////////////////////////////////////////////////////////////////////// // // std_file_iterator @@ -66,6 +64,7 @@ public: explicit std_file_iterator(std::string fileName) { + using namespace std; FILE* f = fopen(fileName.c_str(), "rb"); // If the file was opened, store it into @@ -122,6 +121,7 @@ public: void seek_end(void) { + using namespace std; fseek(m_file.get(), 0, SEEK_END); m_pos = ftell(m_file.get()) / sizeof(CharT); m_eof = true; @@ -139,13 +139,14 @@ public: } private: - boost::shared_ptr m_file; + boost::shared_ptr m_file; std::size_t m_pos; CharT m_curChar; bool m_eof; void update_char(void) { + using namespace std; if ((std::size_t)ftell(m_file.get()) != m_pos) fseek(m_file.get(), m_pos, SEEK_SET); diff --git a/boost/boost/spirit/iterator/multi_pass.hpp b/boost/boost/spirit/iterator/multi_pass.hpp index 591b9075da..437044f9e6 100644 --- a/boost/boost/spirit/iterator/multi_pass.hpp +++ b/boost/boost/spirit/iterator/multi_pass.hpp @@ -23,6 +23,8 @@ #include #include // for boost::detail::iterator_traits +#include + namespace boost { namespace spirit { namespace impl { @@ -774,26 +776,11 @@ struct iterator_base_creator }} - - /////////////////////////////////////////////////////////////////////////////// -// class template multi_pass (declaration) +// class template multi_pass /////////////////////////////////////////////////////////////////////////////// -template -< - typename InputT, - typename InputPolicy = multi_pass_policies::input_iterator, - typename OwnershipPolicy = multi_pass_policies::ref_counted, - typename CheckingPolicy = multi_pass_policies::buf_id_check, - typename StoragePolicy = multi_pass_policies::std_deque -> -class multi_pass; // The default multi_pass instantiation uses a ref-counted std_deque scheme. - -/////////////////////////////////////////////////////////////////////////////// -// class template multi_pass (definition) -/////////////////////////////////////////////////////////////////////////////// template < typename InputT, diff --git a/boost/boost/spirit/iterator/position_iterator.hpp b/boost/boost/spirit/iterator/position_iterator.hpp index d9c2961541..746e3bdb66 100644 --- a/boost/boost/spirit/iterator/position_iterator.hpp +++ b/boost/boost/spirit/iterator/position_iterator.hpp @@ -15,6 +15,8 @@ #include #include +#include + namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// @@ -81,13 +83,7 @@ struct file_position : public file_position_without_column { // been reached. // /////////////////////////////////////////////////////////////////////////////// -template -class position_policy; - - -// Forward declaration -template -class position_iterator; +template class position_policy; /////////////////////////////////////////////////////////////////////////////// }} /* namespace boost::spirit */ @@ -142,8 +138,8 @@ namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// template < typename ForwardIteratorT, - typename PositionT = file_position, - typename SelfT = nil_t + typename PositionT, + typename SelfT > class position_iterator : public iterator_::impl::position_iterator_base_generator< @@ -318,7 +314,7 @@ protected: template < typename ForwardIteratorT, - typename PositionT = file_position + typename PositionT > class position_iterator2 : public position_iterator diff --git a/boost/boost/spirit/symbols/impl/symbols.ipp b/boost/boost/spirit/symbols/impl/symbols.ipp index 20d746cb7b..bc8c0e74cd 100644 --- a/boost/boost/spirit/symbols/impl/symbols.ipp +++ b/boost/boost/spirit/symbols/impl/symbols.ipp @@ -15,6 +15,7 @@ // MSVC: void warning about the use of 'this' pointer in constructors #if defined(BOOST_MSVC) +#pragma warning(push) #pragma warning(disable : 4355) #endif @@ -107,7 +108,7 @@ add(symbols& table, CharT const* sym, T const& data) }} // namespace boost::spirit #if defined(BOOST_MSVC) -#pragma warning(default : 4355) +#pragma warning(pop) #endif #endif diff --git a/boost/boost/spirit/symbols/symbols.hpp b/boost/boost/spirit/symbols/symbols.hpp index 7896611550..70e333a5c5 100644 --- a/boost/boost/spirit/symbols/symbols.hpp +++ b/boost/boost/spirit/symbols/symbols.hpp @@ -17,20 +17,11 @@ #include #include -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { +#include -/////////////////////////////////////////////////////////////////////////////// -// Forward Declarations - -namespace impl -{ - template - class tst; -} -template -class symbol_inserter; +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// // @@ -74,12 +65,7 @@ class symbol_inserter; // sym.add("hello", 1)("crazy", 2)("world", 3); // /////////////////////////////////////////////////////////////////////////////// -template -< - typename T = int, - typename CharT = char, - typename SetT = impl::tst -> +template class symbols : private SetT , public parser > diff --git a/boost/boost/spirit/utility/confix.hpp b/boost/boost/spirit/utility/confix.hpp index d6b48c2e89..b15f88f180 100644 --- a/boost/boost/spirit/utility/confix.hpp +++ b/boost/boost/spirit/utility/confix.hpp @@ -13,6 +13,8 @@ #include #include #include + +#include #include /////////////////////////////////////////////////////////////////////////////// @@ -37,7 +39,7 @@ struct confix_parser_gen; template < typename OpenT, typename ExprT, typename CloseT, typename CategoryT, - typename NestedT = non_nested, typename LexemeT = non_lexeme + typename NestedT, typename LexemeT > struct confix_parser : public parser< @@ -137,28 +139,23 @@ struct confix_parser_gen // Generic generator function for creation of concrete confix parsers template - confix_parser< - typename as_parser::type, - typename as_parser::type, - typename as_parser::type, - typename as_parser::type::parser_category_t, - NestedT, - LexemeT - > - operator()( - StartT const &start_, ExprT const &expr_, EndT const &end_) const + struct paren_op_result_type + { + typedef confix_parser< + typename as_parser::type, + typename as_parser::type, + typename as_parser::type, + typename as_parser::type::parser_category_t, + NestedT, + LexemeT + > type; + }; + + template + typename paren_op_result_type::type + operator()(StartT const &start_, ExprT const &expr_, EndT const &end_) const { - typedef typename as_parser::type start_t; - typedef typename as_parser::type expr_t; - typedef typename as_parser::type end_t; - typedef - typename as_parser::type::parser_category_t - parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT - > + typedef typename paren_op_result_type::type return_t; return return_t( @@ -173,25 +170,23 @@ struct confix_parser_gen // parser (see comment above, no automatic refactoring) template - confix_parser< - typename as_parser::type, - typename as_parser::type, - typename as_parser::type, - plain_parser_category, // do not re-attach action - NestedT, - LexemeT - > + struct direct_result_type + { + typedef confix_parser< + typename as_parser::type, + typename as_parser::type, + typename as_parser::type, + plain_parser_category, // do not re-attach action + NestedT, + LexemeT + > type; + }; + + template + typename direct_result_type::type direct(StartT const &start_, ExprT const &expr_, EndT const &end_) const { - typedef typename as_parser::type start_t; - typedef typename as_parser::type expr_t; - typedef typename as_parser::type end_t; - typedef plain_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT - > + typedef typename direct_result_type::type return_t; return return_t( @@ -251,25 +246,24 @@ struct comment_parser_gen // closing token. template - confix_parser< - typename as_parser::type, - kleene_star, - alternative, - unary_parser_category, // there is no action to re-attach - NestedT, - is_lexeme // insert implicit lexeme_d[] - > + struct paren_op1_result_type + { + typedef confix_parser< + typename as_parser::type, + kleene_star, + alternative, + unary_parser_category, // there is no action to re-attach + NestedT, + is_lexeme // insert implicit lexeme_d[] + > + type; + }; + + template + typename paren_op1_result_type::type operator() (StartT const &start_) const { - typedef typename as_parser::type start_t; - typedef kleene_star expr_t; - typedef alternative end_t; - typedef unary_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme - > + typedef typename paren_op1_result_type::type return_t; return return_t( @@ -283,25 +277,23 @@ struct comment_parser_gen // from an open and a close tokens. template - confix_parser< - typename as_parser::type, - kleene_star, - typename as_parser::type, - unary_parser_category, // there is no action to re-attach - NestedT, - is_lexeme // insert implicit lexeme_d[] - > + struct paren_op2_result_type + { + typedef confix_parser< + typename as_parser::type, + kleene_star, + typename as_parser::type, + unary_parser_category, // there is no action to re-attach + NestedT, + is_lexeme // insert implicit lexeme_d[] + > type; + }; + + template + typename paren_op2_result_type::type operator() (StartT const &start_, EndT const &end_) const { - typedef typename as_parser::type start_t; - typedef kleene_star expr_t; - typedef typename as_parser::type end_t; - typedef unary_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme - > + typedef typename paren_op2_result_type::type return_t; return return_t( @@ -358,7 +350,7 @@ private: { return impl::contiguous_parser_parse< - BOOST_DEDUCED_TYPENAME parser_result::type + typename parser_result::type >(p, scan, scan); } @@ -373,21 +365,25 @@ private: /////////////////////////////////////////////////////////////////////////////// template -inline -comment_nest_parser< - typename as_parser::type, - typename as_parser::type -> - comment_nest_p(OpenT const &open, CloseT const &close) +struct comment_nest_p_result { - return - comment_nest_parser< - BOOST_DEDUCED_TYPENAME as_parser::type, - BOOST_DEDUCED_TYPENAME as_parser::type - >( - as_parser::convert(open), - as_parser::convert(close) - ); + typedef comment_nest_parser< + typename as_parser::type, + typename as_parser::type + > type; +}; + +template +inline typename comment_nest_p_result::type +comment_nest_p(OpenT const &open, CloseT const &close) +{ + typedef typename comment_nest_p_result::type + result_t; + + return result_t( + as_parser::convert(open), + as_parser::convert(close) + ); } /////////////////////////////////////////////////////////////////////////////// diff --git a/boost/boost/spirit/utility/distinct.hpp b/boost/boost/spirit/utility/distinct.hpp index 4e1625f08a..9d90d0ab6d 100644 --- a/boost/boost/spirit/utility/distinct.hpp +++ b/boost/boost/spirit/utility/distinct.hpp @@ -18,12 +18,14 @@ #include #include +#include + namespace boost { namespace spirit { //----------------------------------------------------------------------------- // distinct_parser class -template > +template class distinct_parser { public: @@ -64,7 +66,7 @@ public: //----------------------------------------------------------------------------- // distinct_directive class -template > +template class distinct_directive { public: @@ -111,7 +113,7 @@ public: //----------------------------------------------------------------------------- // dynamic_distinct_parser class -template > +template class dynamic_distinct_parser { public: @@ -163,7 +165,7 @@ public: //----------------------------------------------------------------------------- // dynamic_distinct_directive class -template > +template class dynamic_distinct_directive { public: diff --git a/boost/boost/spirit/utility/escape_char.hpp b/boost/boost/spirit/utility/escape_char.hpp index 2db0436ce4..6fc1524d7e 100644 --- a/boost/boost/spirit/utility/escape_char.hpp +++ b/boost/boost/spirit/utility/escape_char.hpp @@ -17,6 +17,7 @@ #include +#include #include /////////////////////////////////////////////////////////////////////////////// @@ -112,7 +113,7 @@ private: template struct escape_char_action_parser_gen; -template +template struct escape_char_parser : public parser > { diff --git a/boost/boost/spirit/utility/lists.hpp b/boost/boost/spirit/utility/lists.hpp index 489f2700a6..7ac8f49d30 100644 --- a/boost/boost/spirit/utility/lists.hpp +++ b/boost/boost/spirit/utility/lists.hpp @@ -14,6 +14,8 @@ #include #include #include + +#include #include /////////////////////////////////////////////////////////////////////////////// @@ -92,8 +94,7 @@ namespace boost { namespace spirit { // /////////////////////////////////////////////////////////////////////////////// template < - typename ItemT, typename DelimT, typename EndT = no_list_endtoken, - typename CategoryT = plain_parser_category + typename ItemT, typename DelimT, typename EndT, typename CategoryT > struct list_parser : public parser > { diff --git a/boost/boost/test/detail/enable_warnings.hpp b/boost/boost/test/detail/enable_warnings.hpp index ad6ff6e892..bc4e199ec8 100644 --- a/boost/boost/test/detail/enable_warnings.hpp +++ b/boost/boost/test/detail/enable_warnings.hpp @@ -7,7 +7,7 @@ // // File : $RCSfile: enable_warnings.hpp,v $ // -// Version : $Revision: 1.4 $ +// Version : $Revision: 1.6 $ // // Description : enable previosly suppressed warnings // *************************************************************************** @@ -19,6 +19,10 @@ # pragma warning(default: 4996) // was declared deprecated # pragma warning(default: 4355) // 'this' : used in base member initializer list # pragma warning(default: 4706) // assignment within conditional expression +# pragma warning(default: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(default: 4127) // conditional expression is constant +# pragma warning(default: 4290) // C++ exception specification ignored except to ... +# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored # pragma warning(pop) #endif @@ -26,6 +30,12 @@ // Revision History : // // $Log: enable_warnings.hpp,v $ +// Revision 1.6 2006/01/28 07:09:08 rogeeff +// 4180 suppressed +// +// Revision 1.5 2005/12/14 04:57:50 rogeeff +// extra warnings suppressed +// // Revision 1.4 2005/02/20 08:27:06 rogeeff // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // diff --git a/boost/boost/test/detail/suppress_warnings.hpp b/boost/boost/test/detail/suppress_warnings.hpp index 7aac657a8c..4103a673c4 100644 --- a/boost/boost/test/detail/suppress_warnings.hpp +++ b/boost/boost/test/detail/suppress_warnings.hpp @@ -7,7 +7,7 @@ // // File : $RCSfile: suppress_warnings.hpp,v $ // -// Version : $Revision: 1.4 $ +// Version : $Revision: 1.6 $ // // Description : suppress some warnings // *************************************************************************** @@ -20,12 +20,22 @@ # pragma warning(disable: 4996) // was declared deprecated # pragma warning(disable: 4355) // 'this' : used in base member initializer list # pragma warning(disable: 4706) // assignment within conditional expression +# pragma warning(disable: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(disable: 4127) // conditional expression is constant +# pragma warning(disable: 4290) // C++ exception specification ignored except to ... +# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored #endif // *************************************************************************** // Revision History : // // $Log: suppress_warnings.hpp,v $ +// Revision 1.6 2006/01/28 07:09:08 rogeeff +// 4180 suppressed +// +// Revision 1.5 2005/12/14 04:57:50 rogeeff +// extra warnings suppressed +// // Revision 1.4 2005/02/20 08:27:06 rogeeff // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // diff --git a/boost/boost/token_functions.hpp b/boost/boost/token_functions.hpp index afa36fe33a..c329e3bc39 100644 --- a/boost/boost/token_functions.hpp +++ b/boost/boost/token_functions.hpp @@ -33,11 +33,11 @@ #include #include -#include #include #include #include // for find_if #include +#include #include #include @@ -212,7 +212,7 @@ namespace boost{ template static void assign(Iterator b, Iterator e, Token &t) { -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) &&\ +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) &&\ BOOST_WORKAROUND(__SGI_STL_PORT, < 0x500) &&\ defined(_STLP_DEBUG) &&\ (defined(_STLP_USE_DYNAMIC_LIB) || defined(_DLL)) @@ -327,7 +327,7 @@ namespace boost{ InputIterator>::iterator_category> assigner; - assert(!offsets_.empty()); + BOOST_ASSERT(!offsets_.empty()); assigner::clear(tok); InputIterator start(next); diff --git a/boost/boost/token_iterator.hpp b/boost/boost/token_iterator.hpp index 41d2cdea5c..f7aa1a3e33 100644 --- a/boost/boost/token_iterator.hpp +++ b/boost/boost/token_iterator.hpp @@ -18,12 +18,11 @@ #ifndef BOOST_TOKENIZER_POLICY_JRB070303_HPP_ #define BOOST_TOKENIZER_POLICY_JRB070303_HPP_ +#include #include #include #include #include -#include - namespace boost { @@ -49,12 +48,12 @@ namespace boost Type tok_; void increment(){ - assert(valid_); + BOOST_ASSERT(valid_); valid_ = f_(begin_,end_,tok_); } const Type& dereference() const { - assert(valid_); + BOOST_ASSERT(valid_); return tok_; } template diff --git a/boost/boost/tokenizer.hpp b/boost/boost/tokenizer.hpp index d026466847..d236ec4e99 100644 --- a/boost/boost/tokenizer.hpp +++ b/boost/boost/tokenizer.hpp @@ -18,7 +18,7 @@ #define BOOST_TOKENIZER_JRB070303_HPP_ #include -#include + namespace boost { diff --git a/boost/boost/tuple/detail/tuple_basic.hpp b/boost/boost/tuple/detail/tuple_basic.hpp index a1d3284d64..9341fbcc56 100644 --- a/boost/boost/tuple/detail/tuple_basic.hpp +++ b/boost/boost/tuple/detail/tuple_basic.hpp @@ -362,7 +362,7 @@ struct cons { template - cons( const null_type& t1, T2& t2, T3& t3, T4& t4, T5& t5, + cons( const null_type& /*t1*/, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9, T10& t10 ) : head (), tail (t2, t3, t4, t5, t6, t7, t8, t9, t10, detail::cnull()) diff --git a/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp b/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp index c4f65c4763..d0275d4bf8 100644 --- a/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp +++ b/boost/boost/tuple/detail/tuple_basic_no_partial_spec.hpp @@ -105,7 +105,7 @@ namespace tuples { // Each of vc6 and vc7 seem to require a different formulation // of this return type template -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) static typename add_reference::type>::type #else static typename add_const_reference::type diff --git a/boost/boost/tuple/tuple_io.hpp b/boost/boost/tuple/tuple_io.hpp index 467ab0ab8a..40c2599c5a 100644 --- a/boost/boost/tuple/tuple_io.hpp +++ b/boost/boost/tuple/tuple_io.hpp @@ -349,7 +349,7 @@ extract_and_check_delimiter( char c; if (is_delimiter) { is >> c; - if (c!=d) { + if (is.good() && c!=d) { is.setstate(std::ios::failbit); } } @@ -443,7 +443,7 @@ extract_and_check_delimiter( CharType c; if (is_delimiter) { is >> c; - if (c!=d) { + if (is.good() && c!=d) { is.setstate(std::ios::failbit); } } diff --git a/boost/boost/type_traits/add_const.hpp b/boost/boost/type_traits/add_const.hpp index 2d0fae0197..29f0bd95bc 100644 --- a/boost/boost/type_traits/add_const.hpp +++ b/boost/boost/type_traits/add_const.hpp @@ -10,10 +10,10 @@ #ifndef BOOST_TT_ADD_CONST_HPP_INCLUDED #define BOOST_TT_ADD_CONST_HPP_INCLUDED -#include "boost/config.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -42,6 +42,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_const,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_ADD_CONST_HPP_INCLUDED diff --git a/boost/boost/type_traits/add_cv.hpp b/boost/boost/type_traits/add_cv.hpp index 381f17c228..bfde76a623 100644 --- a/boost/boost/type_traits/add_cv.hpp +++ b/boost/boost/type_traits/add_cv.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ADD_CV_HPP_INCLUDED #define BOOST_TT_ADD_CV_HPP_INCLUDED -#include "boost/config.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -43,6 +43,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_cv,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_ADD_CV_HPP_INCLUDED diff --git a/boost/boost/type_traits/add_pointer.hpp b/boost/boost/type_traits/add_pointer.hpp index 0f36a2e678..308baf0fb7 100644 --- a/boost/boost/type_traits/add_pointer.hpp +++ b/boost/boost/type_traits/add_pointer.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_ADD_POINTER_HPP_INCLUDED #define BOOST_TT_ADD_POINTER_HPP_INCLUDED -#include "boost/type_traits/remove_reference.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -63,10 +63,10 @@ struct add_pointer_impl } // namespace detail -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename detail::add_pointer_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename boost::detail::add_pointer_impl::type) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/add_reference.hpp b/boost/boost/type_traits/add_reference.hpp index 8915b76867..7dfb4bed89 100644 --- a/boost/boost/type_traits/add_reference.hpp +++ b/boost/boost/type_traits/add_reference.hpp @@ -9,12 +9,12 @@ #ifndef BOOST_TT_ADD_REFERENCE_HPP_INCLUDED #define BOOST_TT_ADD_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/config.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -74,7 +74,7 @@ BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const } // namespace detail -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename detail::add_reference_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename boost::detail::add_reference_impl::type) // agurt, 07/mar/03: workaround Borland's ill-formed sensitivity to an additional // level of indirection, here @@ -84,6 +84,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/boost/boost/type_traits/add_volatile.hpp b/boost/boost/type_traits/add_volatile.hpp index c575e28a38..491f1c2dd3 100644 --- a/boost/boost/type_traits/add_volatile.hpp +++ b/boost/boost/type_traits/add_volatile.hpp @@ -10,10 +10,10 @@ #ifndef BOOST_TT_ADD_VOLATILE_HPP_INCLUDED #define BOOST_TT_ADD_VOLATILE_HPP_INCLUDED -#include "boost/config.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -42,6 +42,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_volatile,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_ADD_VOLATILE_HPP_INCLUDED diff --git a/boost/boost/type_traits/alignment_of.hpp b/boost/boost/type_traits/alignment_of.hpp index 8672cca17e..f18d4226fb 100644 --- a/boost/boost/type_traits/alignment_of.hpp +++ b/boost/boost/type_traits/alignment_of.hpp @@ -9,11 +9,11 @@ #ifndef BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED #define BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED -#include "boost/config.hpp" +#include #include // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include #ifdef BOOST_MSVC # pragma warning(push) @@ -51,7 +51,7 @@ struct alignment_of_impl { BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::alignment_logic< - sizeof(detail::alignment_of_hack) - sizeof(T), + sizeof(::boost::detail::alignment_of_hack) - sizeof(T), sizeof(T) >::value)); }; @@ -94,7 +94,7 @@ BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const volatile,0) # pragma warning(pop) #endif -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include #endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED diff --git a/boost/boost/type_traits/alignment_traits.hpp b/boost/boost/type_traits/alignment_traits.hpp index 108b06b667..2ed6934dad 100644 --- a/boost/boost/type_traits/alignment_traits.hpp +++ b/boost/boost/type_traits/alignment_traits.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED #define BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/type_with_alignment.hpp" +#include +#include #endif // BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/arithmetic_traits.hpp b/boost/boost/type_traits/arithmetic_traits.hpp index 156e5b677d..e4670e6b38 100644 --- a/boost/boost/type_traits/arithmetic_traits.hpp +++ b/boost/boost/type_traits/arithmetic_traits.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED #define BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_float.hpp" -#include "boost/type_traits/is_fundamental.hpp" -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_void.hpp" +#include +#include +#include +#include +#include #endif // BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/array_traits.hpp b/boost/boost/type_traits/array_traits.hpp index d09dd0b2c6..a68ae73176 100644 --- a/boost/boost/type_traits/array_traits.hpp +++ b/boost/boost/type_traits/array_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED #define BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_array.hpp" +#include #endif // BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/broken_compiler_spec.hpp b/boost/boost/type_traits/broken_compiler_spec.hpp index 16e324f799..fb51769d9d 100644 --- a/boost/boost/type_traits/broken_compiler_spec.hpp +++ b/boost/boost/type_traits/broken_compiler_spec.hpp @@ -9,8 +9,8 @@ #ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED #define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED -#include "boost/mpl/aux_/lambda_support.hpp" -#include "boost/config.hpp" +#include +#include // these are needed regardless of BOOST_TT_NO_BROKEN_COMPILER_SPEC #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -88,7 +88,7 @@ template<> struct trait##_impl \ }} \ /**/ -# include "boost/type_traits/detail/type_trait_undef.hpp" +# include #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/boost/boost/type_traits/composite_traits.hpp b/boost/boost/type_traits/composite_traits.hpp index 0ed3ac76f2..985a4c51d3 100644 --- a/boost/boost/type_traits/composite_traits.hpp +++ b/boost/boost/type_traits/composite_traits.hpp @@ -13,13 +13,13 @@ #ifndef BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED #define BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_array.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/is_member_function_pointer.hpp" -#include "boost/type_traits/is_pointer.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_union.hpp" +#include +#include +#include +#include +#include +#include +#include #endif // BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/config.hpp b/boost/boost/type_traits/config.hpp index cdb4ac64c9..98945d7e40 100644 --- a/boost/boost/type_traits/config.hpp +++ b/boost/boost/type_traits/config.hpp @@ -10,9 +10,11 @@ #define BOOST_TT_CONFIG_HPP_INCLUDED #ifndef BOOST_CONFIG_HPP -#include "boost/config.hpp" +#include #endif +#include + // // whenever we have a conversion function with elipses // it needs to be declared __cdecl to suppress compiler @@ -24,15 +26,30 @@ # define BOOST_TT_DECL /**/ #endif -# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || (defined(BOOST_MSVC) && (BOOST_MSVC > 1301)) || defined(__EDG_VERSION__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__DMC__) || ( defined(__IBMCPP__) && (__IBMCPP__ >= 600 ) ) || defined(BOOST_NO_COMPILER_CONFIG) -# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION +# if (BOOST_WORKAROUND(__MWERKS__, < 0x3000) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1301) \ + || !defined(__EDG_VERSION__) && BOOST_WORKAROUND(__GNUC__, < 3) \ + || BOOST_WORKAROUND(__IBMCPP__, < 600 ) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || defined(__ghs) \ + || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) \ + || BOOST_WORKAROUND(MPW_CPLUS, BOOST_TESTED_AT(0x890)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) ) \ + && defined(BOOST_NO_IS_ABSTRACT) + +# define BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION 1 + +#endif + +#ifndef BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION +# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION 1 #endif // // Define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING // when we can't test for function types with elipsis: // -#if defined(__GNUC__) && (__GNUC__ < 3) +#if BOOST_WORKAROUND(__GNUC__, < 3) # define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING #endif @@ -50,7 +67,7 @@ // if tests for cv-qualified member functions don't // work in is_member_function_pointer // -#if (defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600) +#if BOOST_WORKAROUND(__MWERKS__, < 0x3000) || BOOST_WORKAROUND(__IBMCPP__, <= 600) # define BOOST_TT_NO_CV_FUNC_TEST #endif diff --git a/boost/boost/type_traits/conversion_traits.hpp b/boost/boost/type_traits/conversion_traits.hpp index 82785315ec..01edfa690e 100644 --- a/boost/boost/type_traits/conversion_traits.hpp +++ b/boost/boost/type_traits/conversion_traits.hpp @@ -12,6 +12,6 @@ #ifndef BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED #define BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_convertible.hpp" +#include #endif // BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/cv_traits.hpp b/boost/boost/type_traits/cv_traits.hpp index aac5054ba6..5bd6c4f066 100644 --- a/boost/boost/type_traits/cv_traits.hpp +++ b/boost/boost/type_traits/cv_traits.hpp @@ -12,13 +12,13 @@ #ifndef BOOST_TT_CV_TRAITS_HPP_INCLUDED #define BOOST_TT_CV_TRAITS_HPP_INCLUDED -#include "boost/type_traits/add_const.hpp" -#include "boost/type_traits/add_volatile.hpp" -#include "boost/type_traits/add_cv.hpp" -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/remove_const.hpp" -#include "boost/type_traits/remove_volatile.hpp" -#include "boost/type_traits/remove_cv.hpp" +#include +#include +#include +#include +#include +#include +#include +#include #endif // BOOST_TT_CV_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/detail/bool_trait_def.hpp b/boost/boost/type_traits/detail/bool_trait_def.hpp index 40ec5e201b..d630392819 100644 --- a/boost/boost/type_traits/detail/bool_trait_def.hpp +++ b/boost/boost/type_traits/detail/bool_trait_def.hpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source: /cvsroot/boost/boost/boost/type_traits/detail/bool_trait_def.hpp,v $ -// $Date: 2005/03/16 12:22:22 $ -// $Revision: 1.18 $ +// $Date: 2005/08/25 16:27:26 $ +// $Revision: 1.19 $ #include #include @@ -24,7 +24,7 @@ /**/ # define BOOST_TT_AUX_BOOL_C_BASE(C) -#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200 +#elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ typedef ::boost::integral_constant base_; \ diff --git a/boost/boost/type_traits/detail/cv_traits_impl.hpp b/boost/boost/type_traits/detail/cv_traits_impl.hpp index eee7c7d2a2..b3fa59505e 100644 --- a/boost/boost/type_traits/detail/cv_traits_impl.hpp +++ b/boost/boost/type_traits/detail/cv_traits_impl.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED #define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" +#include +#include #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // implementation helper: -#if !(BOOST_WORKAROUND(__GNUC__,== 3) && (__GNUC_MINOR__ <= 2)) +#if !(BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2)) namespace boost { namespace detail { #else -#include "boost/type_traits/detail/yes_no_type.hpp" +#include namespace boost { namespace type_traits { namespace gcc8503 { diff --git a/boost/boost/type_traits/detail/false_result.hpp b/boost/boost/type_traits/detail/false_result.hpp index b7ea18476e..e65e8bc257 100644 --- a/boost/boost/type_traits/detail/false_result.hpp +++ b/boost/boost/type_traits/detail/false_result.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED #define BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED -#include "boost/config.hpp" +#include namespace boost { namespace type_traits { diff --git a/boost/boost/type_traits/detail/ice_and.hpp b/boost/boost/type_traits/detail/ice_and.hpp index 92645b5625..8b461b9fff 100644 --- a/boost/boost/type_traits/detail/ice_and.hpp +++ b/boost/boost/type_traits/detail/ice_and.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED -#include "boost/config.hpp" +#include namespace boost { namespace type_traits { diff --git a/boost/boost/type_traits/detail/ice_eq.hpp b/boost/boost/type_traits/detail/ice_eq.hpp index 4c177f33d5..ea42a60b66 100644 --- a/boost/boost/type_traits/detail/ice_eq.hpp +++ b/boost/boost/type_traits/detail/ice_eq.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED -#include "boost/config.hpp" +#include namespace boost { namespace type_traits { diff --git a/boost/boost/type_traits/detail/ice_not.hpp b/boost/boost/type_traits/detail/ice_not.hpp index 6cac8408ca..ee1dca0ecd 100644 --- a/boost/boost/type_traits/detail/ice_not.hpp +++ b/boost/boost/type_traits/detail/ice_not.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED -#include "boost/config.hpp" +#include namespace boost { namespace type_traits { diff --git a/boost/boost/type_traits/detail/ice_or.hpp b/boost/boost/type_traits/detail/ice_or.hpp index e116e64266..f88d9f6aec 100644 --- a/boost/boost/type_traits/detail/ice_or.hpp +++ b/boost/boost/type_traits/detail/ice_or.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED -#include "boost/config.hpp" +#include namespace boost { namespace type_traits { diff --git a/boost/boost/type_traits/detail/is_function_ptr_helper.hpp b/boost/boost/type_traits/detail/is_function_ptr_helper.hpp index 7a6fdda761..605d0bc2ef 100644 --- a/boost/boost/type_traits/detail/is_function_ptr_helper.hpp +++ b/boost/boost/type_traits/detail/is_function_ptr_helper.hpp @@ -15,12 +15,12 @@ #ifndef BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include +# include +# include #endif namespace boost { diff --git a/boost/boost/type_traits/detail/is_function_ptr_tester.hpp b/boost/boost/type_traits/detail/is_function_ptr_tester.hpp index 8ccda30745..c1a3c6a5f8 100644 --- a/boost/boost/type_traits/detail/is_function_ptr_tester.hpp +++ b/boost/boost/type_traits/detail/is_function_ptr_tester.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_TT_DETAIL_IS_FUNCTION_PTR_TESTER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_TESTER_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" +#include +#include #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include +# include +# include #endif namespace boost { @@ -45,10 +45,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)()); template yes_type is_function_ptr_tester(R (__stdcall*)( ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)()); template yes_type is_function_ptr_tester(R (__fastcall*)( ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)()); template @@ -65,10 +67,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0)); template yes_type is_function_ptr_tester(R (__stdcall*)( T0 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0)); template @@ -85,10 +89,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1)); template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1)); template @@ -105,10 +111,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2)); template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2)); template @@ -125,10 +133,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3)); template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3)); template @@ -145,10 +155,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4)); template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4)); template @@ -165,10 +177,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5)); template @@ -185,10 +199,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); template @@ -205,10 +221,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); template @@ -225,10 +243,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); template @@ -245,10 +265,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); template @@ -265,10 +287,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); template @@ -285,10 +309,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); template @@ -305,10 +331,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); template @@ -325,10 +353,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); template @@ -345,10 +375,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); template @@ -365,10 +397,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); template @@ -385,10 +419,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); template @@ -405,10 +441,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); template @@ -425,10 +463,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); template @@ -445,10 +485,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); template @@ -465,10 +507,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); template @@ -485,10 +529,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); template @@ -505,10 +551,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); template @@ -525,10 +573,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); template @@ -545,10 +595,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...)); +#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); template yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...)); +#endif template yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); template @@ -586,10 +638,12 @@ template yes_type is_function_ptr_tester(R (__stdcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); +@#ifndef _MANAGED template yes_type is_function_ptr_tester(R (__fastcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); template yes_type is_function_ptr_tester(R (__fastcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); +@#endif template yes_type is_function_ptr_tester(R (__cdecl*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); template diff --git a/boost/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp b/boost/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp index a9f0f5ec14..4f75f14d0a 100644 --- a/boost/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +++ b/boost/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp @@ -14,12 +14,12 @@ #ifndef BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_IMPL_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_IMPL_HPP_INCLUDED -#include "boost/config.hpp" +#include #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include +# include +# include #endif namespace boost { diff --git a/boost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp b/boost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp index 5ce25fa701..e6532d39db 100644 --- a/boost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +++ b/boost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_TESTER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_TESTER_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" +#include +#include #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include +# include +# include #endif namespace boost { @@ -29,7 +29,8 @@ namespace type_traits { no_type BOOST_TT_DECL is_mem_fun_pointer_tester(...); #if !defined(BOOST_TT_PREPROCESSING_MODE) -// preprocessor-generated part, don't edit by hand! +// pre-processed code, don't edit, try GNU cpp with +// cpp -I../../../ -DBOOST_TT_PREPROCESSING_MODE -x c++ -P filename template yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)()); @@ -81,6 +82,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( ...) volat template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)()); @@ -104,6 +106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( ...) vola template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)()); @@ -179,6 +182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 ...) vo template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0)); @@ -202,6 +206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 ...) v template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0)); @@ -277,6 +282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 .. template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1)); @@ -300,6 +306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 . template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1)); @@ -375,6 +382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2)); @@ -398,6 +406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2)); @@ -473,6 +482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3)); @@ -496,6 +506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3)); @@ -571,6 +582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4)); @@ -594,6 +606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4)); @@ -669,6 +682,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5)); @@ -692,6 +706,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5)); @@ -767,6 +782,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); @@ -790,6 +806,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); @@ -865,6 +882,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); @@ -888,6 +906,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); @@ -963,6 +982,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); @@ -986,6 +1006,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); @@ -1061,6 +1082,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); @@ -1084,6 +1106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); @@ -1159,6 +1182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); @@ -1182,6 +1206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); @@ -1257,6 +1282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); @@ -1280,6 +1306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); @@ -1355,6 +1382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); @@ -1378,6 +1406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); @@ -1453,6 +1482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); @@ -1476,6 +1506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); @@ -1551,6 +1582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); @@ -1574,6 +1606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); @@ -1649,6 +1682,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); @@ -1672,6 +1706,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); @@ -1747,6 +1782,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); @@ -1770,6 +1806,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); @@ -1845,6 +1882,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); @@ -1868,6 +1906,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); @@ -1943,6 +1982,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); @@ -1966,6 +2006,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); @@ -2041,6 +2082,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); @@ -2064,6 +2106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); @@ -2139,6 +2182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); @@ -2162,6 +2206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); @@ -2237,6 +2282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); @@ -2260,6 +2306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); @@ -2335,6 +2382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); @@ -2358,6 +2406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); @@ -2433,6 +2482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); @@ -2456,6 +2506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); @@ -2531,6 +2582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const volatile); +#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); @@ -2554,6 +2606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const volatile); +#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); @@ -2613,7 +2666,7 @@ yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS( template yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) const volatile); -#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING +@#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING template yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); @@ -2625,8 +2678,8 @@ yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS( template yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); -#endif -#ifdef BOOST_TT_TEST_MS_FUNC_SIGS // Other calling conventions used by MS compatible compilers: +@#endif +@#ifdef BOOST_TT_TEST_MS_FUNC_SIGS // Other calling conventions used by MS compatible compilers: template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2651,6 +2704,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_EN template yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); +@#ifndef _MANAGED template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2674,6 +2728,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_E template yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); +@#endif template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2698,7 +2753,7 @@ yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM template yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); -#endif +@#endif #undef BOOST_PP_COUNTER #endif // BOOST_PP_IS_ITERATING diff --git a/boost/boost/type_traits/detail/size_t_trait_def.hpp b/boost/boost/type_traits/detail/size_t_trait_def.hpp index ec169b9306..628c4a44f7 100644 --- a/boost/boost/type_traits/detail/size_t_trait_def.hpp +++ b/boost/boost/type_traits/detail/size_t_trait_def.hpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source: /cvsroot/boost/boost/boost/type_traits/detail/size_t_trait_def.hpp,v $ -// $Date: 2005/01/30 15:47:45 $ -// $Revision: 1.8 $ +// $Date: 2005/08/25 16:27:26 $ +// $Revision: 1.9 $ #include #include @@ -18,7 +18,7 @@ #include -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 # define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ #else diff --git a/boost/boost/type_traits/extent.hpp b/boost/boost/type_traits/extent.hpp index 88f98dd2de..196d826eb8 100644 --- a/boost/boost/type_traits/extent.hpp +++ b/boost/boost/type_traits/extent.hpp @@ -11,7 +11,7 @@ #define BOOST_TT_EXTENT_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include namespace boost { @@ -120,7 +120,7 @@ template struct extent : public ::boost::integral_constant::value> { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef ::boost::integral_constant::value> base_; using base_::value; #endif @@ -129,6 +129,6 @@ struct extent } // namespace boost -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/function_traits.hpp b/boost/boost/type_traits/function_traits.hpp index 36efaecdee..1554cfbf94 100644 --- a/boost/boost/type_traits/function_traits.hpp +++ b/boost/boost/type_traits/function_traits.hpp @@ -166,7 +166,7 @@ struct function_traits_helper template struct function_traits : - public detail::function_traits_helper::type> + public detail::function_traits_helper::type> { }; diff --git a/boost/boost/type_traits/has_nothrow_assign.hpp b/boost/boost/type_traits/has_nothrow_assign.hpp index 2f52924565..3cef7357d5 100644 --- a/boost/boost/type_traits/has_nothrow_assign.hpp +++ b/boost/boost/type_traits/has_nothrow_assign.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED -#include "boost/type_traits/has_trivial_assign.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -33,6 +33,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_a } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_nothrow_constructor.hpp b/boost/boost/type_traits/has_nothrow_constructor.hpp index f3c7ce764b..4f2cb36421 100644 --- a/boost/boost/type_traits/has_nothrow_constructor.hpp +++ b/boost/boost/type_traits/has_nothrow_constructor.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/has_trivial_constructor.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -33,6 +33,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_noth } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_nothrow_copy.hpp b/boost/boost/type_traits/has_nothrow_copy.hpp index 5c83412e0e..6a66c8bf0b 100644 --- a/boost/boost/type_traits/has_nothrow_copy.hpp +++ b/boost/boost/type_traits/has_nothrow_copy.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED -#include "boost/type_traits/has_trivial_copy.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -33,6 +33,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_cop } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_nothrow_destructor.hpp b/boost/boost/type_traits/has_nothrow_destructor.hpp index 8df6315e3b..4f5882afc0 100644 --- a/boost/boost/type_traits/has_nothrow_destructor.hpp +++ b/boost/boost/type_traits/has_nothrow_destructor.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/has_trivial_destructor.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -20,6 +20,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_destructor,T,::boost::has_trivial_destr } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_trivial_assign.hpp b/boost/boost/type_traits/has_trivial_assign.hpp index d3ed0ff8d7..4179e8d747 100644 --- a/boost/boost/type_traits/has_trivial_assign.hpp +++ b/boost/boost/type_traits/has_trivial_assign.hpp @@ -9,17 +9,17 @@ #ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include +#include +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -45,6 +45,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_assign,T,::boost::detail::has_trivial_a } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_trivial_constructor.hpp b/boost/boost/type_traits/has_trivial_constructor.hpp index 5d1c3b6043..5f9616d3c1 100644 --- a/boost/boost/type_traits/has_trivial_constructor.hpp +++ b/boost/boost/type_traits/has_trivial_constructor.hpp @@ -9,13 +9,13 @@ #ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -37,6 +37,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_constructor,T,::boost::detail::has_triv } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_trivial_copy.hpp b/boost/boost/type_traits/has_trivial_copy.hpp index 76ebfcf764..96b214892c 100644 --- a/boost/boost/type_traits/has_trivial_copy.hpp +++ b/boost/boost/type_traits/has_trivial_copy.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -43,6 +43,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_cop } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_trivial_destructor.hpp b/boost/boost/type_traits/has_trivial_destructor.hpp index 257b327f52..f2a8ce681b 100644 --- a/boost/boost/type_traits/has_trivial_destructor.hpp +++ b/boost/boost/type_traits/has_trivial_destructor.hpp @@ -9,13 +9,13 @@ #ifndef BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -37,6 +37,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_destructor,T,::boost::detail::has_trivi } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED diff --git a/boost/boost/type_traits/has_virtual_destructor.hpp b/boost/boost/type_traits/has_virtual_destructor.hpp index 4d15704d9d..8f99ff420f 100644 --- a/boost/boost/type_traits/has_virtual_destructor.hpp +++ b/boost/boost/type_traits/has_virtual_destructor.hpp @@ -12,7 +12,7 @@ #include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -20,6 +20,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCT } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/ice.hpp b/boost/boost/type_traits/ice.hpp index 2ba08160bf..134bc4bb76 100644 --- a/boost/boost/type_traits/ice.hpp +++ b/boost/boost/type_traits/ice.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ICE_HPP_INCLUDED #define BOOST_TT_ICE_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/type_traits/detail/ice_eq.hpp" +#include +#include +#include +#include +#include #endif // BOOST_TT_ICE_HPP_INCLUDED diff --git a/boost/boost/type_traits/integral_constant.hpp b/boost/boost/type_traits/integral_constant.hpp index 26f952a497..0a6450a3b6 100644 --- a/boost/boost/type_traits/integral_constant.hpp +++ b/boost/boost/type_traits/integral_constant.hpp @@ -59,17 +59,23 @@ public: template<> struct integral_constant : public mpl::true_ { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# pragma warning(push) +# pragma warning(disable:4097) typedef mpl::true_ base_; using base_::value; +# pragma warning(pop) #endif typedef integral_constant type; }; template<> struct integral_constant : public mpl::false_ { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# pragma warning(push) +# pragma warning(disable:4097) typedef mpl::false_ base_; using base_::value; +# pragma warning(pop) #endif typedef integral_constant type; }; diff --git a/boost/boost/type_traits/intrinsics.hpp b/boost/boost/type_traits/intrinsics.hpp index f993613a91..48c34402d0 100644 --- a/boost/boost/type_traits/intrinsics.hpp +++ b/boost/boost/type_traits/intrinsics.hpp @@ -10,7 +10,7 @@ #define BOOST_TT_INTRINSICS_HPP_INCLUDED #ifndef BOOST_TT_CONFIG_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include #endif // @@ -35,8 +35,15 @@ #ifdef BOOST_HAS_SGI_TYPE_TRAITS // Hook into SGI's __type_traits class, this will pick up user supplied // specializations as well as SGI - compiler supplied specializations. -# include "boost/type_traits/is_same.hpp" -# include +# include +# ifdef __NetBSD__ + // There are two different versions of type_traits.h on NetBSD on Spark + // use an implicit include via algorithm instead, to make sure we get + // the same version as the std lib: +# include +# else +# include +# endif # define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits::is_POD_type, ::__true_type>::value # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits::has_trivial_default_constructor, ::__true_type>::value # define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits::has_trivial_copy_constructor, ::__true_type>::value @@ -65,7 +72,7 @@ #if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215) # define BOOST_IS_UNION(T) __is_union(T) -# define BOOST_IS_POD(T) __is_pod(T) +# define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T) diff --git a/boost/boost/type_traits/is_abstract.hpp b/boost/boost/type_traits/is_abstract.hpp index 4f9b79128a..b6d640c78b 100644 --- a/boost/boost/type_traits/is_abstract.hpp +++ b/boost/boost/type_traits/is_abstract.hpp @@ -51,12 +51,12 @@ #include #include #include -#include "boost/type_traits/detail/ice_and.hpp" +#include #ifdef BOOST_NO_IS_ABSTRACT #include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -132,6 +132,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_polymorphic_imp #endif //BOOST_TT_IS_ABSTRACT_CLASS_HPP diff --git a/boost/boost/type_traits/is_arithmetic.hpp b/boost/boost/type_traits/is_arithmetic.hpp index ec57661855..be881c5fbe 100644 --- a/boost/boost/type_traits/is_arithmetic.hpp +++ b/boost/boost/type_traits/is_arithmetic.hpp @@ -9,13 +9,13 @@ #ifndef BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED #define BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_float.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -38,6 +38,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_arithmetic,T,::boost::detail::is_arithmetic_impl } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_array.hpp b/boost/boost/type_traits/is_array.hpp index a3ec8e4784..24a2a90fd3 100644 --- a/boost/boost/type_traits/is_array.hpp +++ b/boost/boost/type_traits/is_array.hpp @@ -14,17 +14,17 @@ #ifndef BOOST_TT_IS_ARRAY_HPP_INCLUDED #define BOOST_TT_IS_ARRAY_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/wrap.hpp" +# include +# include #endif #include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -85,6 +85,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,::boost::detail::is_array_impl::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_base_and_derived.hpp b/boost/boost/type_traits/is_base_and_derived.hpp index cf420d8bcb..94a2b2e277 100644 --- a/boost/boost/type_traits/is_base_and_derived.hpp +++ b/boost/boost/type_traits/is_base_and_derived.hpp @@ -9,22 +9,22 @@ #ifndef BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED #define BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/remove_cv.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { namespace detail { -#if !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \ - && !BOOST_WORKAROUND(__SUNPRO_CC , BOOST_TESTED_AT(0x540)) \ +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) \ + && !BOOST_WORKAROUND(__SUNPRO_CC , <= 0x540) \ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \ && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) @@ -217,6 +217,7 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_a } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED + diff --git a/boost/boost/type_traits/is_base_of.hpp b/boost/boost/type_traits/is_base_of.hpp index a02a15ffd2..bf46da38e3 100644 --- a/boost/boost/type_traits/is_base_of.hpp +++ b/boost/boost/type_traits/is_base_of.hpp @@ -9,10 +9,12 @@ #ifndef BOOST_TT_IS_BASE_OF_HPP_INCLUDED #define BOOST_TT_IS_BASE_OF_HPP_INCLUDED -#include "boost/type_traits/is_base_and_derived.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -20,7 +22,9 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2( is_base_of , Base , Derived - , (::boost::detail::is_base_and_derived_impl::value) + , (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl::value), + (::boost::is_same::value)>::value) ) #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -31,6 +35,6 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_o } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_class.hpp b/boost/boost/type_traits/is_class.hpp index 038c6662e2..c361580507 100644 --- a/boost/boost/type_traits/is_class.hpp +++ b/boost/boost/type_traits/is_class.hpp @@ -10,27 +10,27 @@ #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED #define BOOST_TT_IS_CLASS_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -# include "boost/type_traits/is_union.hpp" -# include "boost/type_traits/detail/ice_and.hpp" -# include "boost/type_traits/detail/ice_not.hpp" +#include +# include +# include +# include #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION -# include "boost/type_traits/detail/yes_no_type.hpp" +# include #else -# include "boost/type_traits/is_scalar.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_void.hpp" -# include "boost/type_traits/is_function.hpp" +# include +# include +# include +# include +# include #endif #ifdef __EDG_VERSION__ -# include "boost/type_traits/remove_cv.hpp" +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -116,13 +116,13 @@ struct is_class_impl # ifdef __EDG_VERSION__ BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_class,T, detail::is_class_impl::type>::value) + is_class,T, detail::is_class_impl::type>::value) # else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl::value) # endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_compound.hpp b/boost/boost/type_traits/is_compound.hpp index 7d562fc59f..01c38a7269 100644 --- a/boost/boost/type_traits/is_compound.hpp +++ b/boost/boost/type_traits/is_compound.hpp @@ -9,12 +9,12 @@ #ifndef BOOST_TT_IS_COMPOUND_HPP_INCLUDED #define BOOST_TT_IS_COMPOUND_HPP_INCLUDED -#include "boost/config.hpp" -#include "boost/type_traits/is_fundamental.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -35,6 +35,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,::boost::detail::is_compound_impl: } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_COMPOUND_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_const.hpp b/boost/boost/type_traits/is_const.hpp index 9e571aae66..18b13f0103 100644 --- a/boost/boost/type_traits/is_const.hpp +++ b/boost/boost/type_traits/is_const.hpp @@ -21,29 +21,37 @@ #ifndef BOOST_TT_IS_CONST_HPP_INCLUDED #define BOOST_TT_IS_CONST_HPP_INCLUDED -#include "boost/config.hpp" +#include +#include #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/cv_traits_impl.hpp" +# include # ifdef __GNUC__ # include # endif +# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) +# include +# endif #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" +# include +# include +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //* is a type T declared const - is_const -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp::is_const) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp::type*>::is_const) +#else + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp::is_const) +#endif BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false) #if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) @@ -128,7 +136,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_impl::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_CONST_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_convertible.hpp b/boost/boost/type_traits/is_convertible.hpp index 5b62877f3f..f817f66f5c 100644 --- a/boost/boost/type_traits/is_convertible.hpp +++ b/boost/boost/type_traits/is_convertible.hpp @@ -12,22 +12,24 @@ #ifndef BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED #define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_array.hpp" -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/ice.hpp" -#include "boost/type_traits/is_arithmetic.hpp" +#include +#include +#include +#include +#include +#include +#include #ifndef BOOST_NO_IS_ABSTRACT -#include "boost/type_traits/is_abstract.hpp" +#include #endif -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) -# include "boost/type_traits/is_void.hpp" +#if defined(__MWERKS__) +#include +#include #endif // should be always the last #include directive -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -186,6 +188,53 @@ struct is_convertible_basic_impl }; }; +#elif defined(__MWERKS__) +// +// CW works with the technique implemented above for EDG, except when From +// is a function type (or a reference to such a type), in which case +// any_conversion won't be accepted as a valid conversion. We detect this +// exceptional situation and channel it through an alternative algorithm. +// + +template +struct is_convertible_basic_impl_aux; + +struct any_conversion +{ + template any_conversion(const volatile T&); +}; + +template +struct is_convertible_basic_impl_aux +{ + static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...); + static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int); + static From _m_from; + + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) + ); +}; + +template +struct is_convertible_basic_impl_aux +{ + static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); + static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); + static From _m_from; + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) + ); +}; + +template +struct is_convertible_basic_impl: + is_convertible_basic_impl_aux< + From,To, + ::boost::is_function::type>::value + > +{}; + #else // @@ -198,10 +247,16 @@ struct is_convertible_basic_impl static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); static From _m_from; - +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4244) +#endif BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) ); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif }; #endif // is_convertible_impl @@ -213,12 +268,15 @@ struct is_convertible_impl { typedef typename add_reference::type ref_type; enum { value = - ::boost::type_traits::ice_and< - ::boost::detail::is_convertible_basic_impl::value, - ::boost::type_traits::ice_not< - ::boost::is_array::value + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::detail::is_convertible_basic_impl::value, + ::boost::is_void::value >::value, - >::value }; + ::boost::type_traits::ice_not< + ::boost::is_array::value + >::value + >::value) }; }; #elif !defined(__BORLANDC__) || __BORLANDC__ > 0x551 template @@ -227,7 +285,10 @@ struct is_convertible_impl typedef typename add_reference::type ref_type; BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - ::boost::detail::is_convertible_basic_impl::value, + ::boost::type_traits::ice_or< + ::boost::detail::is_convertible_basic_impl::value, + ::boost::is_void::value + >::value, ::boost::type_traits::ice_not< ::boost::is_array::value >::value @@ -332,14 +393,14 @@ struct is_convertible_impl_dispatch #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,true) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,true) #endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -349,6 +410,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convert } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_empty.hpp b/boost/boost/type_traits/is_empty.hpp index 7d2f3645a0..c8eb7912da 100644 --- a/boost/boost/type_traits/is_empty.hpp +++ b/boost/boost/type_traits/is_empty.hpp @@ -9,27 +9,27 @@ #ifndef BOOST_TT_IS_EMPTY_HPP_INCLUDED #define BOOST_TT_IS_EMPTY_HPP_INCLUDED -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include +#include +#include +#include #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/remove_cv.hpp" -# include "boost/type_traits/is_class.hpp" -# include "boost/type_traits/add_reference.hpp" +# include +# include +# include #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_pointer.hpp" -# include "boost/type_traits/is_member_pointer.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/is_void.hpp" -# include "boost/type_traits/detail/ice_and.hpp" -# include "boost/type_traits/detail/ice_not.hpp" +# include +# include +# include +# include +# include +# include +# include #endif // should be always the last #include directive -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -41,6 +41,10 @@ struct empty_helper_t1 : public T { empty_helper_t1(); // hh compiler bug workaround int i[256]; +private: + // suppress compiler warnings: + empty_helper_t1(const empty_helper_t1&); + empty_helper_t1& operator=(const empty_helper_t1&); }; struct empty_helper_t2 { int i[256]; }; @@ -201,7 +205,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_EMPTY_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_enum.hpp b/boost/boost/type_traits/is_enum.hpp index 3b81b7f74a..c913975aa9 100644 --- a/boost/boost/type_traits/is_enum.hpp +++ b/boost/boost/type_traits/is_enum.hpp @@ -11,15 +11,15 @@ #ifndef BOOST_TT_IS_ENUM_HPP_INCLUDED #define BOOST_TT_IS_ENUM_HPP_INCLUDED -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/is_array.hpp" +#include +#include +#include +#include +#include #ifdef __GNUC__ #include #endif -#include "boost/type_traits/config.hpp" +#include #if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) # include # include @@ -27,7 +27,7 @@ // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -52,7 +52,7 @@ struct is_class_or_union template struct is_class_or_union { -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) || BOOST_WORKAROUND(__BORLANDC__, <= 0x570)// we simply can't detect it this way. +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))// we simply can't detect it this way. BOOST_STATIC_CONSTANT(bool, value = false); # else template static ::boost::type_traits::yes_type is_class_or_union_tester(void(U::*)(void)); @@ -175,6 +175,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,false) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_ENUM_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_float.hpp b/boost/boost/type_traits/is_float.hpp index 349608ee28..25d16f1800 100644 --- a/boost/boost/type_traits/is_float.hpp +++ b/boost/boost/type_traits/is_float.hpp @@ -10,7 +10,7 @@ #define BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -22,6 +22,6 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_float,long double,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_floating_point.hpp b/boost/boost/type_traits/is_floating_point.hpp index eec7c85070..2224453054 100644 --- a/boost/boost/type_traits/is_floating_point.hpp +++ b/boost/boost/type_traits/is_floating_point.hpp @@ -10,7 +10,7 @@ #define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -22,6 +22,6 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_function.hpp b/boost/boost/type_traits/is_function.hpp index ecb0b5d665..8fd2c9eead 100644 --- a/boost/boost/type_traits/is_function.hpp +++ b/boost/boost/type_traits/is_function.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/detail/false_result.hpp" -#include "boost/config.hpp" +#include +#include +#include #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) -# include "boost/type_traits/detail/is_function_ptr_helper.hpp" +# include #else -# include "boost/type_traits/detail/is_function_ptr_tester.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include // is a type a function? // Please note that this implementation is unnecessarily complex: @@ -83,6 +83,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl: } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_fundamental.hpp b/boost/boost/type_traits/is_fundamental.hpp index e21e8a6a74..e163ba973c 100644 --- a/boost/boost/type_traits/is_fundamental.hpp +++ b/boost/boost/type_traits/is_fundamental.hpp @@ -9,12 +9,12 @@ #ifndef BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED #define BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -36,6 +36,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_fundamental,T,::boost::detail::is_fundamental_im } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_integral.hpp b/boost/boost/type_traits/is_integral.hpp index 62ef83b16e..b6ca6c73c8 100644 --- a/boost/boost/type_traits/is_integral.hpp +++ b/boost/boost/type_traits/is_integral.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_IS_INTEGRAL_HPP_INCLUDED #define BOOST_TT_IS_INTEGRAL_HPP_INCLUDED -#include "boost/config.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -41,9 +41,9 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,char,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,wchar_t,true) #endif -#if (defined(BOOST_MSVC) && (BOOST_MSVC == 1200)) \ +#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \ || (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \ - || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER == 1200)) + || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int8,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int8,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int16,true) @@ -66,6 +66,6 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int64,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_INTEGRAL_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_member_function_pointer.hpp b/boost/boost/type_traits/is_member_function_pointer.hpp index 1cba5bf76c..edfc5ad542 100644 --- a/boost/boost/type_traits/is_member_function_pointer.hpp +++ b/boost/boost/type_traits/is_member_function_pointer.hpp @@ -11,8 +11,8 @@ #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/detail/workaround.hpp" +#include +#include #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) @@ -21,18 +21,18 @@ // __stdcall etc function types, where as the partial specialisation // version does not do so. // -# include "boost/type_traits/detail/is_mem_fun_pointer_impl.hpp" +# include #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" -# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp" +# include +# include +# include +# include +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -121,6 +121,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_me } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_member_object_pointer.hpp b/boost/boost/type_traits/is_member_object_pointer.hpp index b1e8bf2817..66b76c90b3 100644 --- a/boost/boost/type_traits/is_member_object_pointer.hpp +++ b/boost/boost/type_traits/is_member_object_pointer.hpp @@ -10,14 +10,14 @@ #ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/is_member_function_pointer.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -41,6 +41,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_memb } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_member_pointer.hpp b/boost/boost/type_traits/is_member_pointer.hpp index 2a77c6dde2..73300d3151 100644 --- a/boost/boost/type_traits/is_member_pointer.hpp +++ b/boost/boost/type_traits/is_member_pointer.hpp @@ -21,22 +21,22 @@ #ifndef BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/detail/workaround.hpp" +#include +#include #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) -# include "boost/type_traits/is_member_function_pointer.hpp" +# include #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" +# include +# include +# include +# include +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -103,6 +103,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::detail::is_member_poin } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_object.hpp b/boost/boost/type_traits/is_object.hpp index 59079a5497..3decbf8d19 100644 --- a/boost/boost/type_traits/is_object.hpp +++ b/boost/boost/type_traits/is_object.hpp @@ -9,15 +9,15 @@ #ifndef BOOST_TT_IS_OBJECT_HPP_INCLUDED #define BOOST_TT_IS_OBJECT_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/is_function.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -48,6 +48,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_object,T,::boost::detail::is_object_impl::val } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_OBJECT_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_pod.hpp b/boost/boost/type_traits/is_pod.hpp index e674367270..af2c3c4aeb 100644 --- a/boost/boost/type_traits/is_pod.hpp +++ b/boost/boost/type_traits/is_pod.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_IS_POD_HPP_INCLUDED #define BOOST_TT_IS_POD_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/is_scalar.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include +#include +#include +#include +#include #include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -130,6 +130,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::detail::is_pod_impl::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_POD_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_pointer.hpp b/boost/boost/type_traits/is_pointer.hpp index 0f981c06c6..8c155450bc 100644 --- a/boost/boost/type_traits/is_pointer.hpp +++ b/boost/boost/type_traits/is_pointer.hpp @@ -21,21 +21,21 @@ #ifndef BOOST_TT_IS_POINTER_HPP_INCLUDED #define BOOST_TT_IS_POINTER_HPP_INCLUDED -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/type_traits/config.hpp" +#include +#include +#include +#include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/is_function_ptr_tester.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" +# include +# include +# include +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -144,6 +144,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl::v } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_polymorphic.hpp b/boost/boost/type_traits/is_polymorphic.hpp index afba32b886..c3126224b5 100644 --- a/boost/boost/type_traits/is_polymorphic.hpp +++ b/boost/boost/type_traits/is_polymorphic.hpp @@ -11,7 +11,7 @@ #include #include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include #include namespace boost{ @@ -31,6 +31,10 @@ struct is_polymorphic_imp1 ~d1()throw(); # endif char padding[256]; + private: + // keep some picky compilers happy: + d1(const d1&); + d1& operator=(const d1&); }; struct d2 : public ncvT { @@ -43,6 +47,10 @@ struct is_polymorphic_imp1 virtual void unique_name_to_boost5487629(unique*); # endif char padding[256]; + private: + // keep some picky compilers happy: + d2(const d2&); + d2& operator=(const d2&); }; # endif BOOST_STATIC_CONSTANT(bool, value = (sizeof(d2) == sizeof(d1))); @@ -89,6 +97,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_polymorphic,T,::boost::detail::is_polymorphic_im } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif diff --git a/boost/boost/type_traits/is_reference.hpp b/boost/boost/type_traits/is_reference.hpp index 3655373a4f..0eb0d4f714 100644 --- a/boost/boost/type_traits/is_reference.hpp +++ b/boost/boost/type_traits/is_reference.hpp @@ -21,15 +21,15 @@ #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/wrap.hpp" +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -66,7 +66,7 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference, #ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable: 4181) +# pragma warning(disable: 4181 4097) #endif namespace detail { @@ -110,7 +110,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_same.hpp b/boost/boost/type_traits/is_same.hpp index ae5e51e2f6..e0d1808b4d 100644 --- a/boost/boost/type_traits/is_same.hpp +++ b/boost/boost/type_traits/is_same.hpp @@ -21,14 +21,14 @@ #ifndef BOOST_TT_IS_SAME_HPP_INCLUDED #define BOOST_TT_IS_SAME_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/is_reference.hpp" +#include +#include +#include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -97,7 +97,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,(::boost::detail::is_same_impl::va } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_SAME_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_scalar.hpp b/boost/boost/type_traits/is_scalar.hpp index 24f42a0d6e..4af3def14c 100644 --- a/boost/boost/type_traits/is_scalar.hpp +++ b/boost/boost/type_traits/is_scalar.hpp @@ -9,15 +9,15 @@ #ifndef BOOST_TT_IS_SCALAR_HPP_INCLUDED #define BOOST_TT_IS_SCALAR_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/is_pointer.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -50,6 +50,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_scalar,T,::boost::detail::is_scalar_impl::val } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_SCALAR_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_signed.hpp b/boost/boost/type_traits/is_signed.hpp index 2b35dccc1f..9c780b5718 100644 --- a/boost/boost/type_traits/is_signed.hpp +++ b/boost/boost/type_traits/is_signed.hpp @@ -10,12 +10,12 @@ #ifndef BOOST_TT_IS_SIGNED_HPP_INCLUDED #define BOOST_TT_IS_SIGNED_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -59,7 +59,7 @@ struct is_signed_imp > selector; typedef typename selector::template rebind binder; typedef typename binder::type type; -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) BOOST_STATIC_CONSTANT(bool, value = is_signed_imp::type::value); #else BOOST_STATIC_CONSTANT(bool, value = type::value); @@ -112,6 +112,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp::valu } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_stateless.hpp b/boost/boost/type_traits/is_stateless.hpp index 30f603233b..d8d40635fe 100644 --- a/boost/boost/type_traits/is_stateless.hpp +++ b/boost/boost/type_traits/is_stateless.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_IS_STATELESS_HPP_INCLUDED #define BOOST_TT_IS_STATELESS_HPP_INCLUDED -#include "boost/type_traits/has_trivial_constructor.hpp" -#include "boost/type_traits/has_trivial_copy.hpp" -#include "boost/type_traits/has_trivial_destructor.hpp" -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_empty.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -43,6 +43,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_stateless,T,::boost::detail::is_stateless_impl #endif // BOOST_TT_IS_STATELESS_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_union.hpp b/boost/boost/type_traits/is_union.hpp index 4a444ec3a4..25bddccfe1 100644 --- a/boost/boost/type_traits/is_union.hpp +++ b/boost/boost/type_traits/is_union.hpp @@ -11,12 +11,12 @@ #ifndef BOOST_TT_IS_UNION_HPP_INCLUDED #define BOOST_TT_IS_UNION_HPP_INCLUDED -#include "boost/type_traits/remove_cv.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -44,6 +44,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::boost::detail::is_union_impl::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_UNION_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_unsigned.hpp b/boost/boost/type_traits/is_unsigned.hpp index 68fb230fdd..7a9f8916f6 100644 --- a/boost/boost/type_traits/is_unsigned.hpp +++ b/boost/boost/type_traits/is_unsigned.hpp @@ -10,12 +10,12 @@ #ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED #define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -109,6 +109,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp:: } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_void.hpp b/boost/boost/type_traits/is_void.hpp index 00abd0ab0a..ca51b54870 100644 --- a/boost/boost/type_traits/is_void.hpp +++ b/boost/boost/type_traits/is_void.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_IS_VOID_HPP_INCLUDED #define BOOST_TT_IS_VOID_HPP_INCLUDED -#include "boost/config.hpp" +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { @@ -28,6 +28,6 @@ BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void const volatile,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_VOID_HPP_INCLUDED diff --git a/boost/boost/type_traits/is_volatile.hpp b/boost/boost/type_traits/is_volatile.hpp index 1d2b1fe015..db473b5544 100644 --- a/boost/boost/type_traits/is_volatile.hpp +++ b/boost/boost/type_traits/is_volatile.hpp @@ -21,26 +21,34 @@ #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED -#include "boost/config.hpp" +#include +#include #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/cv_traits_impl.hpp" +# include +# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) +# include +# endif #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" +# include +# include +# include +# include #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include namespace boost { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION //* is a type T declared volatile - is_volatile -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp::is_volatile) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp::type*>::is_volatile) +#else + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp::is_volatile) +#endif BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false) #if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) @@ -118,6 +126,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_impl: } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED diff --git a/boost/boost/type_traits/object_traits.hpp b/boost/boost/type_traits/object_traits.hpp index cefdd39411..c812a62e25 100644 --- a/boost/boost/type_traits/object_traits.hpp +++ b/boost/boost/type_traits/object_traits.hpp @@ -14,20 +14,20 @@ #ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED #define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED -#include "boost/type_traits/has_trivial_assign.hpp" -#include "boost/type_traits/has_trivial_constructor.hpp" -#include "boost/type_traits/has_trivial_copy.hpp" -#include "boost/type_traits/has_trivial_destructor.hpp" -#include "boost/type_traits/has_nothrow_constructor.hpp" -#include "boost/type_traits/has_nothrow_copy.hpp" -#include "boost/type_traits/has_nothrow_assign.hpp" -#include "boost/type_traits/is_base_and_derived.hpp" -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_compound.hpp" -#include "boost/type_traits/is_empty.hpp" -#include "boost/type_traits/is_object.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/is_scalar.hpp" -#include "boost/type_traits/is_stateless.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED diff --git a/boost/boost/type_traits/rank.hpp b/boost/boost/type_traits/rank.hpp index 43b428db2b..4209d2d466 100644 --- a/boost/boost/type_traits/rank.hpp +++ b/boost/boost/type_traits/rank.hpp @@ -11,7 +11,7 @@ #define BOOST_TT_RANK_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include namespace boost { @@ -76,6 +76,6 @@ BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp::value)) } // namespace boost -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/reference_traits.hpp b/boost/boost/type_traits/reference_traits.hpp index 85894924ca..1607b3d0db 100644 --- a/boost/boost/type_traits/reference_traits.hpp +++ b/boost/boost/type_traits/reference_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED #define BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" +#include #endif // BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_all_extents.hpp b/boost/boost/type_traits/remove_all_extents.hpp index b64112b51f..8ae18eeff6 100644 --- a/boost/boost/type_traits/remove_all_extents.hpp +++ b/boost/boost/type_traits/remove_all_extents.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED #define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED -#include "boost/config.hpp" +#include #include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const vo } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_bounds.hpp b/boost/boost/type_traits/remove_bounds.hpp index 32f7dd8c24..1d7b436551 100644 --- a/boost/boost/type_traits/remove_bounds.hpp +++ b/boost/boost/type_traits/remove_bounds.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED #define BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED -#include "boost/config.hpp" +#include #include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T const volatil } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_const.hpp b/boost/boost/type_traits/remove_const.hpp index 2ec8d6caf0..7e18d88b1a 100644 --- a/boost/boost/type_traits/remove_const.hpp +++ b/boost/boost/type_traits/remove_const.hpp @@ -11,15 +11,20 @@ #ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED #define BOOST_TT_REMOVE_CONST_HPP_INCLUDED -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include #include +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -53,21 +58,21 @@ struct remove_const_impl // * convert a type T to non-const type - remove_const -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_const,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const[N],T type[N]) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_cv.hpp b/boost/boost/type_traits/remove_cv.hpp index 910ee9597c..09f8ff103c 100644 --- a/boost/boost/type_traits/remove_cv.hpp +++ b/boost/boost/type_traits/remove_cv.hpp @@ -11,21 +11,26 @@ #ifndef BOOST_TT_REMOVE_CV_HPP_INCLUDED #define BOOST_TT_REMOVE_CV_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include #include +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // convert a type T to a non-cv-qualified type - remove_cv -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename detail::cv_traits_imp::unqualified_type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::cv_traits_imp::unqualified_type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_cv,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const[N],T type[N]) @@ -33,7 +38,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T vol BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace detail { template @@ -45,12 +50,12 @@ struct remove_cv_impl }; } -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename detail::remove_cv_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::remove_cv_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_REMOVE_CV_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_extent.hpp b/boost/boost/type_traits/remove_extent.hpp index 693f1afe88..32dee6fe14 100644 --- a/boost/boost/type_traits/remove_extent.hpp +++ b/boost/boost/type_traits/remove_extent.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED #define BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED -#include "boost/config.hpp" +#include +#include #include +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatil } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_pointer.hpp b/boost/boost/type_traits/remove_pointer.hpp index 01b27120ad..53599928c1 100644 --- a/boost/boost/type_traits/remove_pointer.hpp +++ b/boost/boost/type_traits/remove_pointer.hpp @@ -9,11 +9,16 @@ #ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/config.hpp" +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -25,14 +30,14 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename detail::remove_pointer_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename boost::detail::remove_pointer_impl::type) #endif } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_reference.hpp b/boost/boost/type_traits/remove_reference.hpp index 9986a03462..3d0b7075ef 100644 --- a/boost/boost/type_traits/remove_reference.hpp +++ b/boost/boost/type_traits/remove_reference.hpp @@ -9,11 +9,16 @@ #ifndef BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED #define BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/config.hpp" +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -32,14 +37,14 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& volatile, BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const volatile,T) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename detail::remove_reference_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_reference_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED diff --git a/boost/boost/type_traits/remove_volatile.hpp b/boost/boost/type_traits/remove_volatile.hpp index 443ce739ed..723ebe35af 100644 --- a/boost/boost/type_traits/remove_volatile.hpp +++ b/boost/boost/type_traits/remove_volatile.hpp @@ -11,15 +11,20 @@ #ifndef BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED #define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include #include +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include namespace boost { @@ -52,21 +57,21 @@ struct remove_volatile_impl // * convert a type T to a non-volatile type - remove_volatile -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename detail::remove_volatile_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename detail::remove_volatile_impl::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include #endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED diff --git a/boost/boost/type_traits/same_traits.hpp b/boost/boost/type_traits/same_traits.hpp index 899193cbd7..dab7dac783 100644 --- a/boost/boost/type_traits/same_traits.hpp +++ b/boost/boost/type_traits/same_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_SAME_TRAITS_HPP_INCLUDED #define BOOST_TT_SAME_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_same.hpp" +#include #endif // BOOST_TT_SAME_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/transform_traits.hpp b/boost/boost/type_traits/transform_traits.hpp index 6c2d7a304f..7a82f1ca91 100644 --- a/boost/boost/type_traits/transform_traits.hpp +++ b/boost/boost/type_traits/transform_traits.hpp @@ -12,10 +12,10 @@ #ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED #define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED -#include "boost/type_traits/add_pointer.hpp" -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/remove_bounds.hpp" -#include "boost/type_traits/remove_pointer.hpp" -#include "boost/type_traits/remove_reference.hpp" +#include +#include +#include +#include +#include #endif // BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED diff --git a/boost/boost/type_traits/transform_traits_spec.hpp b/boost/boost/type_traits/transform_traits_spec.hpp index 4ab6e77caf..851af3d39f 100644 --- a/boost/boost/type_traits/transform_traits_spec.hpp +++ b/boost/boost/type_traits/transform_traits_spec.hpp @@ -9,6 +9,6 @@ #ifndef BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED #define BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" +#include #endif // BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED diff --git a/boost/boost/type_traits/type_with_alignment.hpp b/boost/boost/type_traits/type_with_alignment.hpp index b6d9a1cf2d..49816d2801 100644 --- a/boost/boost/type_traits/type_with_alignment.hpp +++ b/boost/boost/type_traits/type_with_alignment.hpp @@ -8,19 +8,19 @@ #ifndef BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED #define BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED -#include "boost/mpl/if.hpp" -#include "boost/preprocessor/list/for_each_i.hpp" -#include "boost/preprocessor/tuple/to_list.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/list/transform.hpp" -#include "boost/preprocessor/list/append.hpp" -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/static_assert.hpp" -#include "boost/config.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include #include @@ -192,11 +192,11 @@ struct is_pod< ::boost::detail::lower_alignment > template class type_with_alignment { - typedef detail::lower_alignment t1; + typedef ::boost::detail::lower_alignment t1; typedef typename mpl::if_c< ::boost::detail::is_aligned< ::boost::alignment_of::value,Align >::value , t1 - , detail::max_align + , ::boost::detail::max_align >::type align_t; BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of::value); @@ -281,7 +281,7 @@ template <> struct type_with_alignment<16>{ typedef align::a16 type; }; # pragma warning(pop) #endif -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include #endif // BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED diff --git a/boost/boost/version.hpp b/boost/boost/version.hpp index 37519ef328..b16973e4f8 100644 --- a/boost/boost/version.hpp +++ b/boost/boost/version.hpp @@ -19,15 +19,15 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 103301 +#define BOOST_VERSION 103400 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION // but as a *string* in the form "x_y" where x is the major version -// number and y is the minor version number. This is used by +// number and y is the minor version number. This is used by // to select which library version to link to. -#define BOOST_LIB_VERSION "1_33_1" +#define BOOST_LIB_VERSION "1_34" #endif diff --git a/boost/boost/weak_ptr.hpp b/boost/boost/weak_ptr.hpp index c238500793..8f4230fb02 100644 --- a/boost/boost/weak_ptr.hpp +++ b/boost/boost/weak_ptr.hpp @@ -13,6 +13,8 @@ // See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation. // +#include // boost.TR1 include order fix +#include #include #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash @@ -69,7 +71,7 @@ public: { } -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) template weak_ptr & operator=(weak_ptr const & r) // never throws @@ -139,7 +141,7 @@ public: pn.swap(other.pn); } - void _internal_assign(T * px2, detail::shared_count const & pn2) + void _internal_assign(T * px2, boost::detail::shared_count const & pn2) { px = px2; pn = pn2; @@ -162,8 +164,8 @@ private: #endif - T * px; // contained pointer - detail::weak_count pn; // reference counter + T * px; // contained pointer + boost::detail::weak_count pn; // reference counter }; // weak_ptr diff --git a/boost/libs/filesystem/src/Makefile.am b/boost/libs/filesystem/src/Makefile.am index a6264adf0f..e05a91d751 100644 --- a/boost/libs/filesystem/src/Makefile.am +++ b/boost/libs/filesystem/src/Makefile.am @@ -12,8 +12,7 @@ AM_CPPFLAGS += \ $(BOOST_INCLUDES) libboost_filesystem_la_SOURCES = \ - convenience.cpp \ exception.cpp \ - Makefile.am \ - operations_posix_windows.cpp \ - path_posix_windows.cpp + operations.cpp \ + path.cpp \ + portability.cpp diff --git a/boost/libs/filesystem/src/convenience.cpp b/boost/libs/filesystem/src/convenience.cpp deleted file mode 100644 index a40333ce13..0000000000 --- a/boost/libs/filesystem/src/convenience.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// libs/filesystem/src/convenience.cpp -------------------------------------// - -// © Copyright Beman Dawes, 2002 -// © Copyright Vladimir Prus, 2002 -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -// define BOOST_FILESYSTEM_SOURCE so that knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#include -#include -#include - -#include // must be the last header - -namespace boost -{ - namespace filesystem - { - -// create_directories (contributed by Vladimir Prus) -----------------------// - - BOOST_FILESYSTEM_DECL bool create_directories(const path& ph) - { - if (ph.empty() || exists(ph)) - { - if ( !ph.empty() && !is_directory(ph) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::create_directories", - ph, "path exists and is not a directory", - not_directory_error ) ); - return false; - } - - // First create branch, by calling ourself recursively - create_directories(ph.branch_path()); - // Now that parent's path exists, create the directory - create_directory(ph); - return true; - } - - BOOST_FILESYSTEM_DECL std::string extension(const path& ph) - { - std::string leaf = ph.leaf(); - - std::string::size_type n = leaf.rfind('.'); - if (n != std::string::npos) - return leaf.substr(n); - else - return std::string(); - } - - BOOST_FILESYSTEM_DECL std::string basename(const path& ph) - { - std::string leaf = ph.leaf(); - - std::string::size_type n = leaf.rfind('.'); - return leaf.substr(0, n); - } - - BOOST_FILESYSTEM_DECL path change_extension(const path& ph, const std::string& new_extension) - { - return ph.branch_path() / (basename(ph) + new_extension); - } - - - } // namespace filesystem -} // namespace boost diff --git a/boost/libs/filesystem/src/exception.cpp b/boost/libs/filesystem/src/exception.cpp index 3d4afce296..83f066e51b 100644 --- a/boost/libs/filesystem/src/exception.cpp +++ b/boost/libs/filesystem/src/exception.cpp @@ -1,7 +1,7 @@ // Exception implementation file -------------------------------------------// -// Copyright © 2002 Beman Dawes -// Copyright © 2001 Dietmar Kühl +// Copyright 2002 Beman Dawes +// Copyright 2001 Dietmar Kuehl // 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) @@ -15,298 +15,152 @@ #define BOOST_FILESYSTEM_SOURCE #include -#include +#include +#include namespace fs = boost::filesystem; #include // SGI MIPSpro compilers need this -#include # ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::strerror; } # endif -// BOOST_POSIX or BOOST_WINDOWS specify which API to use. -# if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX ) -# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) -# define BOOST_WINDOWS -# else -# define BOOST_POSIX -# endif -# endif -# if defined( BOOST_WINDOWS ) +# if defined( BOOST_WINDOWS_API ) # include "windows.h" -# else -# include // for POSIX error codes # endif -#include // must be the last header - //----------------------------------------------------------------------------// namespace { -# ifdef BOOST_WINDOWS - std::string system_message( int sys_err_code ) - { - std::string str; - LPVOID lpMsgBuf; - ::FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - sys_err_code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR) &lpMsgBuf, - 0, - NULL - ); - str += static_cast(lpMsgBuf); - ::LocalFree( lpMsgBuf ); // free the buffer - while ( str.size() - && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') ) - str.erase( str.size()-1 ); - return str; - } -# else - std::string system_message( int ) - { - std::string str; - str += std::strerror( errno ); - return str; - } -# endif - - struct ec_xlate { int sys_ec; fs::error_code ec; }; +#ifdef BOOST_WINDOWS_API + struct ec_xlate { fs::system_error_type sys_ec; fs::errno_type ec; }; const ec_xlate ec_table[] = { -# ifdef BOOST_WINDOWS - { ERROR_ACCESS_DENIED, fs::security_error }, - { ERROR_INVALID_ACCESS, fs::security_error }, - { ERROR_SHARING_VIOLATION, fs::security_error }, - { ERROR_LOCK_VIOLATION, fs::security_error }, - { ERROR_LOCKED, fs::security_error }, - { ERROR_NOACCESS, fs::security_error }, - { ERROR_WRITE_PROTECT, fs::read_only_error }, - { ERROR_NOT_READY, fs::io_error }, - { ERROR_SEEK, fs::io_error }, - { ERROR_READ_FAULT, fs::io_error }, - { ERROR_WRITE_FAULT, fs::io_error }, - { ERROR_CANTOPEN, fs::io_error }, - { ERROR_CANTREAD, fs::io_error }, - { ERROR_CANTWRITE, fs::io_error }, - { ERROR_DIRECTORY, fs::path_error }, - { ERROR_INVALID_NAME, fs::path_error }, - { ERROR_FILE_NOT_FOUND, fs::not_found_error }, - { ERROR_PATH_NOT_FOUND, fs::not_found_error }, - { ERROR_DEV_NOT_EXIST, fs::not_found_error }, - { ERROR_DEVICE_IN_USE, fs::busy_error }, - { ERROR_OPEN_FILES, fs::busy_error }, - { ERROR_BUSY_DRIVE, fs::busy_error }, - { ERROR_BUSY, fs::busy_error }, - { ERROR_FILE_EXISTS, fs::already_exists_error }, - { ERROR_ALREADY_EXISTS, fs::already_exists_error }, - { ERROR_DIR_NOT_EMPTY, fs::not_empty_error }, - { ERROR_HANDLE_DISK_FULL, fs::out_of_space_error }, - { ERROR_DISK_FULL, fs::out_of_space_error }, - { ERROR_OUTOFMEMORY, fs::out_of_memory_error }, - { ERROR_NOT_ENOUGH_MEMORY, fs::out_of_memory_error }, - { ERROR_TOO_MANY_OPEN_FILES, fs::out_of_resource_error } -# else - { EACCES, fs::security_error }, - { EROFS, fs::read_only_error }, - { EIO, fs::io_error }, - { ENAMETOOLONG, fs::path_error }, - { ENOENT, fs::not_found_error }, - { ENOTDIR, fs::not_directory_error }, - { EAGAIN, fs::busy_error }, - { EBUSY, fs::busy_error }, - { ETXTBSY, fs::busy_error }, - { EEXIST, fs::already_exists_error }, - { ENOTEMPTY, fs::not_empty_error }, - { EISDIR, fs::is_directory_error }, - { ENOSPC, fs::out_of_space_error }, - { ENOMEM, fs::out_of_memory_error }, - { EMFILE, fs::out_of_resource_error } -# endif + // see WinError.h comments for descriptions of errors + + // most common errors first to speed sequential search + { ERROR_FILE_NOT_FOUND, ENOENT }, + { ERROR_PATH_NOT_FOUND, ENOENT }, + + // alphabetical for easy maintenance + { 0, 0 }, // no error + { ERROR_ACCESS_DENIED, EACCES }, + { ERROR_ALREADY_EXISTS, EEXIST }, + { ERROR_BAD_UNIT, ENODEV }, + { ERROR_BUFFER_OVERFLOW, ENAMETOOLONG }, + { ERROR_BUSY, EBUSY }, + { ERROR_BUSY_DRIVE, EBUSY }, + { ERROR_CANNOT_MAKE, EACCES }, + { ERROR_CANTOPEN, EIO }, + { ERROR_CANTREAD, EIO }, + { ERROR_CANTWRITE, EIO }, + { ERROR_CURRENT_DIRECTORY, EACCES }, + { ERROR_DEV_NOT_EXIST, ENODEV }, + { ERROR_DEVICE_IN_USE, EBUSY }, + { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, + { ERROR_DIRECTORY, EINVAL }, // WinError.h: "The directory name is invalid" + { ERROR_DISK_FULL, ENOSPC }, + { ERROR_FILE_EXISTS, EEXIST }, + { ERROR_HANDLE_DISK_FULL, ENOSPC }, + { ERROR_INVALID_ACCESS, EACCES }, + { ERROR_INVALID_DRIVE, ENODEV }, + { ERROR_INVALID_FUNCTION, ENOSYS }, + { ERROR_INVALID_HANDLE, EBADHANDLE }, + { ERROR_INVALID_NAME, EINVAL }, + { ERROR_LOCK_VIOLATION, EACCES }, + { ERROR_LOCKED, EACCES }, + { ERROR_NOACCESS, EACCES }, + { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, + { ERROR_NOT_READY, EAGAIN }, + { ERROR_NOT_SAME_DEVICE, EXDEV }, + { ERROR_OPEN_FAILED, EIO }, + { ERROR_OPEN_FILES, EBUSY }, + { ERROR_OUTOFMEMORY, ENOMEM }, + { ERROR_READ_FAULT, EIO }, + { ERROR_SEEK, EIO }, + { ERROR_SHARING_VIOLATION, EACCES }, + { ERROR_TOO_MANY_OPEN_FILES, ENFILE }, + { ERROR_WRITE_FAULT, EIO }, + { ERROR_WRITE_PROTECT, EROFS }, + { 0,EOTHER } }; +#endif - fs::error_code lookup_error( int sys_err_code ) - { - for ( const ec_xlate * cur = &ec_table[0]; - cur != ec_table - + sizeof(ec_table)/sizeof(ec_xlate); ++cur ) - { - if ( sys_err_code == cur->sys_ec ) return cur->ec; - } - return fs::system_error; // general system error code - } - - // These helper functions work for POSIX and Windows. For systems where - // path->native_file_string() != path->native_directory_string(), more - // care would be required to get the right form for the function involved. - - std::string other_error_prep( - const std::string & who, - const std::string & message ) - { - return who + ": " + message; - } - - std::string other_error_prep( - const std::string & who, - const fs::path & path1, - const std::string & message ) - { - return who + ": \"" + path1.native_file_string() + "\": " + message; - } - - std::string system_error_prep( - const std::string & who, - const fs::path & path1, - int sys_err_code ) - { - return who + ": \"" + path1.native_file_string() + "\": " - + system_message( sys_err_code ); - } - - std::string system_error_prep( - const std::string & who, - const fs::path & path1, - const fs::path & path2, - int sys_err_code ) - { - return who + ": \"" + path1.native_file_string() - + "\", \"" + path2.native_file_string() + "\": " - + system_message( sys_err_code ); - } - - const fs::path empty_path; - const std::string empty_string; } // unnamed namespace namespace boost { namespace filesystem { -// filesystem_error m_imp class --------------------------------------------// -// see www.boost.org/more/error_handling.html for implementation rationale - - class filesystem_error::m_imp - { - public: - std::string m_who; - path m_path1; - path m_path2; - std::string m_what; - }; - - -// filesystem_error implementation -----------------------------------------// +# ifdef BOOST_WINDOWS_API - filesystem_error::filesystem_error( - const std::string & who, - const std::string & message ) - : m_sys_err(0), m_err(other_error) + BOOST_FILESYSTEM_DECL + errno_type lookup_errno( system_error_type sys_err_code ) { - try + for ( const ec_xlate * cur = &ec_table[0]; + cur != ec_table + + sizeof(ec_table)/sizeof(ec_xlate); ++cur ) { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_who = who; - m_imp_ptr->m_what = other_error_prep( who, message ); + if ( sys_err_code == cur->sys_ec ) return cur->ec; } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error::filesystem_error( - const std::string & who, - const path & path1, - const std::string & message, - error_code ec ) - : m_sys_err(0), m_err(ec) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_who = who; - m_imp_ptr->m_what = other_error_prep( who, path1, message ); - m_imp_ptr->m_path1 = path1; - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error::filesystem_error( - const std::string & who, - const path & path1, - int sys_err_code ) - : m_sys_err(sys_err_code), m_err(lookup_error(sys_err_code)) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_who = who; - m_imp_ptr->m_what = system_error_prep( who, path1, sys_err_code ); - m_imp_ptr->m_path1 = path1; - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error::filesystem_error( - const std::string & who, - const path & path1, - const path & path2, - int sys_err_code ) - : m_sys_err(sys_err_code), m_err(lookup_error(sys_err_code)) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_who = who; - m_imp_ptr->m_what = system_error_prep( who, path1, path2, sys_err_code ); - m_imp_ptr->m_path1 = path1; - m_imp_ptr->m_path2 = path2; - } - catch (...) { m_imp_ptr.reset(); } + return EOTHER; } - filesystem_error::~filesystem_error() throw() + BOOST_FILESYSTEM_DECL void + system_message( system_error_type sys_err_code, std::string & target ) { + LPVOID lpMsgBuf; + ::FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + sys_err_code, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR) &lpMsgBuf, + 0, + NULL + ); + target += static_cast(lpMsgBuf); + ::LocalFree( lpMsgBuf ); // free the buffer + while ( target.size() + && (target[target.size()-1] == '\n' || target[target.size()-1] == '\r') ) + target.erase( target.size()-1 ); } - const std::string & filesystem_error::who() const +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + BOOST_FILESYSTEM_DECL void + system_message( system_error_type sys_err_code, std::wstring & target ) { - return m_imp_ptr.get() == 0 ? empty_string : m_imp_ptr->m_who; + LPVOID lpMsgBuf; + ::FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + sys_err_code, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPWSTR) &lpMsgBuf, + 0, + NULL + ); + target += static_cast(lpMsgBuf); + ::LocalFree( lpMsgBuf ); // free the buffer + while ( target.size() + && (target[target.size()-1] == L'\n' || target[target.size()-1] == L'\r') ) + target.erase( target.size()-1 ); } - - const path & filesystem_error::path1() const - { - return m_imp_ptr.get() == 0 ? empty_path : m_imp_ptr->m_path1; - } - - const path & filesystem_error::path2() const - { - return m_imp_ptr.get() == 0 ? empty_path : m_imp_ptr->m_path2; - } - - const char * filesystem_error::what() const throw() +# endif +# else + void + system_message( system_error_type sys_err_code, std::string & target ) { - return m_imp_ptr.get() == 0 ? empty_string.c_str() - : m_imp_ptr->m_what.c_str(); + target += std::strerror( sys_err_code ); } +# endif - namespace detail - { - BOOST_FILESYSTEM_DECL int system_error_code() // artifact of POSIX and WINDOWS error reporting - { - # ifdef BOOST_WINDOWS - return ::GetLastError(); - # else - return errno; // GCC 3.1 won't accept ::errno - # endif - } - } // namespace detail } // namespace filesystem } // namespace boost - diff --git a/boost/libs/filesystem/src/operations.cpp b/boost/libs/filesystem/src/operations.cpp new file mode 100644 index 0000000000..79c2959d30 --- /dev/null +++ b/boost/libs/filesystem/src/operations.cpp @@ -0,0 +1,1292 @@ +// operations.cpp ----------------------------------------------------------// + +// Copyright 2002-2005 Beman Dawes +// Copyright 2001 Dietmar Kuehl +// 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) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this + +#if !(defined(__HP_aCC) && defined(_ILP32) && \ + !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) +# define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, +#endif + +#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX + // 64-bit systems or on 32-bit systems which don't have files larger + // than can be represented by a traditional POSIX/UNIX off_t type. + // OTOH, defining them should kick in 64-bit off_t's (and thus + // st_size) on 32-bit systems that provide the Large File + // Support (LFS) interface, such as Linux, Solaris, and IRIX. + // The defines are given before any headers are included to + // ensure that they are available to all included headers. + // That is required at least on Solaris, and possibly on other + // systems as well. + +// for some compilers (CodeWarrior, for example), windows.h +// is getting included by some other boost header, so do this early: +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT 0x0500 // Default to Windows 2K or later +#endif + + +#include +#include +#include +#include + +namespace fs = boost::filesystem; + +# if defined(BOOST_WINDOWS_API) +# include "windows.h" +# if defined(__BORLANDC__) || defined(__MWERKS__) +# if defined(__BORLANDC__) + using std::time_t; +# endif +# include "utime.h" +# else +# include "sys/utime.h" +# endif + +# else // BOOST_POSIX_API +# include +# ifndef __APPLE__ +# include +# define BOOST_STATVFS statvfs +# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize +# else +# include +# define BOOST_STATVFS statfs +# define BOOST_STATVFS_F_FRSIZE static_cast( vfs.f_bsize ) +# endif +# include "dirent.h" +# include "unistd.h" +# include "fcntl.h" +# include "utime.h" +# include "limits.h" +# endif + +// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in +// dir_itr_increment. The config tests are placed here because some of the +// macros being tested come from dirent.h. +// +// TODO: find out what macros indicate dirent::d_type present in more libraries +# if defined(BOOST_WINDOWS_API) \ + || defined(_DIRENT_HAVE_D_TYPE) // defined by GNU C library if d_type present +# define BOOST_FILESYSTEM_STATUS_CACHE +# endif + +#include // even on Windows some functions use stat() +#include +#include +#include // for remove, rename +#include +#include +// #include // for debugging only; comment out when not in use + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::strcmp; using ::remove; using ::rename; } +#endif + +// helpers -----------------------------------------------------------------// + +namespace +{ + static const fs::directory_iterator end_itr; + bool is_empty_directory( const std::string & dir_path ) + { + return fs::directory_iterator(fs::path(dir_path)) == end_itr; + } + +#ifdef BOOST_WINDOWS_API + +// For Windows, the xxxA form of various function names is used to avoid +// inadvertently getting wide forms of the functions. (The undecorated +// forms are actually macros, so can misfire if the user has various +// other macros defined. There was a bug report of this happening.) + + inline DWORD get_file_attributes( const char * ph ) + { return ::GetFileAttributesA( ph ); } + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + inline DWORD get_file_attributes( const wchar_t * ph ) + { return ::GetFileAttributesW( ph ); } + + static const fs::wdirectory_iterator wend_itr; + bool is_empty_directory( const std::wstring & dir_path ) + { + return fs::wdirectory_iterator(fs::wpath(dir_path)) == wend_itr; + } + + inline BOOL get_file_attributes_ex( const wchar_t * ph, + WIN32_FILE_ATTRIBUTE_DATA & fad ) + { return ::GetFileAttributesExW( ph, ::GetFileExInfoStandard, &fad ); } + + HANDLE create_file( const wchar_t * ph, DWORD dwDesiredAccess, + DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile ) + { + return ::CreateFileW( ph, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile ); + } + + inline DWORD get_current_directory( DWORD sz, wchar_t * buf ) + { return ::GetCurrentDirectoryW( sz, buf ); } + + inline bool get_free_disk_space( const std::wstring & ph, + PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) + { return ::GetDiskFreeSpaceExW( ph.c_str(), avail, total, free ) != 0; } + + inline std::size_t get_full_path_name( + const std::wstring & ph, std::size_t len, wchar_t * buf, wchar_t ** p ) + { + return static_cast( + ::GetFullPathNameW( ph.c_str(), + static_cast(len), buf, p )); + } + + inline bool remove_directory( const std::wstring & ph ) + { return ::RemoveDirectoryW( ph.c_str() ) != 0; } + + inline bool delete_file( const std::wstring & ph ) + { return ::DeleteFileW( ph.c_str() ) != 0; } + + inline bool create_directory( const std::wstring & dir ) + { return ::CreateDirectoryW( dir.c_str(), 0 ) != 0; } + +#if _WIN32_WINNT >= 0x500 + inline bool create_hard_link( const std::wstring & to_ph, + const std::wstring & from_ph ) + { return ::CreateHardLinkW( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } +#endif + +# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY + + template< class String > + fs::file_status status_template( const String & ph, fs::system_error_type & ec ) + { + DWORD attr( get_file_attributes( ph.c_str() ) ); + if ( attr == 0xFFFFFFFF ) + { + ec = ::GetLastError(); + if ((ec == ERROR_FILE_NOT_FOUND) + || (ec == ERROR_PATH_NOT_FOUND) + || (ec == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo" + || (ec == ERROR_INVALID_PARAMETER) // ":sys:stat.h" + || (ec == ERROR_BAD_NETPATH)) + { + ec = 0; // these are not considered errors + return fs::file_status( fs::file_not_found ); + } + return fs::file_status( fs::status_unknown ); + } + ec = 0; + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? fs::file_status( fs::directory_file ) + : fs::file_status( fs::regular_file ); + } + + BOOL get_file_attributes_ex( const char * ph, + WIN32_FILE_ATTRIBUTE_DATA & fad ) + { return ::GetFileAttributesExA( ph, ::GetFileExInfoStandard, &fad ); } + + template< class String > + boost::filesystem::detail::query_pair + is_empty_template( const String & ph ) + { + WIN32_FILE_ATTRIBUTE_DATA fad; + if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) + return std::make_pair( ::GetLastError(), false ); + return std::make_pair( 0, + ( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + ? is_empty_directory( ph ) + :( !fad.nFileSizeHigh && !fad.nFileSizeLow ) ); + } + + HANDLE create_file( const char * ph, DWORD dwDesiredAccess, + DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile ) + { + return ::CreateFileA( ph, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile ); + } + + // Thanks to Jeremy Maitin-Shepard for much help and for permission to + // base the equivalent() implementation on portions of his + // file-equivalence-win32.cpp experimental code. + struct handle_wrapper + { + HANDLE handle; + handle_wrapper( HANDLE h ) + : handle(h) {} + ~handle_wrapper() + { + if ( handle != INVALID_HANDLE_VALUE ) + ::CloseHandle(handle); + } + }; + + template< class String > + boost::filesystem::detail::query_pair + equivalent_template( const String & ph1, const String & ph2 ) + { + // Note well: Physical location on external media is part of the + // equivalence criteria. If there are no open handles, physical location + // can change due to defragmentation or other relocations. Thus handles + // must be held open until location information for both paths has + // been retrieved. + handle_wrapper p1( + create_file( + ph1.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0 ) ); + int error1(0); // save error code in case we have to throw + if ( p1.handle == INVALID_HANDLE_VALUE ) + error1 = ::GetLastError(); + handle_wrapper p2( + create_file( + ph2.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0 ) ); + if ( p1.handle == INVALID_HANDLE_VALUE + || p2.handle == INVALID_HANDLE_VALUE ) + { + if ( p1.handle != INVALID_HANDLE_VALUE + || p2.handle != INVALID_HANDLE_VALUE ) + { return std::make_pair( 0, false ); } + assert( p1.handle == INVALID_HANDLE_VALUE + && p2.handle == INVALID_HANDLE_VALUE ); + { return std::make_pair( error1, false ); } + } + // at this point, both handles are known to be valid + BY_HANDLE_FILE_INFORMATION info1, info2; + if ( !::GetFileInformationByHandle( p1.handle, &info1 ) ) + { return std::make_pair( ::GetLastError(), false ); } + if ( !::GetFileInformationByHandle( p2.handle, &info2 ) ) + { return std::make_pair( ::GetLastError(), false ); } + // In theory, volume serial numbers are sufficient to distinguish between + // devices, but in practice VSN's are sometimes duplicated, so last write + // time and file size are also checked. + return std::make_pair( 0, + info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber + && info1.nFileIndexHigh == info2.nFileIndexHigh + && info1.nFileIndexLow == info2.nFileIndexLow + && info1.nFileSizeHigh == info2.nFileSizeHigh + && info1.nFileSizeLow == info2.nFileSizeLow + && info1.ftLastWriteTime.dwLowDateTime + == info2.ftLastWriteTime.dwLowDateTime + && info1.ftLastWriteTime.dwHighDateTime + == info2.ftLastWriteTime.dwHighDateTime ); + } + + template< class String > + boost::filesystem::detail::uintmax_pair + file_size_template( const String & ph ) + { + WIN32_FILE_ATTRIBUTE_DATA fad; + // by now, intmax_t is 64-bits on all Windows compilers + if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) + return std::make_pair( ::GetLastError(), 0 ); + if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 ) + return std::make_pair( ERROR_FILE_NOT_FOUND, 0 ); + return std::make_pair( 0, + (static_cast(fad.nFileSizeHigh) + << (sizeof(fad.nFileSizeLow)*8)) + + fad.nFileSizeLow ); + } + + inline bool get_free_disk_space( const std::string & ph, + PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) + { return ::GetDiskFreeSpaceExA( ph.c_str(), avail, total, free ) != 0; } + + template< class String > + boost::filesystem::detail::space_pair + space_template( String & ph ) + { + ULARGE_INTEGER avail, total, free; + boost::filesystem::detail::space_pair result; + if ( get_free_disk_space( ph, &avail, &total, &free ) ) + { + result.first = 0; + result.second.capacity + = (static_cast(total.HighPart) << 32) + + total.LowPart; + result.second.free + = (static_cast(free.HighPart) << 32) + + free.LowPart; + result.second.available + = (static_cast(avail.HighPart) << 32) + + avail.LowPart; + } + else + { + result.first = ::GetLastError(); + result.second.capacity = result.second.free + = result.second.available = 0; + } + return result; + } + + inline DWORD get_current_directory( DWORD sz, char * buf ) + { return ::GetCurrentDirectoryA( sz, buf ); } + + template< class String > + boost::filesystem::system_error_type + get_current_path_template( String & ph ) + { + DWORD sz; + if ( (sz = get_current_directory( 0, + static_cast(0) )) == 0 ) + { sz = 1; } + typedef typename String::value_type value_type; + boost::scoped_array buf( new value_type[sz] ); + if ( get_current_directory( sz, buf.get() ) == 0 ) + return ::GetLastError(); + ph = buf.get(); + return 0; + } + + inline std::size_t get_full_path_name( + const std::string & ph, std::size_t len, char * buf, char ** p ) + { + return static_cast( + ::GetFullPathNameA( ph.c_str(), + static_cast(len), buf, p )); + } + + const std::size_t buf_size( 128 ); + + template + boost::filesystem::system_error_type + get_full_path_name_template( const String & ph, String & target ) + { + typename String::value_type buf[buf_size]; + typename String::value_type * pfn; + std::size_t len = get_full_path_name( ph, + buf_size , buf, &pfn ); + if ( len == 0 ) return ::GetLastError(); + if ( len > buf_size ) + { + typedef typename String::value_type value_type; + boost::scoped_array big_buf( new value_type[len] ); + if ( (len=get_full_path_name( ph, len , big_buf.get(), &pfn )) + == 0 ) return ::GetLastError(); + big_buf[len] = '\0'; + target = big_buf.get(); + return 0; + } + buf[len] = '\0'; + target = buf; + return 0; + } + + template + boost::filesystem::system_error_type + get_file_write_time( const String & ph, FILETIME & last_write_time ) + { + handle_wrapper hw( + create_file( ph.c_str(), 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); + if ( hw.handle == INVALID_HANDLE_VALUE ) + return ::GetLastError(); + return ::GetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 + ? 0 : ::GetLastError(); + } + + template + boost::filesystem::system_error_type + set_file_write_time( const String & ph, const FILETIME & last_write_time ) + { + handle_wrapper hw( + create_file( ph.c_str(), FILE_WRITE_ATTRIBUTES, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); + if ( hw.handle == INVALID_HANDLE_VALUE ) + return ::GetLastError(); + return ::SetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 + ? 0 : ::GetLastError(); + } + + // these constants come from inspecting some Microsoft sample code + std::time_t to_time_t( const FILETIME & ft ) + { + __int64 t = (static_cast<__int64>( ft.dwHighDateTime ) << 32) + + ft.dwLowDateTime; +# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 + t -= 116444736000000000LL; +# else + t -= 116444736000000000; +# endif + t /= 10000000; + return static_cast( t ); + } + + void to_FILETIME( std::time_t t, FILETIME & ft ) + { + __int64 temp = t; + temp *= 10000000; +# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 + temp += 116444736000000000LL; +# else + temp += 116444736000000000; +# endif + ft.dwLowDateTime = static_cast( temp ); + ft.dwHighDateTime = static_cast( temp >> 32 ); + } + + template + boost::filesystem::detail::time_pair + last_write_time_template( const String & ph ) + { + FILETIME lwt; + boost::filesystem::system_error_type result + = get_file_write_time( ph, lwt ); + return std::make_pair( result, to_time_t( lwt ) ); + } + + template + boost::filesystem::system_error_type + last_write_time_template( const String & ph, const std::time_t new_time ) + { + FILETIME lwt; + to_FILETIME( new_time, lwt ); + return set_file_write_time( ph, lwt ); + } + + bool remove_directory( const std::string & ph ) + { return ::RemoveDirectoryA( ph.c_str() ) != 0; } + + bool delete_file( const std::string & ph ) + { return ::DeleteFileA( ph.c_str() ) != 0; } + + template + boost::filesystem::system_error_type + remove_template( const String & ph ) + { + fs::system_error_type ec; + fs::file_status sf( fs::detail::status_api( ph, ec ) ); + if ( ec ) return ec; + if ( fs::is_directory( sf ) ) + { + if ( !remove_directory( ph ) ) + return ::GetLastError(); + } + else + { + if ( !delete_file( ph ) ) return ::GetLastError(); + } + return 0; + } + + inline bool create_directory( const std::string & dir ) + { return ::CreateDirectoryA( dir.c_str(), 0 ) != 0; } + + template + boost::filesystem::detail::query_pair + create_directory_template( const String & dir_ph ) + { + boost::filesystem::system_error_type error(0), dummy; + if ( create_directory( dir_ph ) ) return std::make_pair( error, true ); + error = ::GetLastError(); + // an error here may simply mean the postcondition is already met + if ( error == ERROR_ALREADY_EXISTS + && fs::is_directory( fs::detail::status_api( dir_ph, dummy ) ) ) + return std::make_pair( 0, false ); + return std::make_pair( error, false ); + } + +#if _WIN32_WINNT >= 0x500 + inline bool create_hard_link( const std::string & to_ph, + const std::string & from_ph ) + { return ::CreateHardLinkA( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } +#endif + +#if _WIN32_WINNT >= 0x500 + template + boost::filesystem::system_error_type + create_hard_link_template( const String & to_ph, + const String & from_ph ) + { + return fs::system_error_type( create_hard_link( to_ph.c_str(), from_ph.c_str() ) + ? 0 : ::GetLastError() ); + } +#endif + +#endif +} // unnamed namespace + +namespace boost +{ + namespace filesystem + { + namespace detail + { + +#if defined(BOOST_WINDOWS_API) + BOOST_FILESYSTEM_DECL system_error_type not_found_error = ERROR_PATH_NOT_FOUND; +#else + BOOST_FILESYSTEM_DECL system_error_type not_found_error = ENOENT; +#endif + +// free functions ----------------------------------------------------------// + + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() + { +# ifdef BOOST_POSIX_API + struct stat lcl_stat; + return sizeof( lcl_stat.st_size ) > 4; +# else + return true; +# endif + } + +# ifdef BOOST_WINDOWS_API + + BOOST_FILESYSTEM_DECL fs::file_status + status_api( const std::string & ph, fs::system_error_type & ec ) + { return status_template( ph, ec ); } + +# ifndef BOOST_FILESYSTEM_NARROW_ONLY + + BOOST_FILESYSTEM_DECL fs::file_status + status_api( const std::wstring & ph, fs::system_error_type & ec ) + { return status_template( ph, ec ); } + + BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::wstring & ) + { return false; } + + BOOST_FILESYSTEM_DECL + fs::detail::query_pair is_empty_api( const std::wstring & ph ) + { return is_empty_template( ph ); } + + BOOST_FILESYSTEM_DECL + fs::detail::query_pair + equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ) + { return equivalent_template( ph1, ph2 ); } + + BOOST_FILESYSTEM_DECL + fs::detail::uintmax_pair file_size_api( const std::wstring & ph ) + { return file_size_template( ph ); } + + BOOST_FILESYSTEM_DECL + fs::detail::space_pair space_api( const std::wstring & ph ) + { return space_template( ph ); } + + BOOST_FILESYSTEM_DECL + boost::filesystem::system_error_type + get_current_path_api( std::wstring & ph ) + { return get_current_path_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_full_path_name_api( const std::wstring & ph, std::wstring & target ) + { return get_full_path_name_template( ph, target ); } + + BOOST_FILESYSTEM_DECL time_pair + last_write_time_api( const std::wstring & ph ) + { return last_write_time_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + last_write_time_api( const std::wstring & ph, std::time_t new_value ) + { return last_write_time_template( ph, new_value ); } + + BOOST_FILESYSTEM_DECL fs::detail::query_pair + create_directory_api( const std::wstring & ph ) + { return create_directory_template( ph ); } + +#if _WIN32_WINNT >= 0x500 + BOOST_FILESYSTEM_DECL fs::system_error_type + create_hard_link_api( const std::wstring & to_ph, + const std::wstring & from_ph ) + { return create_hard_link_template( to_ph, from_ph ); } +#endif + + BOOST_FILESYSTEM_DECL fs::system_error_type + create_symlink_api( const std::wstring & to_ph, + const std::wstring & from_ph ) + { return ERROR_NOT_SUPPORTED; } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + remove_api( const std::wstring & ph ) { return remove_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + rename_api( const std::wstring & from, const std::wstring & to ) + { + return ::MoveFileW( from.c_str(), to.c_str() ) + ? 0 : ::GetLastError(); + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + copy_file_api( const std::wstring & from, const std::wstring & to ) + { + return ::CopyFileW( from.c_str(), to.c_str(), /*fail_if_exists=*/true ) + ? 0 : ::GetLastError(); + } + + BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, + std::ios_base::openmode mode ) // true if succeeds + { + DWORD access( + ((mode & std::ios_base::in) == 0 ? 0 : GENERIC_READ) + | ((mode & std::ios_base::out) == 0 ? 0 : GENERIC_WRITE) ); + + DWORD disposition(0); // see 27.8.1.3 Table 92 + if ( (mode&~std::ios_base::binary) + == (std::ios_base::out|std::ios_base::app) ) + disposition = OPEN_ALWAYS; + else if ( (mode&~(std::ios_base::binary|std::ios_base::out)) + == std::ios_base::in ) disposition = OPEN_EXISTING; + else if ( ((mode&~(std::ios_base::binary|std::ios_base::trunc)) + == std::ios_base::out ) + || ((mode&~std::ios_base::binary) + == (std::ios_base::in|std::ios_base::out|std::ios_base::trunc)) ) + disposition = CREATE_ALWAYS; + else assert( 0 && "invalid mode argument" ); + + HANDLE handle ( ::CreateFileW( ph.c_str(), access, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + disposition, (mode &std::ios_base::out) != 0 + ? FILE_ATTRIBUTE_ARCHIVE : FILE_ATTRIBUTE_NORMAL, 0 ) ); + if ( handle == INVALID_HANDLE_VALUE ) return false; + ::CloseHandle( handle ); + return true; + } + + BOOST_FILESYSTEM_DECL std::string narrow_path_api( + const std::wstring & ph ) // return is empty if fails + { + std::string narrow_short_form; + std::wstring short_form; + for ( DWORD buf_sz( static_cast( ph.size()+1 ));; ) + { + boost::scoped_array buf( new wchar_t[buf_sz] ); + DWORD sz( ::GetShortPathNameW( ph.c_str(), buf.get(), buf_sz ) ); + if ( sz == 0 ) return narrow_short_form; + if ( sz <= buf_sz ) + { + short_form += buf.get(); + break; + } + buf_sz = sz + 1; + } + // contributed by Takeshi Mouri: + int narrow_sz( ::WideCharToMultiByte( CP_ACP, 0, + short_form.c_str(), static_cast(short_form.size()), 0, 0, 0, 0 ) ); + boost::scoped_array narrow_buf( new char[narrow_sz] ); + ::WideCharToMultiByte( CP_ACP, 0, + short_form.c_str(), static_cast(short_form.size()), + narrow_buf.get(), narrow_sz, 0, 0 ); + narrow_short_form.assign(narrow_buf.get(), narrow_sz); + + return narrow_short_form; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_first( void *& handle, const std::wstring & dir, + std::wstring & target, file_status & sf, file_status & symlink_sf ) + { + // use a form of search Sebastian Martel reports will work with Win98 + std::wstring dirpath( dir ); + dirpath += (dirpath.empty() + || dirpath[dirpath.size()-1] != L'\\') ? L"\\*" : L"*"; + + WIN32_FIND_DATAW data; + if ( (handle = ::FindFirstFileW( dirpath.c_str(), &data )) + == INVALID_HANDLE_VALUE ) + { + handle = 0; + return ::GetLastError() == ERROR_FILE_NOT_FOUND + ? 0 : ::GetLastError(); + } + target = data.cFileName; + if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { sf.type( directory_file ); symlink_sf.type( directory_file ); } + else { sf.type( regular_file ); symlink_sf.type( regular_file ); } + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_increment( void *& handle, std::wstring & target, + file_status & sf, file_status & symlink_sf ) + { + WIN32_FIND_DATAW data; + if ( ::FindNextFileW( handle, &data ) == 0 ) // fails + { + int error = ::GetLastError(); + dir_itr_close( handle ); + return error == ERROR_NO_MORE_FILES ? 0 : error; + } + target = data.cFileName; + if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { sf.type( directory_file ); symlink_sf.type( directory_file ); } + else { sf.type( regular_file ); symlink_sf.type( regular_file ); } + return 0; + } + +# endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY + + // suggested by Walter Landry + BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::string & ) + { return false; } + + BOOST_FILESYSTEM_DECL + fs::detail::query_pair is_empty_api( const std::string & ph ) + { return is_empty_template( ph ); } + + BOOST_FILESYSTEM_DECL + fs::detail::query_pair + equivalent_api( const std::string & ph1, const std::string & ph2 ) + { return equivalent_template( ph1, ph2 ); } + + BOOST_FILESYSTEM_DECL + fs::detail::uintmax_pair file_size_api( const std::string & ph ) + { return file_size_template( ph ); } + + BOOST_FILESYSTEM_DECL + fs::detail::space_pair space_api( const std::string & ph ) + { return space_template( ph ); } + + BOOST_FILESYSTEM_DECL + boost::filesystem::system_error_type + get_current_path_api( std::string & ph ) + { return get_current_path_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + get_full_path_name_api( const std::string & ph, std::string & target ) + { return get_full_path_name_template( ph, target ); } + + BOOST_FILESYSTEM_DECL time_pair + last_write_time_api( const std::string & ph ) + { return last_write_time_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + last_write_time_api( const std::string & ph, std::time_t new_value ) + { return last_write_time_template( ph, new_value ); } + + BOOST_FILESYSTEM_DECL fs::detail::query_pair + create_directory_api( const std::string & ph ) + { return create_directory_template( ph ); } + +#if _WIN32_WINNT >= 0x500 + BOOST_FILESYSTEM_DECL fs::system_error_type + create_hard_link_api( const std::string & to_ph, + const std::string & from_ph ) + { return system_error_type( create_hard_link_template( to_ph, from_ph ) ); } +#endif + + BOOST_FILESYSTEM_DECL fs::system_error_type + create_symlink_api( const std::string & to_ph, + const std::string & from_ph ) + { return ERROR_NOT_SUPPORTED; } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + remove_api( const std::string & ph ) { return remove_template( ph ); } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + rename_api( const std::string & from, const std::string & to ) + { + return ::MoveFileA( from.c_str(), to.c_str() ) + ? 0 : ::GetLastError(); + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + copy_file_api( const std::string & from, const std::string & to ) + { + return ::CopyFileA( from.c_str(), to.c_str(), /*fail_if_exists=*/true ) + ? 0 : ::GetLastError(); + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_first( void *& handle, const std::string & dir, + std::string & target, file_status & sf, file_status & symlink_sf ) + // Note: an empty root directory has no "." or ".." entries, so this + // causes a ERROR_FILE_NOT_FOUND error which we do not considered an + // error. It is treated as eof instead. + { + // use a form of search Sebastian Martel reports will work with Win98 + std::string dirpath( dir ); + dirpath += (dirpath.empty() + || (dirpath[dirpath.size()-1] != '\\' + && dirpath[dirpath.size()-1] != ':')) ? "\\*" : "*"; + + WIN32_FIND_DATAA data; + if ( (handle = ::FindFirstFileA( dirpath.c_str(), &data )) + == INVALID_HANDLE_VALUE ) + { + handle = 0; + return ::GetLastError() == ERROR_FILE_NOT_FOUND + ? 0 : ::GetLastError(); + } + target = data.cFileName; + if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { sf.type( directory_file ); symlink_sf.type( directory_file ); } + else { sf.type( regular_file ); symlink_sf.type( regular_file ); } + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_close( void *& handle ) + { + if ( handle != 0 ) + { + bool ok = ::FindClose( handle ) != 0; + handle = 0; + return ok ? 0 : ::GetLastError(); + } + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_increment( void *& handle, std::string & target, + file_status & sf, file_status & symlink_sf ) + { + WIN32_FIND_DATAA data; + if ( ::FindNextFileA( handle, &data ) == 0 ) // fails + { + int error = ::GetLastError(); + dir_itr_close( handle ); + return error == ERROR_NO_MORE_FILES ? 0 : error; + } + target = data.cFileName; + if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { sf.type( directory_file ); symlink_sf.type( directory_file ); } + else { sf.type( regular_file ); symlink_sf.type( regular_file ); } + return 0; + } + +# else // BOOST_POSIX_API + + BOOST_FILESYSTEM_DECL fs::file_status + status_api( const std::string & ph, system_error_type & ec ) + { + struct stat path_stat; + if ( ::stat( ph.c_str(), &path_stat ) != 0 ) + { + if ( errno == ENOENT || errno == ENOTDIR ) + { + ec = 0; + return fs::file_status( fs::file_not_found ); + } + ec = errno; + return fs::file_status( fs::status_unknown ); + } + ec = 0; + if ( S_ISDIR( path_stat.st_mode ) ) + return fs::file_status( fs::directory_file ); + if ( S_ISREG( path_stat.st_mode ) ) + return fs::file_status( fs::regular_file ); + if ( S_ISBLK( path_stat.st_mode ) ) + return fs::file_status( fs::block_file ); + if ( S_ISCHR( path_stat.st_mode ) ) + return fs::file_status( fs::character_file ); + if ( S_ISFIFO( path_stat.st_mode ) ) + return fs::file_status( fs::fifo_file ); + if ( S_ISSOCK( path_stat.st_mode ) ) + return fs::file_status( fs::socket_file ); + return fs::file_status( fs::type_unknown ); + } + + BOOST_FILESYSTEM_DECL fs::file_status + symlink_status_api( const std::string & ph, system_error_type & ec ) + { + struct stat path_stat; + if ( ::lstat( ph.c_str(), &path_stat ) != 0 ) + { + if ( errno == ENOENT || errno == ENOTDIR ) + { + ec = 0; + return fs::file_status( fs::file_not_found ); + } + ec = errno; + return fs::file_status( fs::status_unknown ); + } + ec = 0; + if ( S_ISREG( path_stat.st_mode ) ) + return fs::file_status( fs::regular_file ); + if ( S_ISDIR( path_stat.st_mode ) ) + return fs::file_status( fs::directory_file ); + if ( S_ISLNK( path_stat.st_mode ) ) + return fs::file_status( fs::symlink_file ); + if ( S_ISBLK( path_stat.st_mode ) ) + return fs::file_status( fs::block_file ); + if ( S_ISCHR( path_stat.st_mode ) ) + return fs::file_status( fs::character_file ); + if ( S_ISFIFO( path_stat.st_mode ) ) + return fs::file_status( fs::fifo_file ); + if ( S_ISSOCK( path_stat.st_mode ) ) + return fs::file_status( fs::socket_file ); + return fs::file_status( fs::type_unknown ); + } + + // suggested by Walter Landry + BOOST_FILESYSTEM_DECL bool + symbolic_link_exists_api( const std::string & ph ) + { + struct stat path_stat; + return ::lstat( ph.c_str(), &path_stat ) == 0 + && S_ISLNK( path_stat.st_mode ); + } + + BOOST_FILESYSTEM_DECL query_pair + is_empty_api( const std::string & ph ) + { + struct stat path_stat; + if ( (::stat( ph.c_str(), &path_stat )) != 0 ) + return std::make_pair( errno, false ); + return std::make_pair( 0, S_ISDIR( path_stat.st_mode ) + ? is_empty_directory( ph ) + : path_stat.st_size == 0 ); + } + + BOOST_FILESYSTEM_DECL query_pair + equivalent_api( const std::string & ph1, const std::string & ph2 ) + { + struct stat s2; + int e2( ::stat( ph2.c_str(), &s2 ) ); + struct stat s1; + int e1( ::stat( ph1.c_str(), &s1 ) ); + if ( e1 != 0 || e2 != 0 ) + return std::make_pair( e1 != 0 && e2 != 0 ? errno : 0, false ); + // at this point, both stats are known to be valid + return std::make_pair( 0, + s1.st_dev == s2.st_dev + && s1.st_ino == s2.st_ino + // According to the POSIX stat specs, "The st_ino and st_dev fields + // taken together uniquely identify the file within the system." + // Just to be sure, size and mod time are also checked. + && s1.st_size == s2.st_size + && s1.st_mtime == s2.st_mtime ); + } + + BOOST_FILESYSTEM_DECL uintmax_pair + file_size_api( const std::string & ph ) + { + struct stat path_stat; + if ( ::stat( ph.c_str(), &path_stat ) != 0 ) + return std::make_pair( errno, 0 ); + if ( !S_ISREG( path_stat.st_mode ) ) + return std::make_pair( EPERM, 0 ); + return std::make_pair( 0, + static_cast(path_stat.st_size) ); + } + + BOOST_FILESYSTEM_DECL space_pair + space_api( const std::string & ph ) + { + struct BOOST_STATVFS vfs; + space_pair result; + if ( ::BOOST_STATVFS( ph.c_str(), &vfs ) != 0 ) + { + result.first = errno; + result.second.capacity = result.second.free + = result.second.available = 0; + } + else + { + result.first = 0; + result.second.capacity + = static_cast(vfs.f_blocks) * BOOST_STATVFS_F_FRSIZE; + result.second.free + = static_cast(vfs.f_bfree) * BOOST_STATVFS_F_FRSIZE; + result.second.available + = static_cast(vfs.f_bavail) * BOOST_STATVFS_F_FRSIZE; + } + return result; + } + + BOOST_FILESYSTEM_DECL time_pair + last_write_time_api( const std::string & ph ) + { + struct stat path_stat; + if ( ::stat( ph.c_str(), &path_stat ) != 0 ) + return std::make_pair( errno, 0 ); + return std::make_pair( 0, path_stat.st_mtime ); + } + + BOOST_FILESYSTEM_DECL fs::system_error_type + last_write_time_api( const std::string & ph, std::time_t new_value ) + { + struct stat path_stat; + if ( ::stat( ph.c_str(), &path_stat ) != 0 ) return errno; + ::utimbuf buf; + buf.actime = path_stat.st_atime; // utime() updates access time too:-( + buf.modtime = new_value; + return ::utime( ph.c_str(), &buf ) != 0 ? errno : 0; + } + + BOOST_FILESYSTEM_DECL fs::system_error_type + get_current_path_api( std::string & ph ) + { + for ( long path_max = 32;; path_max *=2 ) // loop 'til buffer large enough + { + boost::scoped_array + buf( new char[static_cast(path_max)] ); + if ( ::getcwd( buf.get(), static_cast(path_max) ) == 0 ) + { + if ( errno != ERANGE + // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set +# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) + && errno != 0 +# endif + ) return errno; + } + else + { + ph = buf.get(); + break; + } + } + return 0; + } + + BOOST_FILESYSTEM_DECL fs::detail::query_pair + create_directory_api( const std::string & ph ) + { + if ( ::mkdir( ph.c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 ) + { return std::make_pair( 0, true ); } + system_error_type ec=errno, dummy; + if ( ec != EEXIST + || !fs::is_directory( status_api( ph, dummy ) ) ) + { return std::make_pair( ec, false ); } + return std::make_pair( 0, false ); + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_hard_link_api( const std::string & to_ph, + const std::string & from_ph ) + { + return ::link( to_ph.c_str(), from_ph.c_str() ) == 0 + ? 0 : errno; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + create_symlink_api( const std::string & to_ph, + const std::string & from_ph ) + { + return ::symlink( to_ph.c_str(), from_ph.c_str() ) == 0 + ? 0 : errno; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + remove_api( const std::string & ph ) + { +# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))) + // Some Metrowerks C library versions fail on directories because of a + // known Metrowerks coding error in ::remove. Workaround is to call + // rmdir() or unlink() as indicated. + // Same bug also reported for QNX, with the same fix. + if ( (is_directory( ph ) + ? ::rmdir( ph.c_str() ) + : ::unlink( ph.c_str() )) != 0 ) +# else + // note that the POSIX behavior for symbolic links is what we want; + // the link rather than what it points to is deleted + if ( std::remove( ph.c_str() ) != 0 ) +# endif + { + int error = errno; + // POSIX says "If the directory is not an empty directory, rmdir() + // shall fail and set errno to EEXIST or ENOTEMPTY." + // Linux uses ENOTEMPTY, Solaris uses EEXIST. + if ( error == EEXIST ) error = ENOTEMPTY; + return error; + } + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + rename_api( const std::string & from, const std::string & to ) + { + // POSIX is too permissive so must check + fs::system_error_type dummy; + if ( fs::exists( status_api( to, dummy ) ) ) + return EEXIST; + return std::rename( from.c_str(), to.c_str() ) != 0 + ? errno : 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + copy_file_api( const std::string & from_file_ph, + const std::string & to_file_ph ) + { + const std::size_t buf_sz = 32768; + boost::scoped_array buf( new char [buf_sz] ); + int infile=0, outfile=0; // init quiets compiler warning + struct stat from_stat; + + if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 + || (infile = ::open( from_file_ph.c_str(), + O_RDONLY )) < 0 + || (outfile = ::open( to_file_ph.c_str(), + O_WRONLY | O_CREAT | O_EXCL, + from_stat.st_mode )) < 0 ) + { + if ( infile >= 0 ) ::close( infile ); + return errno; + } + + ssize_t sz, sz_read=1, sz_write; + while ( sz_read > 0 + && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 ) + { + // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), + // Marc Rochkind, Addison-Wesley, 2004, page 94 + sz_write = 0; + do + { + if ( (sz = ::write( outfile, buf.get() + sz_write, + sz_read - sz_write )) < 0 ) + { + sz_read = sz; // cause read loop termination + break; // and error to be thrown after closes + } + sz_write += sz; + } while ( sz_write < sz_read ); + } + + if ( ::close( infile) < 0 ) sz_read = -1; + if ( ::close( outfile) < 0 ) sz_read = -1; + + return sz_read < 0 ? errno : 0; + } + + // this code is based on Stevens and Rago, Advanced Programming in the + // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 + fs::system_error_type + path_max( std::size_t & result ) + { +# ifdef PATH_MAX + static std::size_t max = PATH_MAX; +# else + static std::size_t max = 0; +# endif + if ( max == 0 ) + { + errno = 0; + long tmp = ::pathconf( "/", _PC_NAME_MAX ); + if ( tmp < 0 ) + { + if ( errno == 0 ) // indeterminate + max = 4096; // guess + else return errno; + } + else max = static_cast( tmp + 1 ); // relative root + } + result = max; + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_first( void *& handle, void *& buffer, + const std::string & dir, std::string & target, + file_status &, file_status & ) + { + static const std::string dummy_first_name( "." ); + if ( (handle = ::opendir( dir.c_str() )) == 0 ) return errno; + target = dummy_first_name; + std::size_t path_size; + fs::system_error_type ec = path_max( path_size ); + if ( ec ) return ec; + dirent de; + buffer = std::malloc( (sizeof(dirent) - sizeof(de.d_name)) + + path_size + 1 ); // + 1 for "/0" + return buffer == 0 ? ENOMEM : 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_close( void *& handle, void*& buffer ) + { + std::free( buffer ); + buffer = 0; + if ( handle == 0 ) return 0; + DIR * h( static_cast(handle) ); + handle = 0; + return ::closedir( h ) == 0 ? 0 : errno; + } + + // warning: the only dirent member updated is d_name + inline int readdir_r_simulator( DIR * dirp, struct dirent * entry, + struct dirent ** result ) // *result set to 0 on end of directory + { + errno = 0; + + # if !defined(__CYGWIN__) \ + && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ + && defined(_SC_THREAD_SAFE_FUNCTIONS) \ + && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \ + && (!defined(__HP_aCC) || (defined(__HP_aCC) && defined(_REENTRANT))) + if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 ) + { return ::readdir_r( dirp, entry, result ); } + # endif + + struct dirent * p; + *result = 0; + if ( (p = ::readdir( dirp )) == 0 ) + return errno; + std::strcpy( entry->d_name, p->d_name ); + *result = entry; + return 0; + } + + BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type + dir_itr_increment( void *& handle, void *& buffer, + std::string & target, file_status & sf, file_status & symlink_sf ) + { + BOOST_ASSERT( buffer != 0 ); + dirent * entry( static_cast(buffer) ); + dirent * result; + int return_code; + if ( (return_code = readdir_r_simulator( static_cast(handle), + entry, &result )) != 0 ) return errno; + if ( result == 0 ) return dir_itr_close( handle, buffer ); + target = entry->d_name; +# ifdef BOOST_FILESYSTEM_STATUS_CACHE + if ( entry->d_type == DT_UNKNOWN ) // filesystem does not supply d_type value + { + sf = symlink_sf = fs::file_status(fs::status_unknown); + } + else // filesystem supplies d_type value + { + if ( entry->d_type == DT_DIR ) + sf = symlink_sf = fs::file_status( fs::directory_file ); + else if ( entry->d_type == DT_REG ) + sf = symlink_sf = fs::file_status( fs::regular_file ); + else if ( entry->d_type == DT_LNK ) + { + sf = fs::file_status( fs::status_unknown ); + symlink_sf = fs::file_status( fs::symlink_file ); + } + else sf = symlink_sf = fs::file_status( fs::status_unknown ); + } +# else + sf = symlink_sf = fs::file_status( fs::status_unknown ); +# endif + return 0; + } + +# endif + } // namespace detail + } // namespace filesystem +} // namespace boost diff --git a/boost/libs/filesystem/src/operations_posix_windows.cpp b/boost/libs/filesystem/src/operations_posix_windows.cpp deleted file mode 100644 index e314498098..0000000000 --- a/boost/libs/filesystem/src/operations_posix_windows.cpp +++ /dev/null @@ -1,852 +0,0 @@ -// directory_posix_windows.cpp ---------------------------------------------// - -// Copyright © 2002 Beman Dawes -// Copyright © 2001 Dietmar Kühl -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - - -// The point of this implementation is to prove the interface. There is no -// claim the implementation is efficient, follows good coding practice, etc. - - -//----------------------------------------------------------------------------// - -// define BOOST_FILESYSTEM_SOURCE so that knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, -#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX - // 64-bit systems or on 32-bit systems which don't have files larger - // than can be represented by a traditional POSIX/UNIX off_t type. - // OTOH, defining them should kick in 64-bit off_t's (and thus - // st_size) on 32-bit systems that provide the Large File - // Support (LFS) interface, such as Linux, Solaris, and IRIX. - // The defines are given before any headers are included to - // ensure that they are available to all included headers. - // That is required at least on Solaris, and possibly on other - // systems as well. - -#include -#include -#include -#include -#include -#include - -namespace fs = boost::filesystem; - -// BOOST_POSIX or BOOST_WINDOWS specify which API to use. -# if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX ) -# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) -# define BOOST_WINDOWS -# else -# define BOOST_POSIX -# endif -# endif - -# if defined(BOOST_WINDOWS) -# include "windows.h" -# if defined(__BORLANDC__) || defined(__MWERKS__) -# if defined(__BORLANDC__) - using std::time_t; -# endif -# include "utime.h" -# else -# include "sys/utime.h" -# endif - -// For Windows, the xxxA form of various function names is used to avoid -// inadvertently getting wide forms of the functions. (The undecorated -// forms are actually macros, so can misfire if the user has various -// other macros defined. There was a bug report of this happening.) - -# else // BOOST_POSIX -# include -# include "dirent.h" -# include "unistd.h" -# include "fcntl.h" -# include "utime.h" -# endif - -#include // even on Windows some functions use stat() -#include -#include -#include // for remove, rename -#include -#include -//#include // for debugging only; comment out when not in use - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; using ::remove; using ::rename; } -#endif - -#include // must be the last header - -// helpers -----------------------------------------------------------------// - -namespace -{ -#ifdef BOOST_POSIX - -# define BOOST_HANDLE DIR * -# define BOOST_INVALID_HANDLE_VALUE 0 -# define BOOST_SYSTEM_DIRECTORY_TYPE struct dirent - - inline const char * find_first_file( const char * dir, - BOOST_HANDLE & handle, BOOST_SYSTEM_DIRECTORY_TYPE & ) - // Returns: 0 if error, otherwise name - { - const char * dummy_first_name = "."; - return ( (handle = ::opendir( dir )) - == BOOST_INVALID_HANDLE_VALUE ) ? 0 : dummy_first_name; - } - - inline void find_close( BOOST_HANDLE handle ) - { - assert( handle != BOOST_INVALID_HANDLE_VALUE ); - ::closedir( handle ); - } - - // warning: the only dirent member updated is d_name - inline int readdir_r_simulator( DIR * dirp, struct dirent * entry, - struct dirent ** result ) // *result set to 0 on end of directory - { -# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ - && defined(_SC_THREAD_SAFE_FUNCTIONS) \ - && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \ - && ( !defined(__HP_aCC) || ( defined(__HP_aCC) && defined(_REENTRANT) ) ) - if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 ) - { return ::readdir_r( dirp, entry, result ); } -# endif - - struct dirent * p; - errno = 0; - *result = 0; - if ( (p = ::readdir( dirp )) == 0 ) - return errno; - // POSIX specs require entry->d_name be large enough: - std::strcpy( entry->d_name, p->d_name ); - *result = entry; - return 0; - } - - inline const char * find_next_file( BOOST_HANDLE handle, - const fs::path & ph, BOOST_SYSTEM_DIRECTORY_TYPE & entry ) - // Returns: if EOF 0, otherwise name - // Throws: if system reports error - { - struct dirent * result; - int return_code; - if ( (return_code = ::readdir_r_simulator( handle, &entry, &result )) != 0 ) - { - boost::throw_exception( - fs::filesystem_error( - "boost::filesystem::directory_iterator::operator++", - ph, return_code ) ); - } - return result ? entry.d_name : 0; - } -#else // BOOST_WINDOWS - -# define BOOST_HANDLE HANDLE -# define BOOST_INVALID_HANDLE_VALUE INVALID_HANDLE_VALUE -# define BOOST_SYSTEM_DIRECTORY_TYPE WIN32_FIND_DATAA - - inline const char * find_first_file( const char * dir, - BOOST_HANDLE & handle, BOOST_SYSTEM_DIRECTORY_TYPE & data ) - // Returns: 0 if error, otherwise name - // Note: an empty root directory has no "." or ".." entries, so this causes - // a ERROR_FILE_NOT_FOUND error which we do not considered an error. Instead, - // the handle is set to BOOST_INVALID_HANDLE_VALUE and a non-zero is returned. - { - // use a form of search Sebastian Martel reports will work with Win98 - std::string dirpath( dir ); - dirpath += (dirpath.empty() - || (dirpath[dirpath.size()-1] != '\\' - && dirpath[dirpath.size()-1] != '/')) ? "\\*" : "*"; - - return ( (handle = ::FindFirstFileA( dirpath.c_str(), &data )) - == BOOST_INVALID_HANDLE_VALUE - && ::GetLastError() != ERROR_FILE_NOT_FOUND) ? 0 : data.cFileName; - } - - inline void find_close( BOOST_HANDLE handle ) - { - assert( handle != BOOST_INVALID_HANDLE_VALUE ); - ::FindClose( handle ); - } - - inline const char * find_next_file( - BOOST_HANDLE handle, const fs::path & ph, - BOOST_SYSTEM_DIRECTORY_TYPE & data ) - // Returns: 0 if EOF, otherwise name - // Throws: if system reports error - { - if ( ::FindNextFileA( handle, &data ) == 0 ) - { - if ( ::GetLastError() != ERROR_NO_MORE_FILES ) - { - boost::throw_exception( fs::filesystem_error( - "boost::filesystem::directory_iterator::operator++", - ph.branch_path(), fs::detail::system_error_code() ) ); - } - else { return 0; } // end reached - } - return data.cFileName; - } - -#endif - - - fs::directory_iterator end_itr; - - bool is_empty_directory( const fs::path & dir_path ) - { - return fs::directory_iterator(dir_path) == end_itr; - } - - unsigned long remove_all_aux( const fs::path & ph ) - { - unsigned long count = 1; - if ( !fs::symbolic_link_exists( ph ) // don't recurse symbolic links - && fs::is_directory( ph ) ) - { - for ( fs::directory_iterator itr( ph ); - itr != end_itr; ++itr ) - { - count += remove_all_aux( *itr ); - } - } - fs::remove( ph ); - return count; - } - -} // unnamed namespace - -namespace boost -{ - namespace filesystem - { - namespace detail - { - -// dir_itr_imp -------------------------------------------------------------// - - class dir_itr_imp - { - public: - path entry_path; - BOOST_HANDLE handle; - - ~dir_itr_imp() - { - if ( handle != BOOST_INVALID_HANDLE_VALUE ) find_close( handle ); - } - }; - -// dot_or_dot_dot ----------------------------------------------------------// - - inline bool dot_or_dot_dot( const char * name ) - { -# if !BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x0564) ) - return std::strcmp( name, "." ) == 0 - || std::strcmp( name, ".." ) == 0; -# else - // Borland workaround for failure of intrinsics to be placed in - // namespace std with certain combinations of compiler options. - // To ensure test coverage, the workaround is applied to all - // configurations, regardless of option settings. - return name[0]=='.' - && (name[1]=='\0' || (name[1]=='.' && name[2]=='\0')); -# endif - } - -// directory_iterator implementation ---------------------------------------// - - BOOST_FILESYSTEM_DECL void dir_itr_init( dir_itr_imp_ptr & m_imp, - const path & dir_path ) - { - m_imp.reset( new dir_itr_imp ); - BOOST_SYSTEM_DIRECTORY_TYPE scratch; - const char * name = 0; // initialization quiets compiler warnings - if ( dir_path.empty() ) - m_imp->handle = BOOST_INVALID_HANDLE_VALUE; - else - { - name = find_first_file( dir_path.native_directory_string().c_str(), - m_imp->handle, scratch ); // sets handle - if ( m_imp->handle == BOOST_INVALID_HANDLE_VALUE - && name ) // eof - { - m_imp.reset(); // make end iterator - return; - } - } - if ( m_imp->handle != BOOST_INVALID_HANDLE_VALUE ) - { - m_imp->entry_path = dir_path; - // append name, except ignore "." or ".." - if ( !dot_or_dot_dot( name ) ) - { - m_imp->entry_path.m_path_append( name, no_check ); - } - else - { - m_imp->entry_path.m_path_append( "dummy", no_check ); - dir_itr_increment( m_imp ); - } - } - else - { - boost::throw_exception( filesystem_error( - "boost::filesystem::directory_iterator constructor", - dir_path, fs::detail::system_error_code() ) ); - } - } - - BOOST_FILESYSTEM_DECL path & dir_itr_dereference( - const dir_itr_imp_ptr & m_imp ) - { - assert( m_imp.get() ); // fails if dereference end iterator - return m_imp->entry_path; - } - - BOOST_FILESYSTEM_DECL void dir_itr_increment( dir_itr_imp_ptr & m_imp ) - { - assert( m_imp.get() ); // fails on increment end iterator - assert( m_imp->handle != BOOST_INVALID_HANDLE_VALUE ); // reality check - - BOOST_SYSTEM_DIRECTORY_TYPE scratch; - const char * name; - - while ( (name = find_next_file( m_imp->handle, - m_imp->entry_path, scratch )) != 0 ) - { - // append name, except ignore "." or ".." - if ( !dot_or_dot_dot( name ) ) - { - m_imp->entry_path.m_replace_leaf( name ); - return; - } - } - m_imp.reset(); // make base() the end iterator - } - } // namespace detail - -// free functions ----------------------------------------------------------// - - BOOST_FILESYSTEM_DECL bool exists( const path & ph ) - { -# ifdef BOOST_POSIX - struct stat path_stat; - if(::stat( ph.string().c_str(), &path_stat ) != 0) - { - if((errno == ENOENT) || (errno == ENOTDIR)) - return false; // stat failed because the path does not exist - // for any other error we assume the file does exist and fall through, - // this may not be the best policy though... (JM 20040330) - } - return true; -# else - if(::GetFileAttributesA( ph.string().c_str() ) == 0xFFFFFFFF) - { - UINT err = ::GetLastError(); - if((err == ERROR_FILE_NOT_FOUND) - || (err == ERROR_INVALID_PARAMETER) - || (err == ERROR_NOT_READY) - || (err == ERROR_PATH_NOT_FOUND) - || (err == ERROR_INVALID_NAME) - || (err == ERROR_BAD_NETPATH )) - return false; // GetFileAttributes failed because the path does not exist - // for any other error we assume the file does exist and fall through, - // this may not be the best policy though... (JM 20040330) - return true; - } - return true; -# endif - } - - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() - { -# ifdef BOOST_POSIX - struct stat lcl_stat; - return sizeof( lcl_stat.st_size ) > 4; -# else - return true; -# endif - } - - // suggested by Walter Landry - BOOST_FILESYSTEM_DECL bool symbolic_link_exists( const path & ph ) - { -# ifdef BOOST_POSIX - struct stat path_stat; - return ::lstat( ph.native_file_string().c_str(), &path_stat ) == 0 - && S_ISLNK( path_stat.st_mode ); -# else - return false; // Windows has no O/S concept of symbolic links - // (.lnk files are an application feature, not - // a Windows operating system feature) -# endif - } - - BOOST_FILESYSTEM_DECL bool is_directory( const path & ph ) - { -# ifdef BOOST_POSIX - struct stat path_stat; - if ( ::stat( ph.native_directory_string().c_str(), &path_stat ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::is_directory", - ph, fs::detail::system_error_code() ) ); - return S_ISDIR( path_stat.st_mode ); -# else - DWORD attributes = ::GetFileAttributesA( ph.native_directory_string().c_str() ); - if ( attributes == 0xFFFFFFFF ) - boost::throw_exception( filesystem_error( - "boost::filesystem::is_directory", - ph, fs::detail::system_error_code() ) ); - return (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; -# endif - } - - BOOST_FILESYSTEM_DECL bool _is_empty( const path & ph ) - { -# ifdef BOOST_POSIX - struct stat path_stat; - if ( ::stat( ph.string().c_str(), &path_stat ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::is_empty", - ph, fs::detail::system_error_code() ) ); - - return S_ISDIR( path_stat.st_mode ) - ? is_empty_directory( ph ) - : path_stat.st_size == 0; -# else - WIN32_FILE_ATTRIBUTE_DATA fad; - if ( !::GetFileAttributesExA( ph.string().c_str(), - ::GetFileExInfoStandard, &fad ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::is_empty", - ph, fs::detail::system_error_code() ) ); - - return ( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - ? is_empty_directory( ph ) - :( !fad.nFileSizeHigh && !fad.nFileSizeLow ); -# endif - } - -# ifdef BOOST_WINDOWS - // Thanks to Jeremy Maitin-Shepard for much help and for permission to - // base the implementation on portions of his file-equivalence-win32.cpp - // experimental code. - struct handle_wrapper - { - BOOST_HANDLE handle; - handle_wrapper( BOOST_HANDLE h ) - : handle(h) {} - ~handle_wrapper() - { - if ( handle != BOOST_INVALID_HANDLE_VALUE ) - ::CloseHandle(handle); - } - }; -# endif - - BOOST_FILESYSTEM_DECL bool equivalent( const path & ph1, const path & ph2 ) - { -# ifdef BOOST_POSIX - struct stat s1; - int s1_result = ::stat( ph1.string().c_str(), &s1 ); - // save error code in case we have to throw - int error1 = (s1_result != 0 ? fs::detail::system_error_code() : 0); - struct stat s2; - int s2_result = ::stat( ph2.string().c_str(), &s2 ); - if ( s1_result != 0 - || s2_result != 0 ) - { - if ( s1_result == 0 || s2_result == 0 ) return false; - assert( s1_result != 0 && s2_result != 0 ); - boost::throw_exception( filesystem_error( - "boost::filesystem::equivalent", - ph1, error1 ) ); - } - // at this point, both stats are known to be valid - return s1.st_dev == s2.st_dev - && s1.st_ino == s2.st_ino - // According to the POSIX stat specs, "The st_ino and st_dev fields - // taken together uniquely identify the file within the system." - // Just to be sure, size and mod time are also checked. - && s1.st_size == s2.st_size - && s1.st_mtime == s2.st_mtime; -# else - // Note well: Physical location on external media is part of the - // equivalence criteria. If there are no open handles, physical location - // can change due to defragmentation or other relocations. Thus handles - // must be held open until location information for both paths has - // been retrieved. - handle_wrapper p1( - ::CreateFileA( - ph1.string().c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0 ) ); - int error1; // save error code in case we have to throw - if ( p1.handle == BOOST_INVALID_HANDLE_VALUE ) - error1 = fs::detail::system_error_code(); - handle_wrapper p2( - ::CreateFileA( - ph2.string().c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0 ) ); - if ( p1.handle == BOOST_INVALID_HANDLE_VALUE - || p2.handle == BOOST_INVALID_HANDLE_VALUE ) - { - if ( p1.handle != BOOST_INVALID_HANDLE_VALUE - || p2.handle != BOOST_INVALID_HANDLE_VALUE ) return false; - assert( p1.handle == BOOST_INVALID_HANDLE_VALUE - && p2.handle == BOOST_INVALID_HANDLE_VALUE ); - boost::throw_exception( filesystem_error( - "boost::filesystem::equivalent", - ph1, error1 ) ); - } - // at this point, both handles are known to be valid - BY_HANDLE_FILE_INFORMATION info1, info2; - if ( !::GetFileInformationByHandle( p1.handle, &info1 ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::equivalent", - ph1, fs::detail::system_error_code() ) ); - if ( !::GetFileInformationByHandle( p2.handle, &info2 ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::equivalent", - ph2, fs::detail::system_error_code() ) ); - // In theory, volume serial numbers are sufficient to distinguish between - // devices, but in practice VSN's are sometimes duplicated, so last write - // time and file size are also checked. - return info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber - && info1.nFileIndexHigh == info2.nFileIndexHigh - && info1.nFileIndexLow == info2.nFileIndexLow - && info1.nFileSizeHigh == info2.nFileSizeHigh - && info1.nFileSizeLow == info2.nFileSizeLow - && info1.ftLastWriteTime.dwLowDateTime - == info2.ftLastWriteTime.dwLowDateTime - && info1.ftLastWriteTime.dwHighDateTime - == info2.ftLastWriteTime.dwHighDateTime; -# endif - } - - - BOOST_FILESYSTEM_DECL boost::intmax_t file_size( const path & ph ) - { -# ifdef BOOST_POSIX - struct stat path_stat; - if ( ::stat( ph.string().c_str(), &path_stat ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::file_size", - ph, fs::detail::system_error_code() ) ); - if ( S_ISDIR( path_stat.st_mode ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::file_size", - ph, "invalid: is a directory", - is_directory_error ) ); - return static_cast(path_stat.st_size); -# else - // by now, intmax_t is 64-bits on all Windows compilers - WIN32_FILE_ATTRIBUTE_DATA fad; - if ( !::GetFileAttributesExA( ph.string().c_str(), - ::GetFileExInfoStandard, &fad ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::file_size", - ph, fs::detail::system_error_code() ) ); - if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::file_size", - ph, "invalid: is a directory", - is_directory_error ) ); - return (static_cast(fad.nFileSizeHigh) - << (sizeof(fad.nFileSizeLow)*8)) - + fad.nFileSizeLow; -# endif - } - - BOOST_FILESYSTEM_DECL std::time_t last_write_time( const path & ph ) - { - // Works for both Windows and POSIX - struct stat path_stat; - if ( ::stat( ph.string().c_str(), &path_stat ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::last_write_time", - ph, fs::detail::system_error_code() ) ); - return path_stat.st_mtime; - } - - BOOST_FILESYSTEM_DECL void last_write_time( const path & ph, const std::time_t new_time ) - { - // Works for both Windows and POSIX - struct stat path_stat; - if ( ::stat( ph.string().c_str(), &path_stat ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::last_write_time", - ph, fs::detail::system_error_code() ) ); - ::utimbuf buf; - buf.actime = path_stat.st_atime; // utime() updates access time too:-( - buf.modtime = new_time; - if ( ::utime( ph.string().c_str(), &buf ) != 0 ) - boost::throw_exception( filesystem_error( - "boost::filesystem::last_write_time", - ph, fs::detail::system_error_code() ) ); - } - - BOOST_FILESYSTEM_DECL bool create_directory( const path & dir_path ) - { -# ifdef BOOST_POSIX - if ( ::mkdir( dir_path.native_directory_string().c_str(), - S_IRWXU|S_IRWXG|S_IRWXO ) == 0 ) return true; - if ( errno != EEXIST ) -# else - if ( ::CreateDirectoryA( dir_path.native_directory_string().c_str(), 0 ) ) - return true; - if ( ::GetLastError() != ERROR_ALREADY_EXISTS ) -# endif - boost::throw_exception( filesystem_error( - "boost::filesystem::create_directory", - dir_path, fs::detail::system_error_code() ) ); - if ( !is_directory( dir_path ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::create_directory", - dir_path, "path exists and is not a directory", not_directory_error ) ); - return false; - } - - BOOST_FILESYSTEM_DECL bool remove( const path & ph ) - { - if ( exists( ph ) -# ifdef BOOST_POSIX - || symbolic_link_exists( ph ) ) // handle dangling symbolic links - { -# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))) - // Some Metrowerks C library versions fail on directories because of a - // known Metrowerks coding error in ::remove. Workaround is to call - // rmdir() or unlink() as indicated. - // Same bug reported for QNX; same fix. - if ( (is_directory( ph ) - ? ::rmdir( ph.string().c_str() ) - : ::unlink( ph.string().c_str() )) != 0 ) -# else - // note that the POSIX behavior for symbolic links is what we want; - // the link rather than what it points to is deleted - if ( std::remove( ph.string().c_str() ) != 0 ) -# endif - - { - int error = fs::detail::system_error_code(); - // POSIX says "If the directory is not an empty directory, rmdir() - // shall fail and set errno to EEXIST or ENOTEMPTY." - // Linux uses ENOTEMPTY, Solaris uses EEXIST. - if ( error == EEXIST ) error = ENOTEMPTY; - boost::throw_exception( filesystem_error( - "boost::filesystem::remove", ph, error ) ); - } -# else - ) - { - if ( is_directory( ph ) ) - { - if ( !::RemoveDirectoryA( ph.string().c_str() ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::remove", - ph, fs::detail::system_error_code() ) ); - } - else - { - if ( !::DeleteFileA( ph.string().c_str() ) ) - boost::throw_exception( filesystem_error( - "boost::filesystem::remove", - ph, fs::detail::system_error_code() ) ); - } -# endif - return true; - } - return false; - } - - BOOST_FILESYSTEM_DECL unsigned long remove_all( const path & ph ) - { - return exists( ph )|| symbolic_link_exists( ph ) - ? remove_all_aux( ph ) : 0; - } - - BOOST_FILESYSTEM_DECL void rename( const path & old_path, - const path & new_path ) - { -# ifdef BOOST_POSIX - if ( exists( new_path ) // POSIX is too permissive so must check - || std::rename( old_path.string().c_str(), new_path.string().c_str() ) != 0 ) -# else - if ( !::MoveFileA( old_path.string().c_str(), new_path.string().c_str() ) ) -# endif - boost::throw_exception( filesystem_error( - "boost::filesystem::rename", - old_path, new_path, fs::detail::system_error_code() ) ); - } - -#ifdef BOOST_POSIX - namespace detail - { - void throw_copy_file_error( const path & from_file_ph, - const path & to_file_ph ) - { - boost::throw_exception( fs::filesystem_error( - "boost::filesystem::copy_file", - from_file_ph, to_file_ph, system_error_code() ) ); - } - } -#endif - - BOOST_FILESYSTEM_DECL void copy_file( const path & from_file_ph, - const path & to_file_ph ) - { -# ifdef BOOST_POSIX - const std::size_t buf_sz = 32768; - boost::scoped_array buf( new char [buf_sz] ); - int infile=0, outfile=0; // init quiets compiler warning - struct stat from_stat; - - if ( ::stat( from_file_ph.string().c_str(), &from_stat ) != 0 - || (infile = ::open( from_file_ph.string().c_str(), - O_RDONLY )) < 0 - || (outfile = ::open( to_file_ph.string().c_str(), - O_WRONLY | O_CREAT | O_EXCL, - from_stat.st_mode )) < 0 ) - { - if ( infile >= 0 ) ::close( infile ); - detail::throw_copy_file_error( from_file_ph, to_file_ph ); - } - - ssize_t sz, sz_read=1, sz_write; - while ( sz_read > 0 - && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 ) - { - // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), - // Marc Rochkind, Addison-Wesley, 2004, page 94 - sz_write = 0; - do - { - if ( (sz = ::write( outfile, buf.get(), sz_read - sz_write )) < 0 ) - { - sz_read = sz; // cause read loop termination - break; // and error to be thrown after closes - } - sz_write += sz; - } while ( sz_write < sz_read ); - } - - if ( ::close( infile) < 0 ) sz_read = -1; - if ( ::close( outfile) < 0 ) sz_read = -1; - - if ( sz_read < 0 ) - detail::throw_copy_file_error( from_file_ph, to_file_ph ); -# else - if ( !::CopyFileA( from_file_ph.string().c_str(), - to_file_ph.string().c_str(), /*fail_if_exists=*/true ) ) - boost::throw_exception( fs::filesystem_error( - "boost::filesystem::copy_file", - from_file_ph, to_file_ph, detail::system_error_code() ) ); -# endif - } - - BOOST_FILESYSTEM_DECL path current_path() - { -# ifdef BOOST_POSIX - for ( long path_max = 32;; path_max *=2 ) // loop 'til buffer large enough - { - boost::scoped_array - buf( new char[static_cast(path_max)] ); - if ( ::getcwd( buf.get(), static_cast(path_max) ) == 0 ) - { - if ( errno != ERANGE -// there is a bug in some versions of the Metrowerks C lib on the Mac: wrong errno set -#if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) - && errno != 0 -#endif - ) - boost::throw_exception( - filesystem_error( "boost::filesystem::current_path", path(), - fs::detail::system_error_code() ) ); - } - else return path( buf.get(), native ); - } - BOOST_UNREACHABLE_RETURN(0) -# else - DWORD sz; - if ( (sz = ::GetCurrentDirectoryA( 0, static_cast(0) )) == 0 ) - boost::throw_exception( - filesystem_error( "boost::filesystem::current_path", - "size is 0" ) ); - boost::scoped_array buf( new char[sz] ); - if ( ::GetCurrentDirectoryA( sz, buf.get() ) == 0 ) - boost::throw_exception( - filesystem_error( "boost::filesystem::current_path", path(), - fs::detail::system_error_code() ) ); - return path( buf.get(), native ); -# endif - } - - BOOST_FILESYSTEM_DECL const path & initial_path() - { - static path init_path; - if ( init_path.empty() ) init_path = current_path(); - return init_path; - } - - BOOST_FILESYSTEM_DECL path system_complete( const path & ph ) - { -# ifdef BOOST_WINDOWS - if ( ph.empty() ) return ph; - char buf[MAX_PATH]; - char * pfn; - std::size_t len = ::GetFullPathNameA( ph.string().c_str(), - sizeof(buf) , buf, &pfn ); - if ( !len ) - { boost::throw_exception( - filesystem_error( "boost::filesystem::system_complete", - ph, "size is 0" ) ); } - buf[len] = '\0'; - return path( buf, native ); -# else - return (ph.empty() || ph.is_complete()) - ? ph : current_path() / ph; -# endif - } - - BOOST_FILESYSTEM_DECL path complete( const path & ph, const path & base ) - { - assert( base.is_complete() - && (ph.is_complete() || !ph.has_root_name()) ); // precondition -# ifdef BOOST_WINDOWS - if (ph.empty() || ph.is_complete()) return ph; - if ( !ph.has_root_name() ) - return ph.has_root_directory() - ? path( base.root_name(), native ) / ph - : base / ph; - return base / ph; -# else - return (ph.empty() || ph.is_complete()) ? ph : base / ph; -# endif - } - } // namespace filesystem -} // namespace boost - diff --git a/boost/libs/filesystem/src/path.cpp b/boost/libs/filesystem/src/path.cpp new file mode 100644 index 0000000000..ac85ee9f0a --- /dev/null +++ b/boost/libs/filesystem/src/path.cpp @@ -0,0 +1,121 @@ +// path.cpp ----------------------------------------------------------------// + +// Copyright 2005 Beman Dawes +// 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) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#include + +#ifndef BOOST_FILESYSTEM_NARROW_ONLY + +#include +#include + +#include +#include + +namespace +{ + // std::locale construction can throw (if LC_MESSAGES is wrong, for example), + // so a static at function scope is used to ensure that exceptions can be + // caught. (A previous version was at namespace scope, so initialization + // occurred before main(), preventing exceptions from being caught.) + + std::locale & loc() + { + // ISO C calls this "the locale-specific native environment": + static std::locale lc(""); + return lc; + } + + const std::codecvt *& + converter() + { + static const std::codecvt * + cvtr( + &std::use_facet > + ( loc() ) ); + return cvtr; + } + + bool locked(false); +} // unnamed namespace + +namespace boost +{ + namespace filesystem + { + bool wpath_traits::imbue( const std::locale & new_loc, const std::nothrow_t & ) + { + if ( locked ) return false; + locked = true; + loc() = new_loc; + converter() = &std::use_facet + >( loc() ); + return true; + } + + void wpath_traits::imbue( const std::locale & new_loc ) + { + if ( locked ) boost::throw_exception( filesystem_wpath_error( + "boost::filesystem::wpath_traits::imbue() after lockdown", 0 ) ); + imbue( new_loc, std::nothrow ); + } + +# ifdef BOOST_POSIX_API + +// Because this is POSIX only code, we don't have to worry about ABI issues +// described in http://www.boost.org/more/separate_compilation.html + + wpath_traits::external_string_type + wpath_traits::to_external( const wpath & ph, + const internal_string_type & src ) + { + locked = true; + std::size_t work_size( converter()->max_length() * (src.size()+1) ); + boost::scoped_array work( new char[ work_size ] ); + std::mbstate_t state; + const internal_string_type::value_type * from_next; + external_string_type::value_type * to_next; + if ( converter()->out( + state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), + work.get()+work_size, to_next ) != std::codecvt_base::ok ) + boost::throw_exception( boost::filesystem::filesystem_wpath_error( + "boost::filesystem::wpath::to_external conversion error", + ph, EINVAL ) ); + *to_next = '\0'; + return external_string_type( work.get() ); + } + + wpath_traits::internal_string_type + wpath_traits::to_internal( const external_string_type & src ) + { + locked = true; + std::size_t work_size( src.size()+1 ); + boost::scoped_array work( new wchar_t[ work_size ] ); + std::mbstate_t state; + const external_string_type::value_type * from_next; + internal_string_type::value_type * to_next; + if ( converter()->in( + state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), + work.get()+work_size, to_next ) != std::codecvt_base::ok ) + boost::throw_exception( boost::filesystem::filesystem_wpath_error( + "boost::filesystem::wpath::to_internal conversion error", EINVAL ) ); + *to_next = L'\0'; + return internal_string_type( work.get() ); + } +# endif // BOOST_POSIX_API + + } // namespace filesystem +} // namespace boost + +#endif // ifndef BOOST_FILESYSTEM_NARROW_ONLY diff --git a/boost/libs/filesystem/src/path_posix_windows.cpp b/boost/libs/filesystem/src/path_posix_windows.cpp deleted file mode 100644 index 3256b9f3c7..0000000000 --- a/boost/libs/filesystem/src/path_posix_windows.cpp +++ /dev/null @@ -1,692 +0,0 @@ -// path implementation -----------------------------------------------------// - -// © Copyright Beman Dawes 2002-2003 -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - - -//****************************************************************************// - -// WARNING: This code was hacked time and time again as different library -// designs were tried. Thus portions may be residue from the earlier -// experiments, and be totally stupid or wrong in light of the final library -// specifications. The code needs to be reviewed line-by-line to elmininate -// such problems. - -//****************************************************************************// - -// define BOOST_FILESYSTEM_SOURCE so that knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#include -#include - -// BOOST_POSIX or BOOST_WINDOWS specify which API to use. -# if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX ) -# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) -# define BOOST_WINDOWS -# else -# define BOOST_POSIX -# endif -# endif - - -namespace fs = boost::filesystem; - -#include -#ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::strlen; } -#endif - -#include -#include // SGI MIPSpro compilers need this -#include -#include // for lexicographical_compare -#include - -#include // must be the last header - -// helpers -----------------------------------------------------------------// - -namespace -{ - // POSIX & Windows cases: "", "/", "/foo", "foo", "foo/bar" - // Windows only cases: "c:", "c:/", "c:foo", "c:/foo", - // "prn:", "//share", "//share/", "//share/foo" - - std::string::size_type leaf_pos( const std::string & str, - std::string::size_type end_pos ) // end_pos is past-the-end position - // return 0 if str itself is leaf (or empty) - { - if ( end_pos && str[end_pos-1] == '/' ) return end_pos-1; - - std::string::size_type pos( str.find_last_of( '/', end_pos-1 ) ); -# ifdef BOOST_WINDOWS - if ( pos == std::string::npos ) pos = str.find_last_of( ':', end_pos-2 ); -# endif - - return ( pos == std::string::npos // path itself must be a leaf (or empty) -# ifdef BOOST_WINDOWS - || (pos == 1 && str[0] == '/') // or share -# endif - ) ? 0 // so leaf is entire string - : pos + 1; // or starts after delimiter - } - - void first_name( const std::string & src, std::string & target ) - { - target = ""; // VC++ 6.0 doesn't have string::clear() - std::string::const_iterator itr( src.begin() ); - -# ifdef BOOST_WINDOWS - // deal with //share - if ( src.size() >= 2 && src[0] == '/' && src[1] == '/' ) - { target = "//"; itr += 2; } -# endif - - while ( itr != src.end() -# ifdef BOOST_WINDOWS - && *itr != ':' -# endif - && *itr != '/' ) { target += *itr++; } - - if ( itr == src.end() ) return; - -# ifdef BOOST_WINDOWS - if ( *itr == ':' ) - { - target += *itr++; - return; - } -# endif - - // *itr is '/' - if ( itr == src.begin() ) { target += '/'; } - return; - } - - const char invalid_chars[] = - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" - "<>:\"/\\|"; - // note that the terminating '\0' is part of the string - thus the size below - // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I - const std::string windows_invalid_chars( invalid_chars, sizeof(invalid_chars) ); - - const std::string valid_posix( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-" ); - - fs::path::name_check default_check = fs::portable_name; - bool safe_to_write_check = true; // write-once-before-read allowed - -} // unnamed namespace - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - // name_check functions ----------------------------------------------// - -# ifdef BOOST_WINDOWS - BOOST_FILESYSTEM_DECL bool native( const std::string & name ) - { - return windows_name( name ); - } -# else - BOOST_FILESYSTEM_DECL bool native( const std::string & ) - { - return true; - } -# endif - - BOOST_FILESYSTEM_DECL bool no_check( const std::string & ) { return true; } - - BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ) - { - return name.size() != 0 - && name.find_first_not_of( valid_posix ) == std::string::npos; - } - - BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ) - { - return name.size() != 0 - && name.find_first_of( windows_invalid_chars ) == std::string::npos - && *(name.end()-1) != ' ' - && (*(name.end()-1) != '.' - || name.length() == 1 || name == ".."); - } - - BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ) - { - return - name.size() == 0 - || name == "." - || name == ".." - || (windows_name( name ) - && portable_posix_name( name ) - && name[0] != '.' && name[0] != '-'); - } - - BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ) - { - return - name == "." - || name == ".." - || (portable_name( name ) - && name.find('.') == std::string::npos); - } - - BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ) - { - std::string::size_type pos; - return - name == "." - || name == ".." - || (portable_name( name ) - && ( (pos = name.find( '.' )) == std::string::npos - || (name.find( '.', pos+1 )== std::string::npos - && (pos + 5) > name.length() ))) - ; - } - - -// path implementation -----------------------------------------------------// - - path::path( const std::string & src ) - { - m_path_append( src, default_name_check() ); - } - - path::path( const char * src ) - { - assert( src != 0 ); - m_path_append( src, default_name_check() ); - } - - path::path( const std::string & src, name_check checker ) - { - m_path_append( src, checker ); - } - - path::path( const char * src, name_check checker ) - { - assert( src != 0 ); - m_path_append( src, checker ); - } - - path & path::operator /=( const path & rhs ) - { - m_path_append( rhs.m_path, no_check ); - return *this; - } - - void path::m_path_append( const std::string & src, name_check checker ) - { - // convert backslash to forward slash if checker==native - // allow system-specific-root if checker==no_check || checker==native - - assert( checker ); - assert( src.size() == std::strlen( src.c_str() ) ); // no embedded 0 - - if ( src.size() == 0 ) return; - - std::string::const_iterator itr( src.begin() ); - - // [root-filesystem] -# ifdef BOOST_WINDOWS - if ( (checker == no_check || checker == native) && src.size() >= 2 ) - { - // drive or device - if ( src[1] == ':' || src[src.size()-1] == ':' ) - { - for ( ; *itr != ':'; ++itr ) m_path += *itr; - m_path += ':'; - ++itr; - } - - // share - else if ( (*itr == '/' || (*itr == '\\' && checker == native)) - && (*(itr+1) == '/' || (*(itr+1) == '\\' && checker == native)) ) - { - m_path += "//"; - for ( itr += 2; - itr != src.end() && *itr != '/' && *itr != '\\'; - ++itr ) m_path += *itr; - } - } -# endif - - // root directory [ "/" ] - if ( itr != src.end() && (*itr == '/' -# ifdef BOOST_WINDOWS - || (*itr == '\\' && checker == native) -# endif - ) ) - { - ++itr; - if ( m_path.size() == 0 -# ifdef BOOST_WINDOWS - || m_path[m_path.size()-1] == ':' // drive or device - || ( // share - m_path.size() > 2 - && m_path[0] == '/' - && m_path[1] == '/' - && m_path.find( '/', 2 ) == std::string::npos - ) -# endif - ) m_path += '/'; - } - - // element { "/" element } [ "/" ] - while ( itr != src.end() ) - { - if ( m_path == "." ) m_path = ""; - - // directory-placeholder - if ( *itr == '.' && ((itr+1) == src.end() || *(itr+1) == '/' -# ifdef BOOST_WINDOWS - || *(itr+1) == '\\' -# endif - ) ) - { - if ( empty() ) m_path += '.'; - ++itr; - } - - // parent-directory or name - else - { - // append '/' if needed - if ( !empty() -# ifdef BOOST_WINDOWS - && *(m_path.end()-1) != ':' -# endif - && *(m_path.end()-1) != '/' ) - m_path += '/'; - - // parent-directory - if ( *itr == '.' - && (itr+1) != src.end() && *(itr+1) == '.' - && ((itr+2) == src.end() || *(itr+2) == '/' -# ifdef BOOST_WINDOWS - || *(itr+2) == '\\' -# endif - ) ) - { - m_path += ".."; - ++itr; - ++itr; - } // parent-directory - - // name - else - { - std::string name; - do - { name += *itr; } - while ( ++itr != src.end() && *itr != '/' -# ifdef BOOST_WINDOWS - && (*itr != '\\' || checker != native) -# endif - ); - - if ( !checker( name ) ) - { - boost::throw_exception( filesystem_error( - "boost::filesystem::path", - "invalid name \"" + name + "\" in path: \"" + src + "\"" ) ); - } - - m_path += name; - } - } // parent-directory or name - - // end or "/" - if ( itr != src.end() ) - { - if ( *itr == '/' -# ifdef BOOST_WINDOWS - || (*itr == '\\' && checker == native) -# endif - ) ++itr; - else - boost::throw_exception( filesystem_error( - "boost::filesystem::path", - "invalid path syntax: \"" + src + "\"" ) ); - } - - } // while more elements - - // special case: remove one or more leading "/.." - - std::string::size_type pos = 0, sz = m_path.size(); - -# ifdef BOOST_WINDOWS - if ( sz > 2 && m_path[pos] != '/' && m_path[pos+1] == ':' ) // drive - { pos += 2; sz -= 2; } -# endif - - while ( sz >= 3 && m_path[pos] == '/' - && m_path[pos+1] == '.' && m_path[pos+2] == '.' - && (sz == 3 || m_path[pos+3] == '/') ) - { - m_path.erase( pos+1, 3 ); // "..[/]" - sz -= 3; // on last, 3 should be 2; that doesn't matter - } - } - -// path conversion functions ------------------------------------------------// - - std::string path::native_file_string() const - { -# ifdef BOOST_WINDOWS - std::string s( m_path ); - for ( std::string::iterator itr( s.begin() ); - itr != s.end(); ++itr ) - if ( *itr == '/' ) *itr = '\\'; - return s; -# else - return m_path; -# endif - } - - std::string path::native_directory_string() const - { return native_file_string(); } - -// path modification functions -----------------------------------------------// - - path & path::normalize() - { - if ( m_path.empty() ) return *this; - std::string::size_type end, beg(0), start(0); - -# ifdef BOOST_WINDOWS - if ( m_path.size() > 2 - && m_path[0] != '/' && m_path[1] == ':' ) start = 2; // drive -# endif - - while ( (beg=m_path.find( "/..", beg )) != std::string::npos ) - { - end = beg + 3; - if ( (beg == 1 && m_path[0] == '.') - || (beg == 2 && m_path[0] == '.' && m_path[1] == '.') - || (beg > 2 && m_path[beg-3] == '/' - && m_path[beg-2] == '.' && m_path[beg-1] == '.') ) - { - beg = end; - continue; - } - if ( end < m_path.size() ) - { - if ( m_path[end] == '/' ) ++end; - else { beg = end; continue; } // name starts with .. - } - - // end is one past end of substr to be erased; now set beg - while ( beg > start && m_path[--beg] != '/' ) {} - if ( m_path[beg] == '/') ++beg; - m_path.erase( beg, end-beg ); - if ( beg ) --beg; - } - - if ( m_path.empty() ) m_path = "."; - else - { // remove trailing '/' if not root directory - std::string::size_type sz = m_path.size(); - -# ifdef BOOST_WINDOWS - if ( start ) sz -= 2; // drive -# endif - - if ( sz > 1 && m_path[m_path.size()-1] == '/' ) - { m_path.erase( m_path.size()-1 ); } - } - return *this; - } - - // path decomposition functions ---------------------------------------------// - - path::iterator path::begin() const - { - iterator itr; - itr.m_path_ptr = this; - first_name( m_path, itr.m_name ); - itr.m_pos = 0; - return itr; - } - - void path::m_replace_leaf( const char * new_leaf ) - { - m_path.erase( leaf_pos( m_path, m_path.size() ) ); - m_path += new_leaf; - } - - std::string path::leaf() const - { - return m_path.substr( leaf_pos( m_path, m_path.size() ) ); - } - - namespace detail - { - inline bool is_absolute_root( const std::string & s, - std::string::size_type len ) - { - return - len && s[len-1] == '/' - && - ( - len == 1 // "/" -# ifdef BOOST_WINDOWS - || ( len > 1 - && ( s[len-2] == ':' // drive or device - || ( s[0] == '/' // share - && s[1] == '/' - && s.find( '/', 2 ) == len-1 - ) - ) - ) -# endif - ); - } - } - - path path::branch_path() const - { - std::string::size_type end_pos( leaf_pos( m_path, m_path.size() ) ); - - // skip a '/' unless it is a root directory - if ( end_pos && m_path[end_pos-1] == '/' - && !detail::is_absolute_root( m_path, end_pos ) ) --end_pos; - return path( m_path.substr( 0, end_pos ), no_check ); - } - - path path::relative_path() const - { - std::string::size_type pos( 0 ); - if ( m_path.size() && m_path[0] == '/' ) - { pos = 1; -# ifdef BOOST_WINDOWS - if ( m_path.size()>1 && m_path[1] == '/' ) // share - { - if ( (pos = m_path.find( '/', 2 )) != std::string::npos ) ++pos; - else return path(); - } - } - else if ( (pos = m_path.find( ':' )) == std::string::npos ) pos = 0; - else // has ':' - { - if ( ++pos < m_path.size() && m_path[pos] == '/' ) ++pos; -# endif - } - return path( m_path.substr( pos ), no_check ); - } - - std::string path::root_name() const - { -# ifdef BOOST_WINDOWS - std::string::size_type pos( m_path.find( ':' ) ); - if ( pos != std::string::npos ) return m_path.substr( 0, pos+1 ); - if ( m_path.size() > 2 && m_path[0] == '/' && m_path[1] == '/' ) - { - pos = m_path.find( '/', 2 ); - return m_path.substr( 0, pos ); - } -# endif - return std::string(); - } - - std::string path::root_directory() const - { - return std::string( - ( m_path.size() && m_path[0] == '/' ) // covers both "/" and "//share" -# ifdef BOOST_WINDOWS - || ( m_path.size() > 2 - && m_path[1] == ':' - && m_path[2] == '/' ) // "c:/" -# endif - ? "/" : "" ); - } - - path path::root_path() const - { - return path( -# ifdef BOOST_WINDOWS - root_name(), no_check ) /= root_directory(); -# else - root_directory() ); -# endif - } - -// path query functions -----------------------------------------------------// - - bool path::is_complete() const - { -# ifdef BOOST_WINDOWS - return m_path.size() > 2 - && ( (m_path[1] == ':' && m_path[2] == '/') // "c:/" - || (m_path[0] == '/' && m_path[1] == '/') // "//share" - || m_path[m_path.size()-1] == ':' ); -# else - return m_path.size() && m_path[0] == '/'; -# endif - } - - bool path::has_root_path() const - { - return ( m_path.size() - && m_path[0] == '/' ) // covers both "/" and "//share" -# ifdef BOOST_WINDOWS - || ( m_path.size() > 1 && m_path[1] == ':' ) // "c:" and "c:/" - || ( m_path.size() > 3 - && m_path[m_path.size()-1] == ':' ) // "device:" -# endif - ; - } - - bool path::has_root_name() const - { -# ifdef BOOST_WINDOWS - return m_path.size() > 1 - && ( m_path[1] == ':' // "c:" - || m_path[m_path.size()-1] == ':' // "prn:" - || (m_path[0] == '/' && m_path[1] == '/') // "//share" - ); -# else - return false; -# endif - } - - bool path::has_root_directory() const - { - return ( m_path.size() - && m_path[0] == '/' ) // covers both "/" and "//share" -# ifdef BOOST_WINDOWS - || ( m_path.size() > 2 - && m_path[1] == ':' && m_path[2] == '/' ) // "c:/" -# endif - ; - } - - bool path::has_relative_path() const { return !relative_path().empty(); } - bool path::has_branch_path() const { return !branch_path().empty(); } - - // default name_check mechanism ----------------------------------------// - - bool path::default_name_check_writable() - { - return safe_to_write_check; - } - - void path::default_name_check( name_check new_check ) - { - assert( new_check ); - if ( !safe_to_write_check ) - boost::throw_exception( - filesystem_error( "boost::filesystem::default_name_check", - "default name check already set" )); - default_check = new_check; - safe_to_write_check = false; - } - - path::name_check path::default_name_check() - { - safe_to_write_check = false; - return default_check; - } - - // path operator< ------------------------------------------------------// - bool path::operator<( const path & that ) const - { - return std::lexicographical_compare( - begin(), end(), that.begin(), that.end() ); - } - - -// path::iterator implementation --------------------------------------------// - - BOOST_FILESYSTEM_DECL void path::iterator::increment() - { - assert( m_pos < m_path_ptr->m_path.size() ); // detect increment past end - m_pos += m_name.size(); - if ( m_pos == m_path_ptr->m_path.size() ) - { - m_name = ""; // not strictly required, but might aid debugging - return; - } - if ( m_path_ptr->m_path[m_pos] == '/' ) - { -# ifdef BOOST_WINDOWS - if ( m_name[m_name.size()-1] == ':' // drive or device - || (m_name[0] == '/' && m_name[1] == '/') ) // share - { - m_name = "/"; - return; - } -# endif - ++m_pos; - } - std::string::size_type end_pos( m_path_ptr->m_path.find( '/', m_pos ) ); - if ( end_pos == std::string::npos ) - end_pos = m_path_ptr->m_path.size(); - m_name = m_path_ptr->m_path.substr( m_pos, end_pos - m_pos ); - } - - BOOST_FILESYSTEM_DECL void path::iterator::decrement() - { - assert( m_pos ); // detect decrement of begin - std::string::size_type end_pos( m_pos ); - - // skip a '/' unless it is a root directory - if ( m_path_ptr->m_path[end_pos-1] == '/' - && !detail::is_absolute_root( m_path_ptr->m_path, end_pos ) ) --end_pos; - m_pos = leaf_pos( m_path_ptr->m_path, end_pos ); - m_name = m_path_ptr->m_path.substr( m_pos, end_pos - m_pos ); - } - } // namespace filesystem -} // namespace boost diff --git a/boost/libs/filesystem/src/portability.cpp b/boost/libs/filesystem/src/portability.cpp new file mode 100644 index 0000000000..78dd81038e --- /dev/null +++ b/boost/libs/filesystem/src/portability.cpp @@ -0,0 +1,112 @@ +// portability.cpp ---------------------------------------------------------// + +// Copyright © 2002-2005 Beman Dawes +// 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) + +// See library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#include +#include + +namespace fs = boost::filesystem; + +#include // SGI MIPSpro compilers need this + +# ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::strerror; } +# endif + +//----------------------------------------------------------------------------// + +namespace +{ + const char invalid_chars[] = + "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" + "<>:\"/\\|"; + // note that the terminating '\0' is part of the string - thus the size below + // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I + const std::string windows_invalid_chars( invalid_chars, sizeof(invalid_chars) ); + + const std::string valid_posix( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-" ); + +} // unnamed namespace + +namespace boost +{ + namespace filesystem + { + + // name_check functions ----------------------------------------------// + +# ifdef BOOST_WINDOWS + BOOST_FILESYSTEM_DECL bool native( const std::string & name ) + { + return windows_name( name ); + } +# else + BOOST_FILESYSTEM_DECL bool native( const std::string & name ) + { + return name.find('/') == std::string::npos; + } +# endif + + BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ) + { + return name.size() != 0 + && name.find_first_not_of( valid_posix ) == std::string::npos; + } + + BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ) + { + return name.size() != 0 + && name.find_first_of( windows_invalid_chars ) == std::string::npos + && *(name.end()-1) != ' ' + && (*(name.end()-1) != '.' + || name.length() == 1 || name == ".."); + } + + BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ) + { + return + name.size() == 0 + || name == "." + || name == ".." + || (windows_name( name ) + && portable_posix_name( name ) + && name[0] != '.' && name[0] != '-'); + } + + BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ) + { + return + name == "." + || name == ".." + || (portable_name( name ) + && name.find('.') == std::string::npos); + } + + BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ) + { + std::string::size_type pos; + return + name == "." + || name == ".." + || (portable_name( name ) + && ( (pos = name.find( '.' )) == std::string::npos + || (name.find( '.', pos+1 )== std::string::npos + && (pos + 5) > name.length() ))) + ; + } + + } // namespace filesystem +} // namespace boost diff --git a/boost/libs/iostreams/src/file_descriptor.cpp b/boost/libs/iostreams/src/file_descriptor.cpp index 04b76bc6f9..d0c2192b09 100644 --- a/boost/libs/iostreams/src/file_descriptor.cpp +++ b/boost/libs/iostreams/src/file_descriptor.cpp @@ -175,14 +175,17 @@ std::streamsize file_descriptor::write(const char_type* s, std::streamsize n) return n; } -std::streampos file_descriptor::seek +stream_offset file_descriptor::seek (stream_offset off, BOOST_IOS::seekdir way) { using namespace std; #ifdef BOOST_IOSTREAMS_WINDOWS if (pimpl_->flags_ & impl::has_handle) { LONG lDistanceToMove = static_cast(off & 0xffffffff); - LONG lDistanceToMoveHigh = static_cast(off >> 32); + LONG lDistanceToMoveHigh = + off < 0xffffffff ? + static_cast(off >> 32) : + 0; DWORD dwResultLow = ::SetFilePointer( pimpl_->handle_, lDistanceToMove, @@ -195,7 +198,8 @@ std::streampos file_descriptor::seek if (::GetLastError() != NO_ERROR) { throw detail::bad_seek(); } else { - return offset_to_position((lDistanceToMoveHigh << 32) + dwResultLow); + return (static_cast(lDistanceToMoveHigh) << 32) + + dwResultLow; } } #endif // #ifdef BOOST_IOSTREAMS_WINDOWS @@ -227,7 +231,7 @@ std::streampos file_descriptor::seek SEEK_END ); if (result == -1) throw detail::bad_seek(); - return offset_to_position(result); + return result; } void file_descriptor::close() { close_impl(*pimpl_); } diff --git a/boost/libs/iostreams/src/mapped_file.cpp b/boost/libs/iostreams/src/mapped_file.cpp index 323a4d5dd6..b8c2a5a0cc 100644 --- a/boost/libs/iostreams/src/mapped_file.cpp +++ b/boost/libs/iostreams/src/mapped_file.cpp @@ -181,9 +181,7 @@ void mapped_file_source::open_impl(mapped_file_params p) (p.new_file_size != 0 && !readonly) ? CREATE_ALWAYS : OPEN_EXISTING, - readonly ? - FILE_ATTRIBUTE_READONLY : - FILE_ATTRIBUTE_TEMPORARY, + FILE_ATTRIBUTE_TEMPORARY, NULL ); if (pimpl_->handle_ == INVALID_HANDLE_VALUE) @@ -291,7 +289,7 @@ void cleanup_and_throw(detail::mapped_file_impl& impl, const char* msg) if (impl.handle_ != 0) ::close(impl.handle_); impl.clear(true); - throw_system_failure(msg); + throw_system_failure( msg ); } } // End namespace detail. diff --git a/boost/libs/iostreams/src/zlib.cpp b/boost/libs/iostreams/src/zlib.cpp index 5b4bb71fde..29b516578e 100644 --- a/boost/libs/iostreams/src/zlib.cpp +++ b/boost/libs/iostreams/src/zlib.cpp @@ -15,8 +15,7 @@ #include #include -#include "zlib.h" // Jean-loup Gailly's and Mark Adler's "zlib.h" header. - // To configure Boost to work with zlib, see the +#include "zlib.h" // To configure Boost to work with zlib, see the // installation instructions here: // http://boost.org/libs/iostreams/doc/index.html?path=7 @@ -80,7 +79,6 @@ void zlib_error::check(int error) throw std::bad_alloc(); default: throw zlib_error(error); - ; } } @@ -107,8 +105,8 @@ void zlib_base::before( const char*& src_begin, const char* src_end, void zlib_base::after(const char*& src_begin, char*& dest_begin, bool compress) { z_stream* s = static_cast(stream_); - char* next_in = reinterpret_cast(s->next_in); - char* next_out = reinterpret_cast(s->next_out); + char*& next_in = reinterpret_cast(s->next_in); + char*& next_out = reinterpret_cast(s->next_out); if (calculate_crc_) { const zlib::byte* buf = compress ? reinterpret_cast(src_begin) : @@ -123,7 +121,7 @@ void zlib_base::after(const char*& src_begin, char*& dest_begin, bool compress) } total_in_ = s->total_in; total_out_ = s->total_out; - src_begin = const_cast(next_in); + src_begin = const_cast(next_in); dest_begin = next_out; } @@ -140,14 +138,11 @@ int zlib_base::inflate(int flush) void zlib_base::reset(bool compress, bool realloc) { z_stream* s = static_cast(stream_); - // Undiagnosed bug: - // deflateReset(), etc., return Z_DATA_ERROR - //zlib_error::check( + zlib_error::check( realloc ? (compress ? deflateReset(s) : inflateReset(s)) : (compress ? deflateEnd(s) : inflateEnd(s)) - ; - //); + ); } void zlib_base::do_init diff --git a/boost/libs/regex/src/cregex.cpp b/boost/libs/regex/src/cregex.cpp index ca134265a0..2a9adc26a8 100644 --- a/boost/libs/regex/src/cregex.cpp +++ b/boost/libs/regex/src/cregex.cpp @@ -24,13 +24,8 @@ #if !defined(BOOST_NO_STD_STRING) #include #include -#ifdef BOOST_REGEX_V3 -#include -typedef unsigned match_flag_type; -#else #include typedef boost::match_flag_type match_flag_type; -#endif #include namespace boost{ @@ -584,7 +579,7 @@ const std::size_t RegEx::npos = static_cast(~0UL); // namespace std{ template<> template<> -basic_string& +basic_string& BOOST_REGEX_DECL basic_string::replace(char* f1, char* f2, const char* i1, const char* i2) { unsigned insert_pos = f1 - begin(); @@ -605,7 +600,29 @@ basic_string::replace(char* f1, char* f2, const char* i1, con } return *this; } +template<> template<> +basic_string& BOOST_REGEX_DECL +basic_string::replace(wchar_t* f1, wchar_t* f2, const wchar_t* i1, const wchar_t* i2) +{ + unsigned insert_pos = f1 - begin(); + unsigned remove_len = f2 - f1; + unsigned insert_len = i2 - i1; + unsigned org_size = size(); + if(insert_len > remove_len) + { + append(insert_len-remove_len, ' '); + std::copy_backward(begin() + insert_pos + remove_len, begin() + org_size, end()); + std::copy(i1, i2, begin() + insert_pos); + } + else + { + std::copy(begin() + insert_pos + remove_len, begin() + org_size, begin() + insert_pos + insert_len); + std::copy(i1, i2, begin() + insert_pos); + erase(size() + insert_len - remove_len); + } + return *this; } +} // namespace std #endif #endif diff --git a/boost/libs/regex/src/posix_api.cpp b/boost/libs/regex/src/posix_api.cpp index eb82f1b948..64cb5dc2db 100644 --- a/boost/libs/regex/src/posix_api.cpp +++ b/boost/libs/regex/src/posix_api.cpp @@ -37,10 +37,29 @@ namespace{ unsigned int magic_value = 25631; -const char* names[] = {"REG_NOERROR", "REG_NOMATCH", "REG_BADPAT", "REG_ECOLLATE", - "REG_ECTYPE", "REG_EESCAPE", "REG_ESUBREG", "REG_EBRACK", - "REG_EPAREN", "REG_EBRACE", "REG_BADBR", "REG_ERANGE", - "REG_ESPACE", "REG_BADRPT", "REG_EMPTY", "REG_E_UNKNOWN"}; +const char* names[] = { + "REG_NOERROR", + "REG_NOMATCH", + "REG_BADPAT", + "REG_ECOLLATE", + "REG_ECTYPE", + "REG_EESCAPE", + "REG_ESUBREG", + "REG_EBRACK", + "REG_EPAREN", + "REG_EBRACE", + "REG_BADBR", + "REG_ERANGE", + "REG_ESPACE", + "REG_BADRPT", + "REG_EEND", + "REG_ESIZE", + "REG_ERPAREN", + "REG_EMPTY", + "REG_ECOMPLEXITY", + "REG_ESTACK", + "REG_E_UNKNOWN", +}; } // namespace BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f) diff --git a/boost/libs/regex/src/regex.cpp b/boost/libs/regex/src/regex.cpp index 741465329b..0a503820cb 100644 --- a/boost/libs/regex/src/regex.cpp +++ b/boost/libs/regex/src/regex.cpp @@ -28,7 +28,9 @@ #endif #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD #define WIN32_LEAN_AND_MEAN -#define NOMINMAX +#ifndef NOMINMAX +# define NOMINMAX +#endif #define NOGDI #define NOUSER #include diff --git a/boost/libs/regex/src/regex_traits_defaults.cpp b/boost/libs/regex/src/regex_traits_defaults.cpp index 8f5a980c72..8f76c09e4f 100644 --- a/boost/libs/regex/src/regex_traits_defaults.cpp +++ b/boost/libs/regex/src/regex_traits_defaults.cpp @@ -427,62 +427,62 @@ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_defaul regex_constants::syntax_or, /*|*/ regex_constants::syntax_close_brace, /*}*/ regex_constants::escape_type_identity, /*~*/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /*€*/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /*‚*/ - regex_constants::escape_type_identity, /*ƒ*/ - regex_constants::escape_type_identity, /*„*/ - regex_constants::escape_type_identity, /*…*/ - regex_constants::escape_type_identity, /*†*/ - regex_constants::escape_type_identity, /*‡*/ - regex_constants::escape_type_identity, /*ˆ*/ - regex_constants::escape_type_identity, /*‰*/ - regex_constants::escape_type_identity, /*Š*/ - regex_constants::escape_type_identity, /*‹*/ - regex_constants::escape_type_identity, /*Œ*/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /*Ž*/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /*‘*/ - regex_constants::escape_type_identity, /*’*/ - regex_constants::escape_type_identity, /*“*/ - regex_constants::escape_type_identity, /*”*/ - regex_constants::escape_type_identity, /*•*/ - regex_constants::escape_type_identity, /*–*/ - regex_constants::escape_type_identity, /*—*/ - regex_constants::escape_type_identity, /*˜*/ - regex_constants::escape_type_identity, /*™*/ - regex_constants::escape_type_identity, /*š*/ - regex_constants::escape_type_identity, /*›*/ - regex_constants::escape_type_identity, /*œ*/ - regex_constants::escape_type_identity, /**/ - regex_constants::escape_type_identity, /*ž*/ - regex_constants::escape_type_identity, /*Ÿ*/ - regex_constants::escape_type_identity, /* */ - regex_constants::escape_type_identity, /*¡*/ - regex_constants::escape_type_identity, /*¢*/ - regex_constants::escape_type_identity, /*£*/ - regex_constants::escape_type_identity, /*¤*/ - regex_constants::escape_type_identity, /*¥*/ - regex_constants::escape_type_identity, /*¦*/ - regex_constants::escape_type_identity, /*§*/ - regex_constants::escape_type_identity, /*¨*/ - regex_constants::escape_type_identity, /*©*/ - regex_constants::escape_type_identity, /*ª*/ - regex_constants::escape_type_identity, /*«*/ - regex_constants::escape_type_identity, /*¬*/ - regex_constants::escape_type_identity, /*­*/ - regex_constants::escape_type_identity, /*®*/ - regex_constants::escape_type_identity, /*¯*/ - regex_constants::escape_type_identity, /*°*/ - regex_constants::escape_type_identity, /*±*/ - regex_constants::escape_type_identity, /*²*/ - regex_constants::escape_type_identity, /*³*/ - regex_constants::escape_type_identity, /*´*/ - regex_constants::escape_type_identity, /*µ*/ - regex_constants::escape_type_identity, /*¶*/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ + regex_constants::escape_type_identity, /**/ }; return char_syntax[(unsigned char)c]; @@ -622,62 +622,62 @@ BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_synta regex_constants::syntax_or, /*|*/ regex_constants::syntax_close_brace, /*}*/ regex_constants::syntax_char, /*~*/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /*€*/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /*‚*/ - regex_constants::syntax_char, /*ƒ*/ - regex_constants::syntax_char, /*„*/ - regex_constants::syntax_char, /*…*/ - regex_constants::syntax_char, /*†*/ - regex_constants::syntax_char, /*‡*/ - regex_constants::syntax_char, /*ˆ*/ - regex_constants::syntax_char, /*‰*/ - regex_constants::syntax_char, /*Š*/ - regex_constants::syntax_char, /*‹*/ - regex_constants::syntax_char, /*Œ*/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /*Ž*/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /*‘*/ - regex_constants::syntax_char, /*’*/ - regex_constants::syntax_char, /*“*/ - regex_constants::syntax_char, /*”*/ - regex_constants::syntax_char, /*•*/ - regex_constants::syntax_char, /*–*/ - regex_constants::syntax_char, /*—*/ - regex_constants::syntax_char, /*˜*/ - regex_constants::syntax_char, /*™*/ - regex_constants::syntax_char, /*š*/ - regex_constants::syntax_char, /*›*/ - regex_constants::syntax_char, /*œ*/ - regex_constants::syntax_char, /**/ - regex_constants::syntax_char, /*ž*/ - regex_constants::syntax_char, /*Ÿ*/ - regex_constants::syntax_char, /* */ - regex_constants::syntax_char, /*¡*/ - regex_constants::syntax_char, /*¢*/ - regex_constants::syntax_char, /*£*/ - regex_constants::syntax_char, /*¤*/ - regex_constants::syntax_char, /*¥*/ - regex_constants::syntax_char, /*¦*/ - regex_constants::syntax_char, /*§*/ - regex_constants::syntax_char, /*¨*/ - regex_constants::syntax_char, /*©*/ - regex_constants::syntax_char, /*ª*/ - regex_constants::syntax_char, /*«*/ - regex_constants::syntax_char, /*¬*/ - regex_constants::syntax_char, /*­*/ - regex_constants::syntax_char, /*®*/ - regex_constants::syntax_char, /*¯*/ - regex_constants::syntax_char, /*°*/ - regex_constants::syntax_char, /*±*/ - regex_constants::syntax_char, /*²*/ - regex_constants::syntax_char, /*³*/ - regex_constants::syntax_char, /*´*/ - regex_constants::syntax_char, /*µ*/ - regex_constants::syntax_char, /*¶*/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ + regex_constants::syntax_char, /**/ }; return char_syntax[(unsigned char)c]; diff --git a/boost/libs/regex/src/w32_regex_traits.cpp b/boost/libs/regex/src/w32_regex_traits.cpp index 20e84d150f..64fd2ce410 100644 --- a/boost/libs/regex/src/w32_regex_traits.cpp +++ b/boost/libs/regex/src/w32_regex_traits.cpp @@ -24,7 +24,9 @@ #include #define WIN32_LEAN_AND_MEAN -#define NOMINMAX +#ifndef NOMINMAX +# define NOMINMAX +#endif #define NOGDI #include diff --git a/boost/libs/regex/src/wide_posix_api.cpp b/boost/libs/regex/src/wide_posix_api.cpp index 97a2225d66..0673e17d45 100644 --- a/boost/libs/regex/src/wide_posix_api.cpp +++ b/boost/libs/regex/src/wide_posix_api.cpp @@ -44,11 +44,29 @@ namespace { unsigned int wmagic_value = 28631; -const wchar_t* wnames[] = {L"REG_NOERROR", L"REG_NOMATCH", L"REG_BADPAT", L"REG_ECOLLATE", - L"REG_ECTYPE", L"REG_EESCAPE", L"REG_ESUBREG", L"REG_EBRACK", - L"REG_EPAREN", L"REG_EBRACE", L"REG_BADBR", L"REG_ERANGE", - L"REG_ESPACE", L"REG_BADRPT", L"REG_EMPTY", L"REG_E_UNKNOWN"}; - +const wchar_t* wnames[] = { + L"REG_NOERROR", + L"REG_NOMATCH", + L"REG_BADPAT", + L"REG_ECOLLATE", + L"REG_ECTYPE", + L"REG_EESCAPE", + L"REG_ESUBREG", + L"REG_EBRACK", + L"REG_EPAREN", + L"REG_EBRACE", + L"REG_BADBR", + L"REG_ERANGE", + L"REG_ESPACE", + L"REG_BADRPT", + L"REG_EEND", + L"REG_ESIZE", + L"REG_ERPAREN", + L"REG_EMPTY", + L"REG_ECOMPLEXITY", + L"REG_ESTACK", + L"REG_E_UNKNOWN", +}; } BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f) diff --git a/src/client/client.C b/src/client/client.C index 795ece7ce5..5cfad794c8 100644 --- a/src/client/client.C +++ b/src/client/client.C @@ -93,7 +93,7 @@ vector lyxSockets(string const & dir, string const & pid) for (; beg != end; ++beg) { if (prefixIs(beg->leaf(), "lyx_tmpdir" + pid)) { - fs::path lyxsocket = *beg / "lyxsocket"; + fs::path lyxsocket = beg->path() / "lyxsocket"; if (fs::exists(lyxsocket)) { dirlist.push_back(lyxsocket); } diff --git a/src/support/fs_extras.C b/src/support/fs_extras.C index 0be6a70811..ebfed60766 100644 --- a/src/support/fs_extras.C +++ b/src/support/fs_extras.C @@ -96,33 +96,35 @@ void copy_file(path const & source, path const & target, bool noclobber) int const infile = ::open(source.string().c_str(), O_RDONLY); if (infile == -1) { boost::throw_exception( - filesystem_error( + filesystem_path_error( "boost::filesystem::copy_file", source, target, - fs::detail::system_error_code())); + fs::lookup_errno(errno))); } - struct stat source_stat; - int const ret = ::fstat(infile, &source_stat); - if (ret == -1) { - ::close(infile); + struct stat source_stat; + int const ret = ::fstat(infile, &source_stat); + if (ret == -1) { + int err = errno; + ::close(infile); boost::throw_exception( - filesystem_error( - "boost::filesystem::copy_file", - source, target, - fs::detail::system_error_code())); + filesystem_path_error( + "boost::filesystem::copy_file", + source, target, + fs::lookup_errno(err))); } int const flags = O_WRONLY | O_CREAT | (noclobber ? O_EXCL : O_TRUNC); - int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode); - if (outfile == -1) { - ::close(infile); + int const outfile = ::open(target.string().c_str(), flags, source_stat.st_mode); + if (outfile == -1) { + int err = errno; + ::close(infile); boost::throw_exception( - filesystem_error( + filesystem_path_error( "boost::filesystem::copy_file", source, target, - fs::detail::system_error_code())); + fs::lookup_errno(err))); } std::size_t const buf_sz = 32768; @@ -144,23 +146,27 @@ void copy_file(path const & source, path const & target, bool noclobber) } } - ::close(infile); - ::close(outfile); + int err = errno; + + ::close(infile); + ::close(outfile); if (in == -1 || out == -1) boost::throw_exception( - filesystem_error( + filesystem_path_error( "boost::filesystem::copy_file", source, target, - fs::detail::system_error_code())); + fs::lookup_errno(err))); #endif #ifdef BOOST_WINDOWS if (::CopyFile(source.string().c_str(), target.string().c_str(), noclobber) == 0) { + // CopyFile is probably not setting errno so this is most + // likely wrong. boost::throw_exception( - filesystem_error( + filesystem_path_error( "boost::filesystem::copy_file", source, target, - fs::detail::system_error_code())); + fs::detail::system_error_code(errno))); } #endif } -- 2.39.2