diff --git a/3party/boost/boost/algorithm/string/detail/find_format_store.hpp b/3party/boost/boost/algorithm/string/detail/find_format_store.hpp index 24fe374c7f..4872c5a998 100644 --- a/3party/boost/boost/algorithm/string/detail/find_format_store.hpp +++ b/3party/boost/boost/algorithm/string/detail/find_format_store.hpp @@ -71,7 +71,7 @@ namespace boost { }; template - bool check_find_result(InputT& Input, FindResultT& FindResult) + bool check_find_result(InputT&, FindResultT& FindResult) { typedef BOOST_STRING_TYPENAME range_const_iterator::type input_iterator_type; diff --git a/3party/boost/boost/archive/basic_archive.hpp b/3party/boost/boost/archive/basic_archive.hpp index 8c9f2b92b5..b6769dddbb 100644 --- a/3party/boost/boost/archive/basic_archive.hpp +++ b/3party/boost/boost/archive/basic_archive.hpp @@ -54,7 +54,7 @@ public: return *this; } // used for text output - operator const base_type () const { + operator base_type () const { return t; } // used for text input @@ -90,7 +90,7 @@ public: return *this; } // used for text output - operator const base_type () const { + operator base_type () const { return t; } // used for text intput @@ -127,7 +127,7 @@ public: } // used for text output - operator const int () const { + operator int () const { return t; } // used for text input @@ -161,7 +161,7 @@ public: return *this; } // used for text output - operator const uint_least32_t () const { + operator uint_least32_t () const { return t; } // used for text input @@ -282,4 +282,19 @@ BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type) BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type) BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type) +#include + +// set types used internally by the serialization library +// to be bitwise serializable + +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::library_version_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::version_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_optional_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_name_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::tracking_type) + #endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP diff --git a/3party/boost/boost/archive/basic_binary_iarchive.hpp b/3party/boost/boost/archive/basic_binary_iarchive.hpp index d756926912..9567395559 100644 --- a/3party/boost/boost/archive/basic_binary_iarchive.hpp +++ b/3party/boost/boost/archive/basic_binary_iarchive.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef BOOST_MSVC # pragma warning(push) @@ -71,7 +72,7 @@ public: // include these to trap a change in binary format which // isn't specifically handled - BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char)); + BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool)); // upto 32K classes BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); @@ -82,21 +83,61 @@ public: // binary files don't include the optional information void load_override(class_id_optional_type & /* t */, int){} - void load_override(boost::serialization::item_version_type & t, int version){ - if(library_version_type(6) < this->get_library_version()){ + void load_override(class_id_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ this->detail_common_iarchive::load_override(t, version); } + else + if(boost::archive::library_version_type(6) < lvt){ + int_least16_t x=0; + * this->This() >> x; + t = boost::archive::class_id_type(x); + } else{ - unsigned int x=0; + int x=0; * this->This() >> x; - t = boost::serialization::item_version_type(x); + t = boost::archive::class_id_type(x); } } + void load_override(class_id_reference_type & t, int version){ + load_override(static_cast(t), version); + } +#if 0 + void load_override(class_id_reference_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(boost::archive::library_version_type(6) < lvt){ + int_least16_t x=0; + * this->This() >> x; + t = boost::archive::class_id_reference_type( + boost::archive::class_id_type(x) + ); + } + else{ + int x=0; + * this->This() >> x; + t = boost::archive::class_id_reference_type( + boost::archive::class_id_type(x) + ); + } + } +#endif void load_override(version_type & t, int version){ - if(boost::archive::library_version_type(6) < this->get_library_version()){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ this->detail_common_iarchive::load_override(t, version); } + else + if(boost::archive::library_version_type(6) < lvt){ + uint_least16_t x=0; + * this->This() >> x; + t = boost::archive::version_type(x); + } else{ unsigned int x=0; * this->This() >> x; @@ -104,6 +145,24 @@ public: } } + void load_override(boost::serialization::item_version_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(boost::archive::library_version_type(6) < lvt){ + uint_least16_t x=0; + * this->This() >> x; + t = boost::serialization::item_version_type(x); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = boost::serialization::item_version_type(x); + } + } + void load_override(serialization::collection_size_type & t, int version){ if(boost::archive::library_version_type(5) < this->get_library_version()){ this->detail_common_iarchive::load_override(t, version); diff --git a/3party/boost/boost/archive/basic_binary_iprimitive.hpp b/3party/boost/boost/archive/basic_binary_iprimitive.hpp index 3ff2b5703b..a5b6bd4aa1 100644 --- a/3party/boost/boost/archive/basic_binary_iprimitive.hpp +++ b/3party/boost/boost/archive/basic_binary_iprimitive.hpp @@ -126,10 +126,10 @@ public: template #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) struct apply { - typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable::type type; + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable< T >::type type; }; #else - struct apply : public boost::serialization::is_bitwise_serializable {}; + struct apply : public boost::serialization::is_bitwise_serializable< T > {}; #endif }; diff --git a/3party/boost/boost/archive/basic_binary_oarchive.hpp b/3party/boost/boost/archive/basic_binary_oarchive.hpp index f20471a56e..5321bf0b63 100644 --- a/3party/boost/boost/archive/basic_binary_oarchive.hpp +++ b/3party/boost/boost/archive/basic_binary_oarchive.hpp @@ -34,6 +34,7 @@ #include #include #include +#include #include // must be the last header @@ -76,7 +77,7 @@ public: // include these to trap a change in binary format which // isn't specifically handled - BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char)); + BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool)); // upto 32K classes BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); @@ -87,14 +88,58 @@ public: // binary files don't include the optional information void save_override(const class_id_optional_type & /* t */, int){} - #if 0 // enable this if we decide to support generation of previous versions + // enable this if we decide to support generation of previous versions + #if 0 void save_override(const boost::archive::version_type & t, int version){ - if(this->get_library_version() < boost::archive::library_version_type(7)){ - * this->This() << static_cast(t); + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); } else - this->detail_common_oarchive::save_override(t, version); + if(boost::archive::library_version_type(6) < lvt){ + const boost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } } + void save_override(const boost::serialization::item_version_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); + } + else + if(boost::archive::library_version_type(6) < lvt){ + const boost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } + } + + void save_override(class_id_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(boost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); + } + else + if(boost::archive::library_version_type(6) < lvt){ + const boost::int_least16_t x = t; + * this->This() << x; + } + else{ + const int x = t; + * this->This() << x; + } + } + void save_override(class_id_reference_type & t, int version){ + save_override(static_cast(t), version); + } + #endif // explicitly convert to char * to avoid compile ambiguities diff --git a/3party/boost/boost/archive/basic_binary_oprimitive.hpp b/3party/boost/boost/archive/basic_binary_oprimitive.hpp index d1be7db78c..fb0485881b 100644 --- a/3party/boost/boost/archive/basic_binary_oprimitive.hpp +++ b/3party/boost/boost/archive/basic_binary_oprimitive.hpp @@ -122,10 +122,10 @@ public: template #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) struct apply { - typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable::type type; + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable< T >::type type; }; #else - struct apply : public boost::serialization::is_bitwise_serializable {}; + struct apply : public boost::serialization::is_bitwise_serializable< T > {}; #endif }; diff --git a/3party/boost/boost/archive/basic_xml_iarchive.hpp b/3party/boost/boost/archive/basic_xml_iarchive.hpp index 5351ff353a..d7b8bfd0ce 100644 --- a/3party/boost/boost/archive/basic_xml_iarchive.hpp +++ b/3party/boost/boost/archive/basic_xml_iarchive.hpp @@ -67,7 +67,7 @@ public: // If your program fails to compile here, its most likely due to // not specifying an nvp wrapper around the variable to // be serialized. - BOOST_MPL_ASSERT((serialization::is_wrapper)); + BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); this->detail_common_iarchive::load_override(t, 0); } @@ -79,7 +79,7 @@ public: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif - boost::serialization::nvp & t, + boost::serialization::nvp< T > & t, int ){ this->This()->load_start(t.name()); diff --git a/3party/boost/boost/archive/basic_xml_oarchive.hpp b/3party/boost/boost/archive/basic_xml_oarchive.hpp index 20d934a6c0..b571372ca7 100644 --- a/3party/boost/boost/archive/basic_xml_oarchive.hpp +++ b/3party/boost/boost/archive/basic_xml_oarchive.hpp @@ -89,7 +89,7 @@ public: // If your program fails to compile here, its most likely due to // not specifying an nvp wrapper around the variable to // be serialized. - BOOST_MPL_ASSERT((serialization::is_wrapper)); + BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); this->detail_common_oarchive::save_override(t, 0); } @@ -100,7 +100,7 @@ public: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif - ::boost::serialization::nvp & t, + ::boost::serialization::nvp< T > & t, int ){ this->This()->save_start(t.name()); diff --git a/3party/boost/boost/archive/detail/check.hpp b/3party/boost/boost/archive/detail/check.hpp index 737c12c913..c9cba519f8 100644 --- a/3party/boost/boost/archive/detail/check.hpp +++ b/3party/boost/boost/archive/detail/check.hpp @@ -51,7 +51,7 @@ template inline void check_object_level(){ typedef BOOST_DEDUCED_TYPENAME mpl::greater_equal< - serialization::implementation_level, + serialization::implementation_level< T >, mpl::int_ >::type typex; @@ -65,11 +65,11 @@ inline void check_object_versioning(){ typedef BOOST_DEDUCED_TYPENAME mpl::or_< BOOST_DEDUCED_TYPENAME mpl::greater< - serialization::implementation_level, + serialization::implementation_level< T >, mpl::int_ >, BOOST_DEDUCED_TYPENAME mpl::equal_to< - serialization::version, + serialization::version< T >, mpl::int_<0> > > typex; @@ -82,9 +82,9 @@ template inline void check_object_tracking(){ // presume it has already been determined that // T is not a const - BOOST_STATIC_ASSERT(! boost::is_const::value); + BOOST_STATIC_ASSERT(! boost::is_const< T >::value); typedef BOOST_DEDUCED_TYPENAME mpl::equal_to< - serialization::tracking_level, + serialization::tracking_level< T >, mpl::int_ >::type typex; // saving an non-const object of a type not marked "track_never) @@ -107,12 +107,12 @@ inline void check_pointer_level(){ typedef BOOST_DEDUCED_TYPENAME mpl::or_< BOOST_DEDUCED_TYPENAME mpl::greater< - serialization::implementation_level, + serialization::implementation_level< T >, mpl::int_ >, BOOST_DEDUCED_TYPENAME mpl::not_< BOOST_DEDUCED_TYPENAME mpl::equal_to< - serialization::tracking_level, + serialization::tracking_level< T >, mpl::int_ > > @@ -140,7 +140,7 @@ inline void check_pointer_level(){ template void inline check_pointer_tracking(){ typedef BOOST_DEDUCED_TYPENAME mpl::greater< - serialization::tracking_level, + serialization::tracking_level< T >, mpl::int_ >::type typex; // serializing an object of a type marked "track_never" through a pointer @@ -152,9 +152,9 @@ template inline void check_const_loading(){ typedef BOOST_DEDUCED_TYPENAME mpl::or_< - BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper, + BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper< T >, BOOST_DEDUCED_TYPENAME mpl::not_< - BOOST_DEDUCED_TYPENAME boost::is_const + BOOST_DEDUCED_TYPENAME boost::is_const< T > > >::type typex; // cannot load data into a "const" object unless it's a diff --git a/3party/boost/boost/archive/detail/iserializer.hpp b/3party/boost/boost/archive/detail/iserializer.hpp index 293155a542..46033fddf2 100644 --- a/3party/boost/boost/archive/detail/iserializer.hpp +++ b/3party/boost/boost/archive/detail/iserializer.hpp @@ -128,7 +128,7 @@ protected: basic_iserializer( boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) {} @@ -139,21 +139,21 @@ public: const unsigned int file_version ) const BOOST_USED; virtual bool class_info() const { - return boost::serialization::implementation_level::value + return boost::serialization::implementation_level< T >::value >= boost::serialization::object_class_info; } virtual bool tracking(const unsigned int /* flags */) const { - return boost::serialization::tracking_level::value + return boost::serialization::tracking_level< T >::value == boost::serialization::track_always - || ( boost::serialization::tracking_level::value + || ( boost::serialization::tracking_level< T >::value == boost::serialization::track_selectively && serialized_as_pointer()); } virtual version_type version() const { - return version_type(::boost::serialization::version::value); + return version_type(::boost::serialization::version< T >::value); } virtual bool is_polymorphic() const { - return boost::is_polymorphic::value; + return boost::is_polymorphic< T >::value; } virtual ~iserializer(){}; }; @@ -168,6 +168,12 @@ BOOST_DLLEXPORT void iserializer::load_object_data( void *x, const unsigned int file_version ) const { + // note: we now comment this out. Before we permited archive + // version # to be very large. Now we don't. To permit + // readers of these old archives, we have to suppress this + // code. Perhaps in the future we might re-enable it but + // permit its suppression with a runtime switch. + #if 0 // trap case where the program cannot handle the current version if(file_version > static_cast(version())) boost::serialization::throw_exception( @@ -176,7 +182,7 @@ BOOST_DLLEXPORT void iserializer::load_object_data( get_debug_info() ) ); - + #endif // make sure call is routed through the higest interface that might // be specialized by the user. boost::serialization::serialize_adl( @@ -230,7 +236,7 @@ protected: template struct heap_allocator { - // boost::has_new_operator doesn't work on these compilers + // boost::has_new_operator< T > doesn't work on these compilers #if DONT_USE_HAS_NEW_OPERATOR // This doesn't handle operator new overload for class T static T * invoke(){ @@ -250,7 +256,7 @@ struct heap_allocator static T * invoke() { typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - boost::has_new_operator, + boost::has_new_operator< T >, mpl::identity, mpl::identity >::type typex; @@ -296,7 +302,7 @@ BOOST_DLLEXPORT void pointer_iserializer::load_object_ptr( Archive & ar_impl = boost::serialization::smart_cast_reference(ar); - auto_ptr_with_deleter ap(heap_allocator::invoke()); + auto_ptr_with_deleter< T > ap(heap_allocator< T >::invoke()); if(NULL == ap.get()) boost::serialization::throw_exception(std::bad_alloc()) ; @@ -331,7 +337,7 @@ pointer_iserializer::pointer_iserializer() : basic_pointer_iserializer( boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) { @@ -367,7 +373,7 @@ struct load_non_pointer_type { boost::serialization::serialize_adl( ar, const_cast(t), - boost::serialization::version::value + boost::serialization::version< T >::value ); } }; @@ -402,7 +408,7 @@ struct load_non_pointer_type { typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< // if its primitive mpl::equal_to< - boost::serialization::implementation_level, + boost::serialization::implementation_level< T >, mpl::int_ >, mpl::identity, @@ -410,7 +416,7 @@ struct load_non_pointer_type { BOOST_DEDUCED_TYPENAME mpl::eval_if< // class info / version mpl::greater_equal< - boost::serialization::implementation_level, + boost::serialization::implementation_level< T >, mpl::int_ >, // do standard load @@ -419,7 +425,7 @@ struct load_non_pointer_type { BOOST_DEDUCED_TYPENAME mpl::eval_if< // no tracking mpl::equal_to< - boost::serialization::tracking_level, + boost::serialization::tracking_level< T >, mpl::int_ >, // do a fast load @@ -428,8 +434,8 @@ struct load_non_pointer_type { // do a fast load only tracking is turned off mpl::identity > > >::type typex; - check_object_versioning(); - check_object_level(); + check_object_versioning< T >(); + check_object_level< T >(); typex::invoke(ar, t); } }; @@ -441,7 +447,7 @@ struct load_pointer_type { template static const basic_pointer_iserializer * register_type(Archive & /* ar */){ // it has? to be polymorphic - BOOST_STATIC_ASSERT(boost::is_polymorphic::value); + BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value); return static_cast(NULL); } }; @@ -466,7 +472,7 @@ struct load_pointer_type { boost::mpl::identity, boost::mpl::identity >::type typex; - return typex::template register_type(ar); + return typex::template register_type< T >(ar); } template @@ -482,7 +488,7 @@ struct load_pointer_type { eti, boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance(), t ) @@ -492,8 +498,8 @@ struct load_pointer_type { template static void check_load(T & /* t */){ - check_pointer_level(); - check_pointer_tracking(); + check_pointer_level< T >(); + check_pointer_tracking< T >(); } static const basic_pointer_iserializer * @@ -530,7 +536,7 @@ struct load_enum_type { // convert integers to correct enum to load int i; ar >> boost::serialization::make_nvp(NULL, i); - t = static_cast(i); + t = static_cast< T >(i); } }; @@ -538,7 +544,7 @@ template struct load_array_type { template static void invoke(Archive &ar, T &t){ - typedef BOOST_DEDUCED_TYPENAME remove_extent::type value_type; + typedef BOOST_DEDUCED_TYPENAME remove_extent< T >::type value_type; // convert integers to correct enum to load // determine number of elements in the array. Consider the @@ -568,15 +574,15 @@ inline void load(Archive & ar, T &t){ // const object with a compiler that doesn't have correct // funtion template ordering. On other compilers, this is // handled below. - detail::check_const_loading(); + detail::check_const_loading< T >(); typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity > ,//else - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity > ,//else - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity > ,//else mpl::identity > @@ -613,7 +619,7 @@ inline void load_wrapper(Archive &ar, const T&t, mpl::true_){ #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) template inline void load(Archive &ar, const T&t){ - load_wrapper(ar,t,serialization::is_wrapper()); + load_wrapper(ar,t,serialization::is_wrapper< T >()); } #endif #endif diff --git a/3party/boost/boost/archive/detail/oserializer.hpp b/3party/boost/boost/archive/detail/oserializer.hpp index 009204a30e..e676f6365d 100644 --- a/3party/boost/boost/archive/detail/oserializer.hpp +++ b/3party/boost/boost/archive/detail/oserializer.hpp @@ -107,7 +107,7 @@ public: basic_oserializer( boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) {} @@ -116,19 +116,19 @@ public: const void *x ) const BOOST_USED; virtual bool class_info() const { - return boost::serialization::implementation_level::value + return boost::serialization::implementation_level< T >::value >= boost::serialization::object_class_info; } virtual bool tracking(const unsigned int /* flags */) const { - return boost::serialization::tracking_level::value == boost::serialization::track_always - || (boost::serialization::tracking_level::value == boost::serialization::track_selectively + return boost::serialization::tracking_level< T >::value == boost::serialization::track_always + || (boost::serialization::tracking_level< T >::value == boost::serialization::track_selectively && serialized_as_pointer()); } virtual version_type version() const { - return version_type(::boost::serialization::version::value); + return version_type(::boost::serialization::version< T >::value); } virtual bool is_polymorphic() const { - return boost::is_polymorphic::value; + return boost::is_polymorphic< T >::value; } virtual ~oserializer(){} }; @@ -144,7 +144,7 @@ BOOST_DLLEXPORT void oserializer::save_object_data( ) const { // make sure call is routed through the highest interface that might // be specialized by the user. - BOOST_STATIC_ASSERT(boost::is_const::value == false); + BOOST_STATIC_ASSERT(boost::is_const< T >::value == false); boost::serialization::serialize_adl( boost::serialization::smart_cast_reference(ar), * static_cast(const_cast(x)), @@ -190,7 +190,7 @@ BOOST_DLLEXPORT void pointer_oserializer::save_object_ptr( // make sure call is routed through the highest interface that might // be specialized by the user. T * t = static_cast(const_cast(x)); - const unsigned int file_version = boost::serialization::version::value; + const unsigned int file_version = boost::serialization::version< T >::value; Archive & ar_impl = boost::serialization::smart_cast_reference(ar); boost::serialization::save_construct_data_adl( @@ -206,7 +206,7 @@ pointer_oserializer::pointer_oserializer() : basic_pointer_oserializer( boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) { @@ -241,7 +241,7 @@ struct save_non_pointer_type { boost::serialization::serialize_adl( ar, const_cast(t), - ::boost::serialization::version::value + ::boost::serialization::version< T >::value ); } }; @@ -278,7 +278,7 @@ struct save_non_pointer_type { BOOST_DEDUCED_TYPENAME mpl::eval_if< // if its primitive mpl::equal_to< - boost::serialization::implementation_level, + boost::serialization::implementation_level< T >, mpl::int_ >, mpl::identity, @@ -286,7 +286,7 @@ struct save_non_pointer_type { BOOST_DEDUCED_TYPENAME mpl::eval_if< // class info / version mpl::greater_equal< - boost::serialization::implementation_level, + boost::serialization::implementation_level< T >, mpl::int_ >, // do standard save @@ -295,7 +295,7 @@ struct save_non_pointer_type { BOOST_DEDUCED_TYPENAME mpl::eval_if< // no tracking mpl::equal_to< - boost::serialization::tracking_level, + boost::serialization::tracking_level< T >, mpl::int_ >, // do a fast save @@ -304,13 +304,13 @@ struct save_non_pointer_type { // do a fast save only tracking is turned off mpl::identity > > >::type typex; - check_object_versioning(); + check_object_versioning< T >(); typex::invoke(ar, t); } template static void invoke(Archive & ar, T & t){ - check_object_level(); - check_object_tracking(); + check_object_level< T >(); + check_object_tracking< T >(); invoke(ar, const_cast(t)); } }; @@ -322,7 +322,7 @@ struct save_pointer_type { template static const basic_pointer_oserializer * register_type(Archive & /* ar */){ // it has? to be polymorphic - BOOST_STATIC_ASSERT(boost::is_polymorphic::value); + BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value); return NULL; } }; @@ -343,11 +343,11 @@ struct save_pointer_type { // virtual serialize functions used for plug-ins typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - boost::serialization::is_abstract, + boost::serialization::is_abstract< T >, mpl::identity, mpl::identity >::type typex; - return typex::template register_type(ar); + return typex::template register_type< T >(ar); } struct non_polymorphic @@ -374,10 +374,10 @@ struct save_pointer_type { T & t ){ BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type const + boost::serialization::type_info_implementation< T >::type const & i = boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance(); boost::serialization::extended_type_info const * const this_type = & i; @@ -450,10 +450,10 @@ struct save_pointer_type { Archive & ar, const T & t ){ - check_pointer_level(); - check_pointer_tracking(); + check_pointer_level< T >(); + check_pointer_tracking< T >(); typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_polymorphic, + is_polymorphic< T >, mpl::identity, mpl::identity >::type type; @@ -490,7 +490,7 @@ struct save_array_type { template static void invoke(Archive &ar, const T &t){ - typedef BOOST_DEDUCED_TYPENAME boost::remove_extent::type value_type; + typedef BOOST_DEDUCED_TYPENAME boost::remove_extent< T >::type value_type; save_access::end_preamble(ar); // consider alignment @@ -509,13 +509,13 @@ struct save_array_type template inline void save(Archive & ar, /*const*/ T &t){ typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity >, //else - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity >, //else - BOOST_DEDUCED_TYPENAME mpl::eval_if, + BOOST_DEDUCED_TYPENAME mpl::eval_if, mpl::identity >, //else mpl::identity > diff --git a/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp b/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp index 007b5ce645..d93bb79cb1 100644 --- a/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/3party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -180,13 +180,17 @@ public: polymorphic_iarchive & operator>>(T & t){ return polymorphic_iarchive::operator>>(t); } - // the & operator template polymorphic_iarchive & operator&(T & t){ return polymorphic_iarchive::operator&(t); } - + // register type function + template + const basic_pointer_iserializer * + register_type(T * t = NULL){ + return ArchiveImplementation::register_type(t); + } // all current archives take a stream as constructor argument template polymorphic_iarchive_route( diff --git a/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp b/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp index 00a39801c6..f1b20f8bf1 100644 --- a/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/3party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -175,6 +175,12 @@ public: polymorphic_oarchive & operator&(T & t){ return polymorphic_oarchive::operator&(t); } + // register type function + template + const basic_pointer_oserializer * + register_type(T * t = NULL){ + return ArchiveImplementation::register_type(t); + } // all current archives take a stream as constructor argument template polymorphic_oarchive_route( diff --git a/3party/boost/boost/archive/impl/archive_serializer_map.ipp b/3party/boost/boost/archive/impl/archive_serializer_map.ipp index f8e6ab5169..c8ad96b3d7 100644 --- a/3party/boost/boost/archive/impl/archive_serializer_map.ipp +++ b/3party/boost/boost/archive/impl/archive_serializer_map.ipp @@ -26,7 +26,7 @@ namespace detail { # pragma warning(disable : 4511 4512) #endif -namespace { // anon +namespace extra_detail { // anon template class map : public basic_serializer_map {}; @@ -40,7 +40,7 @@ template BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool) archive_serializer_map::insert(const basic_serializer * bs){ return boost::serialization::singleton< - map + extra_detail::map >::get_mutable_instance().insert(bs); } @@ -48,11 +48,11 @@ template BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) archive_serializer_map::erase(const basic_serializer * bs){ if(boost::serialization::singleton< - map + extra_detail::map >::is_destroyed()) return; boost::serialization::singleton< - map + extra_detail::map >::get_mutable_instance().erase(bs); } @@ -62,7 +62,7 @@ archive_serializer_map::find( const boost::serialization::extended_type_info & eti ) { return boost::serialization::singleton< - map + extra_detail::map >::get_const_instance().find(eti); } diff --git a/3party/boost/boost/archive/impl/basic_binary_iarchive.ipp b/3party/boost/boost/archive/impl/basic_binary_iarchive.ipp index 3f00a8f5a0..a9757b30d4 100644 --- a/3party/boost/boost/archive/impl/basic_binary_iarchive.ipp +++ b/3party/boost/boost/archive/impl/basic_binary_iarchive.ipp @@ -22,6 +22,7 @@ namespace std{ #endif #include +#include #include @@ -76,7 +77,38 @@ basic_binary_iarchive::init(){ // make sure the version of the reading archive library can // support the format of the archive being read library_version_type input_library_version; - * this->This() >> input_library_version; + //* this->This() >> input_library_version; + { + int v = 0; + v = this->This()->m_sb.sbumpc(); + #if defined(BOOST_LITTLE_ENDIAN) + if(v < 6){ + ; + } + else + if(v < 7){ + // version 6 - next byte should be zero + this->This()->m_sb.sbumpc(); + } + else + if(v < 8){ + int x1; + // version 7 = might be followed by zero or some other byte + x1 = this->This()->m_sb.sgetc(); + // it's =a zero, push it back + if(0 == x1) + this->This()->m_sb.sbumpc(); + } + else{ + // version 8+ followed by a zero + this->This()->m_sb.sbumpc(); + } + #elif defined(BOOST_BIG_ENDIAN) + if(v == 0) + v = this->This()->m_sb.sbumpc(); + #endif + input_library_version = static_cast(v); + } #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) this->set_library_version(input_library_version); diff --git a/3party/boost/boost/archive/iterators/base64_from_binary.hpp b/3party/boost/boost/archive/iterators/base64_from_binary.hpp index a46137d1d5..4e6023a8f0 100644 --- a/3party/boost/boost/archive/iterators/base64_from_binary.hpp +++ b/3party/boost/boost/archive/iterators/base64_from_binary.hpp @@ -91,7 +91,7 @@ public: template base64_from_binary(BOOST_PFTO_WRAPPER(T) start) : super_t( - Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start))), + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start))), detail::from_6_bit() ) {} diff --git a/3party/boost/boost/archive/iterators/binary_from_base64.hpp b/3party/boost/boost/archive/iterators/binary_from_base64.hpp index b75e0b10cc..d14439f1cd 100644 --- a/3party/boost/boost/archive/iterators/binary_from_base64.hpp +++ b/3party/boost/boost/archive/iterators/binary_from_base64.hpp @@ -99,7 +99,7 @@ public: template binary_from_base64(BOOST_PFTO_WRAPPER(T) start) : super_t( - Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start))), + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start))), detail::to_6_bit() ) {} diff --git a/3party/boost/boost/archive/iterators/insert_linebreaks.hpp b/3party/boost/boost/archive/iterators/insert_linebreaks.hpp index feb8c5bb84..09b13e5b41 100644 --- a/3party/boost/boost/archive/iterators/insert_linebreaks.hpp +++ b/3party/boost/boost/archive/iterators/insert_linebreaks.hpp @@ -84,7 +84,7 @@ public: // make composible buy using templated constructor template insert_linebreaks(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), m_count(0) {} // intel 7.1 doesn't like default copy constructor diff --git a/3party/boost/boost/archive/iterators/mb_from_wchar.hpp b/3party/boost/boost/archive/iterators/mb_from_wchar.hpp index 22ee9504e5..4b34c0fa07 100644 --- a/3party/boost/boost/archive/iterators/mb_from_wchar.hpp +++ b/3party/boost/boost/archive/iterators/mb_from_wchar.hpp @@ -115,7 +115,7 @@ public: // make composible buy using templated constructor template mb_from_wchar(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), m_bend(0), m_bnext(0), m_full(false) diff --git a/3party/boost/boost/archive/iterators/remove_whitespace.hpp b/3party/boost/boost/archive/iterators/remove_whitespace.hpp index c5e581d99f..2ccc373080 100644 --- a/3party/boost/boost/archive/iterators/remove_whitespace.hpp +++ b/3party/boost/boost/archive/iterators/remove_whitespace.hpp @@ -154,7 +154,7 @@ public: // make composible buy using templated constructor template remove_whitespace(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))) {} // intel 7.1 doesn't like default copy constructor remove_whitespace(const remove_whitespace & rhs) : diff --git a/3party/boost/boost/archive/iterators/transform_width.hpp b/3party/boost/boost/archive/iterators/transform_width.hpp index c2e9bee12e..7ffc06d130 100644 --- a/3party/boost/boost/archive/iterators/transform_width.hpp +++ b/3party/boost/boost/archive/iterators/transform_width.hpp @@ -113,7 +113,7 @@ public: // make composible buy using templated constructor template transform_width(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), m_displacement(0), m_full(false), m_bufferfull(false) diff --git a/3party/boost/boost/archive/iterators/wchar_from_mb.hpp b/3party/boost/boost/archive/iterators/wchar_from_mb.hpp index 18f06225f9..12e7d57e77 100644 --- a/3party/boost/boost/archive/iterators/wchar_from_mb.hpp +++ b/3party/boost/boost/archive/iterators/wchar_from_mb.hpp @@ -90,7 +90,7 @@ public: // make composible buy using templated constructor template wchar_from_mb(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))), + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), m_full(false) {} // intel 7.1 doesn't like default copy constructor diff --git a/3party/boost/boost/archive/iterators/xml_escape.hpp b/3party/boost/boost/archive/iterators/xml_escape.hpp index 8eb87f4246..fd40c020fd 100644 --- a/3party/boost/boost/archive/iterators/xml_escape.hpp +++ b/3party/boost/boost/archive/iterators/xml_escape.hpp @@ -44,7 +44,7 @@ public: template xml_escape(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))) {} // intel 7.1 doesn't like default copy constructor xml_escape(const xml_escape & rhs) : diff --git a/3party/boost/boost/archive/iterators/xml_unescape.hpp b/3party/boost/boost/archive/iterators/xml_unescape.hpp index 25b7edf460..375e7d29fa 100644 --- a/3party/boost/boost/archive/iterators/xml_unescape.hpp +++ b/3party/boost/boost/archive/iterators/xml_unescape.hpp @@ -57,7 +57,7 @@ public: template xml_unescape(BOOST_PFTO_WRAPPER(T) start) : - super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast(start)))) + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))) {} // intel 7.1 doesn't like default copy constructor xml_unescape(const xml_unescape & rhs) : diff --git a/3party/boost/boost/archive/polymorphic_iarchive.hpp b/3party/boost/boost/archive/polymorphic_iarchive.hpp index d90966afe3..2f76cf267a 100644 --- a/3party/boost/boost/archive/polymorphic_iarchive.hpp +++ b/3party/boost/boost/archive/polymorphic_iarchive.hpp @@ -114,7 +114,7 @@ public: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif - boost::serialization::nvp & t, + boost::serialization::nvp< T > & t, int ){ load_start(t.name()); diff --git a/3party/boost/boost/archive/polymorphic_oarchive.hpp b/3party/boost/boost/archive/polymorphic_oarchive.hpp index 3d4b4b6993..420029b5b6 100644 --- a/3party/boost/boost/archive/polymorphic_oarchive.hpp +++ b/3party/boost/boost/archive/polymorphic_oarchive.hpp @@ -116,7 +116,7 @@ public: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING const #endif - ::boost::serialization::nvp & t, int + ::boost::serialization::nvp< T > & t, int ){ save_start(t.name()); archive::save(* this->This(), t.const_value()); diff --git a/3party/boost/boost/archive/shared_ptr_helper.hpp b/3party/boost/boost/archive/shared_ptr_helper.hpp index a1e252aa2f..0e5f4f26bc 100644 --- a/3party/boost/boost/archive/shared_ptr_helper.hpp +++ b/3party/boost/boost/archive/shared_ptr_helper.hpp @@ -44,7 +44,7 @@ namespace boost { template inline void load( Archive & ar, - boost::shared_ptr &t, + boost::shared_ptr< T > &t, const unsigned int file_version ); } @@ -95,7 +95,7 @@ public: template friend inline void boost::serialization::load( Archive & ar, - boost::shared_ptr &t, + boost::shared_ptr< T > &t, const unsigned int file_version ); #endif @@ -130,7 +130,7 @@ public: get_object_identifier(T & t){ return & boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance(); } }; @@ -140,27 +140,27 @@ public: get_object_identifier(T & t){ return boost::serialization::singleton< BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type + boost::serialization::type_info_implementation< T >::type >::get_const_instance().get_derived_extended_type_info(t); } }; public: template - void reset(shared_ptr & s, T * t){ + void reset(shared_ptr< T > & s, T * t){ if(NULL == t){ s.reset(); return; } const boost::serialization::extended_type_info * this_type - = & boost::serialization::type_info_implementation::type + = & boost::serialization::type_info_implementation< T >::type ::get_const_instance(); // get pointer to the most derived object. This is effectively // the object identifern typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< - is_polymorphic, - mpl::identity >, - mpl::identity > + is_polymorphic< T >, + mpl::identity >, + mpl::identity > >::type type; const boost::serialization::extended_type_info * true_type @@ -192,7 +192,7 @@ public: append(sp); } else{ - s = shared_ptr( + s = shared_ptr< T >( r, static_cast(r.get()) ); diff --git a/3party/boost/boost/archive/xml_archive_exception.hpp b/3party/boost/boost/archive/xml_archive_exception.hpp index 741c468686..c8d65e0112 100644 --- a/3party/boost/boost/archive/xml_archive_exception.hpp +++ b/3party/boost/boost/archive/xml_archive_exception.hpp @@ -19,9 +19,10 @@ #include #include -#include +#include #include #include +#include #include // must be the last header @@ -32,7 +33,7 @@ namespace archive { // exceptions thrown by xml archives // class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) xml_archive_exception : - public virtual archive_exception + public virtual boost::archive::archive_exception { public: typedef enum { diff --git a/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp b/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp index 2cfd880f29..214cd41728 100644 --- a/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp +++ b/3party/boost/boost/asio/detail/buffer_sequence_adapter.hpp @@ -161,7 +161,7 @@ public: explicit buffer_sequence_adapter( const boost::asio::mutable_buffers_1& buffers) { - init_native_buffer(buffer_, buffers); + init_native_buffer(buffer_, Buffer(buffers)); total_buffer_size_ = boost::asio::buffer_size(buffers); } @@ -208,7 +208,7 @@ public: explicit buffer_sequence_adapter( const boost::asio::const_buffers_1& buffers) { - init_native_buffer(buffer_, buffers); + init_native_buffer(buffer_, Buffer(buffers)); total_buffer_size_ = boost::asio::buffer_size(buffers); } diff --git a/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp b/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp index 6a51a30530..7bb02690a6 100644 --- a/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp +++ b/3party/boost/boost/asio/detail/impl/kqueue_reactor.hpp @@ -55,7 +55,7 @@ void kqueue_reactor::schedule_timer(timer_queue& queue, bool earliest = queue.enqueue_timer(time, timer, op); io_service_.work_started(); if (earliest) - interrupter_.interrupt(); + interrupt(); } template diff --git a/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp b/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp index d5cf35f096..08209bd248 100644 --- a/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/3party/boost/boost/asio/detail/impl/kqueue_reactor.ipp @@ -26,6 +26,15 @@ #include +#if defined(__NetBSD__) +# define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ + EV_SET(ev, ident, filt, flags, fflags, \ + data, reinterpret_cast(udata)) +#else +# define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ + EV_SET(ev, ident, filt, flags, fflags, data, udata) +#endif + namespace boost { namespace asio { namespace detail { @@ -73,7 +82,7 @@ void kqueue_reactor::init_task() io_service_.init_task(); } -int kqueue_reactor::register_descriptor(socket_type descriptor, +int kqueue_reactor::register_descriptor(socket_type, kqueue_reactor::per_descriptor_data& descriptor_data) { mutex::scoped_lock lock(registered_descriptors_mutex_); @@ -129,17 +138,17 @@ void kqueue_reactor::start_op(int op_type, socket_type descriptor, switch (op_type) { case read_op: - EV_SET(&event, descriptor, EVFILT_READ, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, EV_ADD | EV_ONESHOT, 0, 0, descriptor_data); break; case write_op: - EV_SET(&event, descriptor, EVFILT_WRITE, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, descriptor_data); break; case except_op: if (!descriptor_data->op_queue_[read_op].empty()) return; // Already registered for read events. - EV_SET(&event, descriptor, EVFILT_READ, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, EV_ADD | EV_ONESHOT, EV_OOBAND, 0, descriptor_data); break; } @@ -178,7 +187,7 @@ void kqueue_reactor::cancel_ops(socket_type, io_service_.post_deferred_completions(ops); } -void kqueue_reactor::close_descriptor(socket_type descriptor, +void kqueue_reactor::close_descriptor(socket_type, kqueue_reactor::per_descriptor_data& descriptor_data) { if (!descriptor_data) @@ -234,7 +243,7 @@ void kqueue_reactor::run(bool block, op_queue& ops) for (int i = 0; i < num_events; ++i) { int descriptor = events[i].ident; - void* ptr = events[i].udata; + void* ptr = reinterpret_cast(events[i].udata); if (ptr == &interrupter_) { // No need to reset the interrupter since we're leaving the descriptor @@ -247,7 +256,11 @@ void kqueue_reactor::run(bool block, op_queue& ops) // Exception operations must be processed first to ensure that any // out-of-band data is read before normal data. +#if defined(__NetBSD__) + static const unsigned int filter[max_ops] = +#else static const int filter[max_ops] = +#endif { EVFILT_READ, EVFILT_WRITE, EVFILT_READ }; for (int j = max_ops - 1; j >= 0; --j) { @@ -282,16 +295,16 @@ void kqueue_reactor::run(bool block, op_queue& ops) { case EVFILT_READ: if (!descriptor_data->op_queue_[read_op].empty()) - EV_SET(&event, descriptor, EVFILT_READ, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, EV_ADD | EV_ONESHOT, 0, 0, descriptor_data); else if (!descriptor_data->op_queue_[except_op].empty()) - EV_SET(&event, descriptor, EVFILT_READ, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, EV_ADD | EV_ONESHOT, EV_OOBAND, 0, descriptor_data); else continue; case EVFILT_WRITE: if (!descriptor_data->op_queue_[write_op].empty()) - EV_SET(&event, descriptor, EVFILT_WRITE, + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, descriptor_data); else continue; @@ -322,7 +335,7 @@ void kqueue_reactor::run(bool block, op_queue& ops) void kqueue_reactor::interrupt() { struct kevent event; - EV_SET(&event, interrupter_.read_descriptor(), + BOOST_ASIO_KQUEUE_EV_SET(&event, interrupter_.read_descriptor(), EVFILT_READ, EV_ADD | EV_ONESHOT, 0, 0, &interrupter_); ::kevent(kqueue_fd_, &event, 1, 0, 0, 0); } @@ -365,6 +378,8 @@ timespec* kqueue_reactor::get_timeout(timespec& ts) } // namespace asio } // namespace boost +#undef BOOST_ASIO_KQUEUE_EV_SET + #include #endif // defined(BOOST_ASIO_HAS_KQUEUE) diff --git a/3party/boost/boost/asio/detail/impl/socket_ops.ipp b/3party/boost/boost/asio/detail/impl/socket_ops.ipp index 12b812a028..5ac052a457 100644 --- a/3party/boost/boost/asio/detail/impl/socket_ops.ipp +++ b/3party/boost/boost/asio/detail/impl/socket_ops.ipp @@ -119,7 +119,7 @@ socket_type sync_accept(socket_type s, state_type state, socket_type new_socket = socket_ops::accept(s, addr, addrlen, ec); // Check if operation succeeded. - if (new_socket >= 0) + if (new_socket != invalid_socket) return new_socket; // Operation failed. @@ -210,7 +210,7 @@ bool non_blocking_accept(socket_type s, new_socket = socket_ops::accept(s, addr, addrlen, ec); // Check if operation succeeded. - if (new_socket >= 0) + if (new_socket != invalid_socket) return true; // Retry operation if interrupted by signal. @@ -312,14 +312,14 @@ int close(socket_type s, state_type& state, clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - int result = error_wrapper(::closesocket(s), ec); + result = error_wrapper(::closesocket(s), ec); #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - int result = error_wrapper(::close(s), ec); + result = error_wrapper(::close(s), ec); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - if (result == 0) - ec = boost::system::error_code(); } + if (result == 0) + ec = boost::system::error_code(); return result; } @@ -1414,7 +1414,7 @@ int getsockname(socket_type s, socket_addr_type* addr, return result; } -int ioctl(socket_type s, state_type& state, long cmd, +int ioctl(socket_type s, state_type& state, int cmd, ioctl_arg_type* arg, boost::system::error_code& ec) { if (s == invalid_socket) @@ -1426,9 +1426,13 @@ int ioctl(socket_type s, state_type& state, long cmd, clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec); -#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#elif defined(__MACH__) && defined(__APPLE__) \ + || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + int result = error_wrapper(::ioctl(s, + static_cast(cmd), arg), ec); +#else int result = error_wrapper(::ioctl(s, cmd, arg), ec); -#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#endif if (result >= 0) { ec = boost::system::error_code(); @@ -1438,7 +1442,7 @@ int ioctl(socket_type s, state_type& state, long cmd, // the correct state. This ensures that the underlying socket is put into // the state that has been requested by the user. If the ioctl syscall was // successful then we need to update the flags to match. - if (cmd == static_cast(FIONBIO)) + if (cmd == static_cast(FIONBIO)) { if (*arg) { @@ -1483,7 +1487,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, timeout->tv_usec = 1000; #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) -#if defined(__hpux) && defined(__HP_aCC) +#if defined(__hpux) && defined(__SELECT) timespec ts; ts.tv_sec = timeout ? timeout->tv_sec : 0; ts.tv_nsec = timeout ? timeout->tv_usec * 1000 : 0; @@ -2669,6 +2673,7 @@ boost::system::error_code getaddrinfo(const char* host, addrinfo_type** result, boost::system::error_code& ec) { host = (host && *host) ? host : 0; + service = (service && *service) ? service : 0; clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) || defined(UNDER_CE) diff --git a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp index 0219ccdbc4..08b81e952c 100644 --- a/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/3party/boost/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -447,6 +447,12 @@ void win_iocp_io_service::do_add_timer_queue(timer_queue_base& queue) boost::asio::error::get_system_category()); boost::asio::detail::throw_error(ec, "timer"); } + + LARGE_INTEGER timeout; + timeout.QuadPart = -max_timeout_usec; + timeout.QuadPart *= 10; + ::SetWaitableTimer(waitable_timer_.handle, + &timeout, max_timeout_msec, 0, 0, FALSE); } if (!timer_thread_) diff --git a/3party/boost/boost/asio/detail/impl/win_mutex.ipp b/3party/boost/boost/asio/detail/impl/win_mutex.ipp index 3cceda13fa..65ffb3b7d6 100644 --- a/3party/boost/boost/asio/detail/impl/win_mutex.ipp +++ b/3party/boost/boost/asio/detail/impl/win_mutex.ipp @@ -45,7 +45,8 @@ int win_mutex::do_init() # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); # else - ::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000); + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + return ::GetLastError(); # endif return 0; #else @@ -54,7 +55,8 @@ int win_mutex::do_init() # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); # else - ::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000); + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + return ::GetLastError(); # endif } __except(GetExceptionCode() == STATUS_NO_MEMORY diff --git a/3party/boost/boost/asio/detail/null_thread.hpp b/3party/boost/boost/asio/detail/null_thread.hpp index 93fd715475..1745011c19 100644 --- a/3party/boost/boost/asio/detail/null_thread.hpp +++ b/3party/boost/boost/asio/detail/null_thread.hpp @@ -35,7 +35,7 @@ class null_thread public: // Constructor. template - null_thread(Function) + null_thread(Function, unsigned int = 0) { boost::asio::detail::throw_error( boost::asio::error::operation_not_supported, "thread"); diff --git a/3party/boost/boost/asio/detail/pop_options.hpp b/3party/boost/boost/asio/detail/pop_options.hpp index 8653f1a04c..d589cb72b8 100644 --- a/3party/boost/boost/asio/detail/pop_options.hpp +++ b/3party/boost/boost/asio/detail/pop_options.hpp @@ -31,6 +31,16 @@ # pragma pack (pop) # endif +# if defined(__OBJC__) +# if !defined(__APPLE_CC__) || (__APPLE_CC__ <= 1) +# if defined(BOOST_ASIO_OBJC_WORKAROUND) +# undef Protocol +# undef id +# undef BOOST_ASIO_OBJC_WORKAROUND +# endif +# endif +# endif + #elif defined(__KCC) // Kai C++ diff --git a/3party/boost/boost/asio/detail/push_options.hpp b/3party/boost/boost/asio/detail/push_options.hpp index 00a9b7eee3..587aef9734 100644 --- a/3party/boost/boost/asio/detail/push_options.hpp +++ b/3party/boost/boost/asio/detail/push_options.hpp @@ -31,6 +31,18 @@ # pragma pack (push, 8) # endif +# if defined(__OBJC__) +# if !defined(__APPLE_CC__) || (__APPLE_CC__ <= 1) +# if !defined(BOOST_ASIO_DISABLE_OBJC_WORKAROUND) +# if !defined(Protocol) && !defined(id) +# define Protocol cpp_Protocol +# define id cpp_id +# define BOOST_ASIO_OBJC_WORKAROUND +# endif +# endif +# endif +# endif + #elif defined(__KCC) // Kai C++ diff --git a/3party/boost/boost/asio/detail/reactive_socket_service.hpp b/3party/boost/boost/asio/detail/reactive_socket_service.hpp index 73aa0246e0..7288881d4a 100644 --- a/3party/boost/boost/asio/detail/reactive_socket_service.hpp +++ b/3party/boost/boost/asio/detail/reactive_socket_service.hpp @@ -326,7 +326,7 @@ public: peer_endpoint ? &addr_len : 0, ec)); // On success, assign new connection to peer socket object. - if (new_socket.get() >= 0) + if (new_socket.get() != invalid_socket) { if (peer_endpoint) peer_endpoint->resize(addr_len); diff --git a/3party/boost/boost/asio/detail/service_registry.hpp b/3party/boost/boost/asio/detail/service_registry.hpp index 9fd0c5afb7..6ba30f1e73 100644 --- a/3party/boost/boost/asio/detail/service_registry.hpp +++ b/3party/boost/boost/asio/detail/service_registry.hpp @@ -75,13 +75,14 @@ public: private: // Initialise a service's key based on its id. - BOOST_ASIO_DECL void init_key(boost::asio::io_service::service::key& key, + BOOST_ASIO_DECL static void init_key( + boost::asio::io_service::service::key& key, const boost::asio::io_service::id& id); #if !defined(BOOST_ASIO_NO_TYPEID) // Initialise a service's key based on its id. template - void init_key(boost::asio::io_service::service::key& key, + static void init_key(boost::asio::io_service::service::key& key, const boost::asio::detail::service_id& /*id*/); #endif // !defined(BOOST_ASIO_NO_TYPEID) diff --git a/3party/boost/boost/asio/detail/socket_ops.hpp b/3party/boost/boost/asio/detail/socket_ops.hpp index bbdba385ed..a32b4cc414 100644 --- a/3party/boost/boost/asio/detail/socket_ops.hpp +++ b/3party/boost/boost/asio/detail/socket_ops.hpp @@ -222,7 +222,7 @@ BOOST_ASIO_DECL int getsockname(socket_type s, socket_addr_type* addr, std::size_t* addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL int ioctl(socket_type s, state_type& state, - long cmd, ioctl_arg_type* arg, boost::system::error_code& ec); + int cmd, ioctl_arg_type* arg, boost::system::error_code& ec); BOOST_ASIO_DECL int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout, boost::system::error_code& ec); diff --git a/3party/boost/boost/asio/detail/socket_types.hpp b/3party/boost/boost/asio/detail/socket_types.hpp index 04540efe98..616e85ae95 100644 --- a/3party/boost/boost/asio/detail/socket_types.hpp +++ b/3party/boost/boost/asio/detail/socket_types.hpp @@ -52,9 +52,10 @@ # include # include # include -# if defined(__hpux) && !defined(__HP_aCC) +# if defined(__hpux) # include -# else +# endif +# if !defined(__hpux) || defined(__SELECT) # include # endif # include diff --git a/3party/boost/boost/asio/detail/timer_queue.hpp b/3party/boost/boost/asio/detail/timer_queue.hpp index 2bcb4989b4..09eb825689 100644 --- a/3party/boost/boost/asio/detail/timer_queue.hpp +++ b/3party/boost/boost/asio/detail/timer_queue.hpp @@ -79,36 +79,37 @@ public: // function call may need to be interrupted and restarted. bool enqueue_timer(const time_type& time, per_timer_data& timer, timer_op* op) { - // Ensure that there is space for the timer in the heap. We reserve here so - // that the push_back below will not throw due to a reallocation failure. - heap_.reserve(heap_.size() + 1); - - timer.op_queue_.push(op); + // Enqueue the timer object. if (timer.prev_ == 0 && &timer != timers_) { + if (this->is_positive_infinity(time)) + { + // No heap entry is required for timers that never expire. + timer.heap_index_ = (std::numeric_limits::max)(); + } + else + { + // Put the new timer at the correct position in the heap. This is done + // first since push_back() can throw due to allocation failure. + timer.heap_index_ = heap_.size(); + heap_entry entry = { time, &timer }; + heap_.push_back(entry); + up_heap(heap_.size() - 1); + } + // Insert the new timer into the linked list of active timers. timer.next_ = timers_; timer.prev_ = 0; if (timers_) timers_->prev_ = &timer; timers_ = &timer; - - // Put the new timer at the correct position in the heap. - if (this->is_positive_infinity(time)) - { - timer.heap_index_ = (std::numeric_limits::max)(); - return false; // No need to interrupt reactor as timer never expires. - } - else - { - timer.heap_index_ = heap_.size(); - heap_entry entry = { time, &timer }; - heap_.push_back(entry); - up_heap(heap_.size() - 1); - } } - return (heap_[0].timer_ == &timer); + // Enqueue the individual timer operation. + timer.op_queue_.push(op); + + // Interrupt reactor only if newly added timer is first to expire. + return timer.heap_index_ == 0 && timer.op_queue_.front() == op; } // Whether there are no timers in the queue. diff --git a/3party/boost/boost/asio/error.hpp b/3party/boost/boost/asio/error.hpp index 5663b69494..569ad80620 100644 --- a/3party/boost/boost/asio/error.hpp +++ b/3party/boost/boost/asio/error.hpp @@ -19,7 +19,7 @@ #include #include #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) -# include +# include #else # include # include @@ -217,7 +217,7 @@ enum ssl_errors inline const boost::system::error_category& get_system_category() { - return boost::system::get_system_category(); + return boost::system::system_category(); } #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) diff --git a/3party/boost/boost/asio/impl/read.hpp b/3party/boost/boost/asio/impl/read.hpp index 2100a747d9..6f9842c869 100644 --- a/3party/boost/boost/asio/impl/read.hpp +++ b/3party/boost/boost/asio/impl/read.hpp @@ -160,7 +160,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -212,7 +212,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -317,7 +317,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } diff --git a/3party/boost/boost/asio/impl/read_at.hpp b/3party/boost/boost/asio/impl/read_at.hpp index cc7bc8086b..f6ea0b3cf6 100644 --- a/3party/boost/boost/asio/impl/read_at.hpp +++ b/3party/boost/boost/asio/impl/read_at.hpp @@ -173,7 +173,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -226,7 +226,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -338,7 +338,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } diff --git a/3party/boost/boost/asio/impl/read_until.hpp b/3party/boost/boost/asio/impl/read_until.hpp index f3d8819e4e..73f8773559 100644 --- a/3party/boost/boost/asio/impl/read_until.hpp +++ b/3party/boost/boost/asio/impl/read_until.hpp @@ -392,8 +392,15 @@ namespace detail break; } - handler_(search_position_ == not_found ? error::not_found : ec, - ec || search_position_ == not_found ? 0 : search_position_); + const boost::system::error_code result_ec = + (search_position_ == not_found) + ? error::not_found : ec; + + const std::size_t result_n = + (ec || search_position_ == not_found) + ? 0 : search_position_; + + handler_(result_ec, result_n); } } @@ -529,8 +536,15 @@ namespace detail break; } - handler_(search_position_ == not_found ? error::not_found : ec, - ec || search_position_ == not_found ? 0 : search_position_); + const boost::system::error_code result_ec = + (search_position_ == not_found) + ? error::not_found : ec; + + const std::size_t result_n = + (ec || search_position_ == not_found) + ? 0 : search_position_; + + handler_(result_ec, result_n); } } @@ -671,8 +685,15 @@ namespace detail break; } - handler_(search_position_ == not_found ? error::not_found : ec, - ec || search_position_ == not_found ? 0 : search_position_); + const boost::system::error_code result_ec = + (search_position_ == not_found) + ? error::not_found : ec; + + const std::size_t result_n = + (ec || search_position_ == not_found) + ? 0 : search_position_; + + handler_(result_ec, result_n); } } @@ -811,8 +832,15 @@ namespace detail break; } - handler_(search_position_ == not_found ? error::not_found : ec, - ec || search_position_ == not_found ? 0 : search_position_); + const boost::system::error_code result_ec = + (search_position_ == not_found) + ? error::not_found : ec; + + const std::size_t result_n = + (ec || search_position_ == not_found) + ? 0 : search_position_; + + handler_(result_ec, result_n); } } diff --git a/3party/boost/boost/asio/impl/serial_port_base.ipp b/3party/boost/boost/asio/impl/serial_port_base.ipp index 1eb96b0231..2bfe58a1a4 100644 --- a/3party/boost/boost/asio/impl/serial_port_base.ipp +++ b/3party/boost/boost/asio/impl/serial_port_base.ipp @@ -253,12 +253,16 @@ boost::system::error_code serial_port_base::flow_control::store( storage.c_iflag &= ~(IXOFF | IXON); # if defined(_BSD_SOURCE) storage.c_cflag &= ~CRTSCTS; +# elif defined(__QNXNTO__) + storage.c_cflag &= ~(IHFLOW | OHFLOW); # endif break; case software: storage.c_iflag |= IXOFF | IXON; # if defined(_BSD_SOURCE) storage.c_cflag &= ~CRTSCTS; +# elif defined(__QNXNTO__) + storage.c_cflag &= ~(IHFLOW | OHFLOW); # endif break; case hardware: @@ -266,6 +270,10 @@ boost::system::error_code serial_port_base::flow_control::store( storage.c_iflag &= ~(IXOFF | IXON); storage.c_cflag |= CRTSCTS; break; +# elif defined(__QNXNTO__) + storage.c_iflag &= ~(IXOFF | IXON); + storage.c_cflag |= (IHFLOW | OHFLOW); + break; # else ec = boost::asio::error::operation_not_supported; return ec; @@ -304,6 +312,11 @@ boost::system::error_code serial_port_base::flow_control::load( { value_ = hardware; } +# elif defined(__QNXNTO__) + else if (storage.c_cflag & IHFLOW && storage.c_cflag & OHFLOW) + { + value_ = hardware; + } # endif else { diff --git a/3party/boost/boost/asio/impl/src.cpp b/3party/boost/boost/asio/impl/src.cpp index 59a10c95dc..fa418563c7 100644 --- a/3party/boost/boost/asio/impl/src.cpp +++ b/3party/boost/boost/asio/impl/src.cpp @@ -8,52 +8,18 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#define BOOST_ASIO_SOURCE - -#include - -#if defined(BOOST_ASIO_HEADER_ONLY) -# error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined +#if defined(_MSC_VER) \ + || defined(__BORLANDC__) \ + || defined(__DMC__) +# pragma message ( \ + "This file is deprecated. " \ + "Please #include instead.>) +#elif defined(__GNUC__) \ + || defined(__HP_aCC) \ + || defined(__SUNPRO_CC) \ + || defined(__IBMCPP__) +# warning "This file is deprecated." +# warning "Please #include instead.> #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include diff --git a/3party/boost/boost/asio/impl/src.hpp b/3party/boost/boost/asio/impl/src.hpp new file mode 100644 index 0000000000..60f92d5a48 --- /dev/null +++ b/3party/boost/boost/asio/impl/src.hpp @@ -0,0 +1,64 @@ +// +// impl/src.hpp +// ~~~~~~~~~~~~ +// +// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_ASIO_IMPL_SRC_HPP +#define BOOST_ASIO_IMPL_SRC_HPP + +#define BOOST_ASIO_SOURCE + +#include + +#if defined(BOOST_ASIO_HEADER_ONLY) +# error Do not compile Asio library source with BOOST_ASIO_HEADER_ONLY defined +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_ASIO_IMPL_SRC_HPP diff --git a/3party/boost/boost/asio/impl/write.hpp b/3party/boost/boost/asio/impl/write.hpp index c7adc428ba..fa2982a1ff 100644 --- a/3party/boost/boost/asio/impl/write.hpp +++ b/3party/boost/boost/asio/impl/write.hpp @@ -146,7 +146,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -198,7 +198,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -249,7 +249,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } diff --git a/3party/boost/boost/asio/impl/write_at.hpp b/3party/boost/boost/asio/impl/write_at.hpp index 90f9bc1b5d..aad64efd96 100644 --- a/3party/boost/boost/asio/impl/write_at.hpp +++ b/3party/boost/boost/asio/impl/write_at.hpp @@ -157,7 +157,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -211,7 +211,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } @@ -264,7 +264,7 @@ namespace detail break; } - handler_(ec, static_cast(total_transferred_)); + handler_(ec, static_cast(total_transferred_)); } } diff --git a/3party/boost/boost/asio/version.hpp b/3party/boost/boost/asio/version.hpp index 468d6a4491..20858bf2ff 100644 --- a/3party/boost/boost/asio/version.hpp +++ b/3party/boost/boost/asio/version.hpp @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 100406 // 1.4.6 +#define BOOST_ASIO_VERSION 100407 // 1.4.7 #endif // BOOST_ASIO_VERSION_HPP diff --git a/3party/boost/boost/concept_check.hpp b/3party/boost/boost/concept_check.hpp index 7ee3036855..58bd8b2b9c 100644 --- a/3party/boost/boost/concept_check.hpp +++ b/3party/boost/boost/concept_check.hpp @@ -1,5 +1,7 @@ // // (C) Copyright Jeremy Siek 2000. +// Copyright 2002 The Trustees of Indiana University. +// // 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) @@ -999,6 +1001,42 @@ namespace boost // HashedAssociativeContainer + BOOST_concept(Collection,(C)) + { + BOOST_CONCEPT_USAGE(Collection) + { + boost::function_requires >(); + boost::function_requires >(); + boost::function_requires >(); + const_constraints(c); + i = c.begin(); + i = c.end(); + c.swap(c); + } + + void const_constraints(const C& c) { + ci = c.begin(); + ci = c.end(); + n = c.size(); + b = c.empty(); + } + + private: + typedef typename C::value_type value_type; + typedef typename C::iterator iterator; + typedef typename C::const_iterator const_iterator; + typedef typename C::reference reference; + typedef typename C::const_reference const_reference; + // typedef typename C::pointer pointer; + typedef typename C::difference_type difference_type; + typedef typename C::size_type size_type; + + C c; + bool b; + iterator i; + const_iterator ci; + size_type n; + }; } // namespace boost # include diff --git a/3party/boost/boost/config/auto_link.hpp b/3party/boost/boost/config/auto_link.hpp index 0d17eb8fea..e562caff7c 100644 --- a/3party/boost/boost/config/auto_link.hpp +++ b/3party/boost/boost/config/auto_link.hpp @@ -362,7 +362,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. && defined(BOOST_LIB_VERSION) #ifdef BOOST_AUTO_LINK_TAGGED -# pragma commentcomment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") +# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # endif diff --git a/3party/boost/boost/config/compiler/borland.hpp b/3party/boost/boost/config/compiler/borland.hpp index bd3a8c3f3f..a989fd633b 100644 --- a/3party/boost/boost/config/compiler/borland.hpp +++ b/3party/boost/boost/config/compiler/borland.hpp @@ -46,6 +46,8 @@ // Borland C++Builder 5, command-line compiler 5.5: # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif +// Variadic macros do not exist for C++ Builder versions 5 and below +#define BOOST_NO_VARIADIC_MACROS # endif // Version 5.51 and below: diff --git a/3party/boost/boost/config/compiler/clang.hpp b/3party/boost/boost/config/compiler/clang.hpp index 85f4484d69..2ce6773266 100644 --- a/3party/boost/boost/config/compiler/clang.hpp +++ b/3party/boost/boost/config/compiler/clang.hpp @@ -48,6 +48,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS // HACK: Clang does support extern templates, but Boost's test for // them is wrong. diff --git a/3party/boost/boost/config/compiler/common_edg.hpp b/3party/boost/boost/config/compiler/common_edg.hpp index cb283376e1..682c73af4a 100644 --- a/3party/boost/boost/config/compiler/common_edg.hpp +++ b/3party/boost/boost/config/compiler/common_edg.hpp @@ -88,12 +88,10 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support // #define BOOST_HAS_LONG_LONG #endif - - - diff --git a/3party/boost/boost/config/compiler/digitalmars.hpp b/3party/boost/boost/config/compiler/digitalmars.hpp index bd37d2f1c2..31c11bf0ce 100644 --- a/3party/boost/boost/config/compiler/digitalmars.hpp +++ b/3party/boost/boost/config/compiler/digitalmars.hpp @@ -80,6 +80,9 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#if (__DMC__ < 0x812) +#define BOOST_NO_VARIADIC_MACROS +#endif #if __DMC__ < 0x800 #error "Compiler not supported or configured - please reconfigure" diff --git a/3party/boost/boost/config/compiler/gcc.hpp b/3party/boost/boost/config/compiler/gcc.hpp index 54f1bb9882..eeaf998202 100644 --- a/3party/boost/boost/config/compiler/gcc.hpp +++ b/3party/boost/boost/config/compiler/gcc.hpp @@ -43,6 +43,8 @@ # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_EXTERN_TEMPLATE +// Variadic macros do not exist for gcc versions before 3.0 +# define BOOST_NO_VARIADIC_MACROS #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -113,7 +115,7 @@ // Dynamic shared object (DSO) and dynamic-link library (DLL) support // #if __GNUC__ >= 4 -# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__) // All Win32 development environments, including 64-bit Windows and MinGW, define // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment, // so does not define _WIN32 or its variants. diff --git a/3party/boost/boost/config/compiler/gcc_xml.hpp b/3party/boost/boost/config/compiler/gcc_xml.hpp index 7f884b19ce..a456463ce7 100644 --- a/3party/boost/boost/config/compiler/gcc_xml.hpp +++ b/3party/boost/boost/config/compiler/gcc_xml.hpp @@ -35,6 +35,7 @@ # define BOOST_NO_RVALUE_REFERENCES # define BOOST_NO_STATIC_ASSERT # define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_VARIADIC_MACROS # define BOOST_NO_AUTO_DECLARATIONS # define BOOST_NO_AUTO_MULTIDECLARATIONS # define BOOST_NO_CHAR16_T diff --git a/3party/boost/boost/config/compiler/hp_acc.hpp b/3party/boost/boost/config/compiler/hp_acc.hpp index 98e7772af2..d0b672ecae 100644 --- a/3party/boost/boost/config/compiler/hp_acc.hpp +++ b/3party/boost/boost/config/compiler/hp_acc.hpp @@ -115,6 +115,16 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES + +/* + See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and + https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443436 +*/ + +#if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE) + #define BOOST_NO_VARIADIC_MACROS +#endif + #endif // diff --git a/3party/boost/boost/config/compiler/metrowerks.hpp b/3party/boost/boost/config/compiler/metrowerks.hpp index 3bc9d97555..21083b7a1f 100644 --- a/3party/boost/boost/config/compiler/metrowerks.hpp +++ b/3party/boost/boost/config/compiler/metrowerks.hpp @@ -114,6 +114,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/3party/boost/boost/config/compiler/mpw.hpp b/3party/boost/boost/config/compiler/mpw.hpp index 4db14ddef3..ae12f801d5 100644 --- a/3party/boost/boost/config/compiler/mpw.hpp +++ b/3party/boost/boost/config/compiler/mpw.hpp @@ -63,6 +63,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS // // versions check: diff --git a/3party/boost/boost/config/compiler/nvcc.hpp b/3party/boost/boost/config/compiler/nvcc.hpp index e31c3e2855..eaecf37498 100644 --- a/3party/boost/boost/config/compiler/nvcc.hpp +++ b/3party/boost/boost/config/compiler/nvcc.hpp @@ -37,6 +37,7 @@ #define BOOST_HAS_DIRENT_H #define BOOST_HAS_CLOCK_GETTIME #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_STD_UNORDERED diff --git a/3party/boost/boost/config/compiler/pgi.hpp b/3party/boost/boost/config/compiler/pgi.hpp index 1c7c84b70c..fb3a6c0b27 100644 --- a/3party/boost/boost/config/compiler/pgi.hpp +++ b/3party/boost/boost/config/compiler/pgi.hpp @@ -70,6 +70,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS // // version check: diff --git a/3party/boost/boost/config/compiler/sunpro_cc.hpp b/3party/boost/boost/config/compiler/sunpro_cc.hpp index aca49fa04a..85fa462504 100644 --- a/3party/boost/boost/config/compiler/sunpro_cc.hpp +++ b/3party/boost/boost/config/compiler/sunpro_cc.hpp @@ -122,6 +122,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS // // Version diff --git a/3party/boost/boost/config/compiler/vacpp.hpp b/3party/boost/boost/config/compiler/vacpp.hpp index e5b6971145..5ae9c2856d 100644 --- a/3party/boost/boost/config/compiler/vacpp.hpp +++ b/3party/boost/boost/config/compiler/vacpp.hpp @@ -91,6 +91,7 @@ #define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_VARIADIC_MACROS diff --git a/3party/boost/boost/config/compiler/visualc.hpp b/3party/boost/boost/config/compiler/visualc.hpp index a862570f59..6755287da4 100644 --- a/3party/boost/boost/config/compiler/visualc.hpp +++ b/3party/boost/boost/config/compiler/visualc.hpp @@ -81,6 +81,8 @@ # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: # define BOOST_NO_EXTERN_TEMPLATE +// Variadic macros do not exist for VC7.1 and lower +# define BOOST_NO_VARIADIC_MACROS #endif #if defined(UNDER_CE) diff --git a/3party/boost/boost/config/platform/bsd.hpp b/3party/boost/boost/config/platform/bsd.hpp index f02b0e2630..a0142978eb 100644 --- a/3party/boost/boost/config/platform/bsd.hpp +++ b/3party/boost/boost/config/platform/bsd.hpp @@ -56,7 +56,7 @@ #endif #if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ - || (__NetBSD_GCC__ >= 2095003) || defined(__DragonFly__)) + || (defined(__NetBSD_GCC__) && (__NetBSD_GCC__ >= 2095003)) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // diff --git a/3party/boost/boost/config/platform/cygwin.hpp b/3party/boost/boost/config/platform/cygwin.hpp index 5627dd60fb..8e1bcb0139 100644 --- a/3party/boost/boost/config/platform/cygwin.hpp +++ b/3party/boost/boost/config/platform/cygwin.hpp @@ -41,6 +41,13 @@ // boilerplate code: #include + +// +// Cygwin lies about XSI conformance, there is no nl_types.h: +// +#ifdef BOOST_HAS_NL_TYPES_H +# undef BOOST_HAS_NL_TYPES_H +#endif diff --git a/3party/boost/boost/config/platform/vms.hpp b/3party/boost/boost/config/platform/vms.hpp new file mode 100644 index 0000000000..f70efcfb8e --- /dev/null +++ b/3party/boost/boost/config/platform/vms.hpp @@ -0,0 +1,25 @@ +// (C) Copyright Artyom Beilis 2010. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_CONFIG_PLATFORM_VMS_HPP +#define BOOST_CONFIG_PLATFORM_VMS_HPP + +#define BOOST_PLATFORM "OpenVMS" + +#undef BOOST_HAS_STDINT_H +#define BOOST_HAS_UNISTD_H +#define BOOST_HAS_NL_TYPES_H +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_DIRENT_H +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_NANOSLEEP +#define BOOST_HAS_CLOCK_GETTIME +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +#define BOOST_HAS_LOG1P +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_THREADS +#undef BOOST_HAS_SCHED_YIELD + +#endif diff --git a/3party/boost/boost/config/select_platform_config.hpp b/3party/boost/boost/config/select_platform_config.hpp index 8606e12edf..bc1ffaf69f 100644 --- a/3party/boost/boost/config/select_platform_config.hpp +++ b/3party/boost/boost/config/select_platform_config.hpp @@ -69,6 +69,9 @@ // Symbian: # define BOOST_PLATFORM_CONFIG "boost/config/platform/symbian.hpp" +#elif defined(__VMS) +// VMS: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/vms.hpp" #else # if defined(unix) \ diff --git a/3party/boost/boost/config/stdlib/dinkumware.hpp b/3party/boost/boost/config/stdlib/dinkumware.hpp index ea8faf14d0..e33fef12ea 100644 --- a/3party/boost/boost/config/stdlib/dinkumware.hpp +++ b/3party/boost/boost/config/stdlib/dinkumware.hpp @@ -125,6 +125,7 @@ # define BOOST_NO_0X_HDR_MUTEX # define BOOST_NO_0X_HDR_RATIO # define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/3party/boost/boost/config/stdlib/libcomo.hpp b/3party/boost/boost/config/stdlib/libcomo.hpp index 97a39f3ed8..16a842ae2e 100644 --- a/3party/boost/boost/config/stdlib/libcomo.hpp +++ b/3party/boost/boost/config/stdlib/libcomo.hpp @@ -58,6 +58,7 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST // // Intrinsic type_traits support. diff --git a/3party/boost/boost/config/stdlib/libstdcpp3.hpp b/3party/boost/boost/config/stdlib/libstdcpp3.hpp index 815d605cc3..01dd490751 100644 --- a/3party/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/3party/boost/boost/config/stdlib/libstdcpp3.hpp @@ -115,6 +115,12 @@ # define BOOST_NO_0X_HDR_THREAD #endif +// C++0x features in GCC 4.5.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_NUMERIC_LIMITS_LOWEST +#endif + // C++0x headers not yet implemented // # define BOOST_NO_0X_HDR_CODECVT diff --git a/3party/boost/boost/config/stdlib/modena.hpp b/3party/boost/boost/config/stdlib/modena.hpp index 10792cdac2..147060d9f7 100644 --- a/3party/boost/boost/config/stdlib/modena.hpp +++ b/3party/boost/boost/config/stdlib/modena.hpp @@ -47,6 +47,7 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #define BOOST_STDLIB "Modena C++ standard library" diff --git a/3party/boost/boost/config/stdlib/msl.hpp b/3party/boost/boost/config/stdlib/msl.hpp index beb15de685..8185e351ea 100644 --- a/3party/boost/boost/config/stdlib/msl.hpp +++ b/3party/boost/boost/config/stdlib/msl.hpp @@ -71,6 +71,7 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/3party/boost/boost/config/stdlib/roguewave.hpp b/3party/boost/boost/config/stdlib/roguewave.hpp index 830c32ef61..dcd0af84d0 100644 --- a/3party/boost/boost/config/stdlib/roguewave.hpp +++ b/3party/boost/boost/config/stdlib/roguewave.hpp @@ -177,4 +177,5 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST diff --git a/3party/boost/boost/config/stdlib/sgi.hpp b/3party/boost/boost/config/stdlib/sgi.hpp index 293886bcb4..4d4264731c 100644 --- a/3party/boost/boost/config/stdlib/sgi.hpp +++ b/3party/boost/boost/config/stdlib/sgi.hpp @@ -130,6 +130,7 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #define BOOST_STDLIB "SGI standard library" diff --git a/3party/boost/boost/config/stdlib/stlport.hpp b/3party/boost/boost/config/stdlib/stlport.hpp index bb6fe134c7..0e1c9b2bc2 100644 --- a/3party/boost/boost/config/stdlib/stlport.hpp +++ b/3party/boost/boost/config/stdlib/stlport.hpp @@ -225,6 +225,7 @@ namespace boost { using std::min; using std::max; } # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/3party/boost/boost/config/stdlib/vacpp.hpp b/3party/boost/boost/config/stdlib/vacpp.hpp index 3504971fb4..0fc092f0ee 100644 --- a/3party/boost/boost/config/stdlib/vacpp.hpp +++ b/3party/boost/boost/config/stdlib/vacpp.hpp @@ -37,6 +37,7 @@ # define BOOST_NO_STD_UNORDERED // deprecated; see following # define BOOST_NO_0X_HDR_UNORDERED_MAP # define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_NUMERIC_LIMITS_LOWEST #define BOOST_STDLIB "Visual Age default standard library" diff --git a/3party/boost/boost/config/suffix.hpp b/3party/boost/boost/config/suffix.hpp index 3408d22588..722758f951 100644 --- a/3party/boost/boost/config/suffix.hpp +++ b/3party/boost/boost/config/suffix.hpp @@ -25,6 +25,14 @@ #ifndef BOOST_CONFIG_SUFFIX_HPP #define BOOST_CONFIG_SUFFIX_HPP +#if defined(__GNUC__) && (__GNUC__ >= 4) +// +// Some GCC-4.x versions issue warnings even when __extension__ is used, +// so use this as a workaround: +// +#pragma GCC system_header +#endif + // // ensure that visibility macros are always defined, thus symplifying use // diff --git a/3party/boost/boost/cstdint.hpp b/3party/boost/boost/cstdint.hpp index ee55e6983a..ea84b65062 100644 --- a/3party/boost/boost/cstdint.hpp +++ b/3party/boost/boost/cstdint.hpp @@ -137,7 +137,7 @@ namespace boost } // namespace boost -#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) +#elif defined(__FreeBSD__) && (__FreeBSD__ <= 4) || defined(__osf__) || defined(__VMS) // FreeBSD and Tru64 have an that contains much of what we need. # include @@ -256,20 +256,27 @@ namespace boost // 32-bit types -----------------------------------------------------------// -# if ULONG_MAX == 0xffffffff - typedef long int32_t; - typedef long int_least32_t; - typedef long int_fast32_t; - typedef unsigned long uint32_t; - typedef unsigned long uint_least32_t; - typedef unsigned long uint_fast32_t; -# elif UINT_MAX == 0xffffffff +# if UINT_MAX == 0xffffffff typedef int int32_t; typedef int int_least32_t; typedef int int_fast32_t; typedef unsigned int uint32_t; typedef unsigned int uint_least32_t; typedef unsigned int uint_fast32_t; +# elif (USHRT_MAX == 0xffffffff) + typedef short int32_t; + typedef short int_least32_t; + typedef short int_fast32_t; + typedef unsigned short uint32_t; + typedef unsigned short uint_least32_t; + typedef unsigned short uint_fast32_t; +# elif ULONG_MAX == 0xffffffff + typedef long int32_t; + typedef long int_least32_t; + typedef long int_fast32_t; + typedef unsigned long uint32_t; + typedef unsigned long uint_least32_t; + typedef unsigned long uint_fast32_t; # elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__) // Integers are 64 bits on the MTA / XMT typedef __int32 int32_t; diff --git a/3party/boost/boost/date_time/gregorian/greg_serialize.hpp b/3party/boost/boost/date_time/gregorian/greg_serialize.hpp index c48cc0ae37..e427a48a20 100644 --- a/3party/boost/boost/date_time/gregorian/greg_serialize.hpp +++ b/3party/boost/boost/date_time/gregorian/greg_serialize.hpp @@ -6,12 +6,13 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2010-11-11 15:19:38 -0500 (Thu, 11 Nov 2010) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" #include "boost/date_time/gregorian/parsers.hpp" #include "boost/serialization/split_free.hpp" +#include "boost/serialization/nvp.hpp" // macros to split serialize functions into save & load functions diff --git a/3party/boost/boost/date_time/posix_time/time_serialize.hpp b/3party/boost/boost/date_time/posix_time/time_serialize.hpp index 33894ad3ae..039763e08e 100644 --- a/3party/boost/boost/date_time/posix_time/time_serialize.hpp +++ b/3party/boost/boost/date_time/posix_time/time_serialize.hpp @@ -6,12 +6,13 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-09 13:41:14 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2010-11-11 15:19:38 -0500 (Thu, 11 Nov 2010) $ */ #include "boost/date_time/posix_time/posix_time.hpp" #include "boost/date_time/gregorian/greg_serialize.hpp" #include "boost/serialization/split_free.hpp" +#include "boost/serialization/nvp.hpp" // macros to split serialize functions into save & load functions diff --git a/3party/boost/boost/detail/is_incrementable.hpp b/3party/boost/boost/detail/is_incrementable.hpp index 1c8fd5785b..e7ef9dc625 100644 --- a/3party/boost/boost/detail/is_incrementable.hpp +++ b/3party/boost/boost/detail/is_incrementable.hpp @@ -70,10 +70,10 @@ namespace is_incrementable_ # endif // two check overloads help us identify which operator++ was picked - char (& check(tag) )[2]; + char (& check_(tag) )[2]; template - char check(T const&); + char check_(T const&); template @@ -83,7 +83,7 @@ namespace is_incrementable_ BOOST_STATIC_CONSTANT( bool - , value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1 + , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1 ); }; @@ -94,7 +94,7 @@ namespace is_incrementable_ BOOST_STATIC_CONSTANT( bool - , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 + , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1 ); }; diff --git a/3party/boost/boost/detail/sp_typeinfo.hpp b/3party/boost/boost/detail/sp_typeinfo.hpp index 3ee934f6a5..43fae78ef1 100644 --- a/3party/boost/boost/detail/sp_typeinfo.hpp +++ b/3party/boost/boost/detail/sp_typeinfo.hpp @@ -74,7 +74,13 @@ template struct sp_typeid_ } }; +#if defined(__SUNPRO_CC) +// see #4199, the Sun Studio compiler gets confused about static initialization +// constructor arguments. But an assignment works just fine. template sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name(); +#else +template sp_typeinfo sp_typeid_< T >::ti_(sp_typeid_< T >::name()); +#endif template struct sp_typeid_< T & >: sp_typeid_< T > { diff --git a/3party/boost/boost/filesystem/v2/operations.hpp b/3party/boost/boost/filesystem/v2/operations.hpp index 9bd35cded5..c60046f09e 100644 --- a/3party/boost/boost/filesystem/v2/operations.hpp +++ b/3party/boost/boost/filesystem/v2/operations.hpp @@ -1188,7 +1188,9 @@ namespace boost using filesystem2::copy_file; using filesystem2::copy_option; using filesystem2::create_directory; +# if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) using filesystem2::create_hard_link; +# endif using filesystem2::create_symlink; using filesystem2::current_path; using filesystem2::directory_entry; diff --git a/3party/boost/boost/filesystem/v2/path.hpp b/3party/boost/boost/filesystem/v2/path.hpp index d159c37513..16d67ca7da 100644 --- a/3party/boost/boost/filesystem/v2/path.hpp +++ b/3party/boost/boost/filesystem/v2/path.hpp @@ -1532,6 +1532,11 @@ namespace boost { using filesystem2::basic_path; using filesystem2::path_traits; + + using filesystem2::slash; + using filesystem2::dot; + using filesystem2::colon; + using filesystem2::path; # ifndef BOOST_FILESYSTEM2_NARROW_ONLY using filesystem2::wpath_traits; diff --git a/3party/boost/boost/filesystem/v3/operations.hpp b/3party/boost/boost/filesystem/v3/operations.hpp index be9de4dbeb..cf47c56609 100644 --- a/3party/boost/boost/filesystem/v3/operations.hpp +++ b/3party/boost/boost/filesystem/v3/operations.hpp @@ -68,14 +68,17 @@ namespace boost file_not_found, regular_file, directory_file, - // the following will never be reported by some operating or file systems + // the following may not apply to some operating systems 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 or - // we don't have strong enough permission to find its type + reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink + type_unknown, // file does exist, but isn't one of the above types or + // we don't have strong enough permission to find its type + + _detail_directory_symlink // internal use only; never exposed to users }; class BOOST_FILESYSTEM_DECL file_status @@ -145,7 +148,7 @@ namespace boost BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925 system::error_code* ec=0); BOOST_FILESYSTEM_DECL - void copy_symlink(const path& from, const path& to, system::error_code* ec=0); + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); BOOST_FILESYSTEM_DECL bool create_directories(const path& p, system::error_code* ec=0); BOOST_FILESYSTEM_DECL @@ -304,11 +307,11 @@ namespace boost void copy_file(const path& from, const path& to, system::error_code& ec) {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);} inline - void copy_symlink(const path& from, const path& to) {detail::copy_symlink(from, to);} + void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} inline - void copy_symlink(const path& from, const path& to, system::error_code& ec) - {detail::copy_symlink(from, to, &ec);} + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec) + {detail::copy_symlink(existing_symlink, new_symlink, &ec);} inline bool create_directories(const path& p) {return detail::create_directories(p);} @@ -938,6 +941,7 @@ namespace boost using filesystem3::absolute; using filesystem3::block_file; using filesystem3::character_file; +// using filesystem3::copy; using filesystem3::copy_file; using filesystem3::copy_option; using filesystem3::copy_symlink; @@ -945,6 +949,7 @@ namespace boost using filesystem3::create_directory; using filesystem3::create_hard_link; using filesystem3::create_symlink; + using filesystem3::create_directory_symlink; using filesystem3::current_path; using filesystem3::directory_entry; using filesystem3::directory_file; diff --git a/3party/boost/boost/filesystem/v3/path.hpp b/3party/boost/boost/filesystem/v3/path.hpp index 0caa19f27c..1cd1522656 100644 --- a/3party/boost/boost/filesystem/v3/path.hpp +++ b/3party/boost/boost/filesystem/v3/path.hpp @@ -22,7 +22,7 @@ # endif #include -#include +#include // includes #include #include #include @@ -127,7 +127,9 @@ namespace filesystem3 path(const path& p) : m_pathname(p.m_pathname) {} template - path(Source const& source) + path(Source const& source, + typename boost::enable_if::type> >::type* =0) { path_traits::dispatch(source, m_pathname, codecvt()); } @@ -170,7 +172,9 @@ namespace filesystem3 } template - path& operator=(Source const& source) + typename boost::enable_if::type>, path&>::type + operator=(Source const& source) { m_pathname.clear(); path_traits::dispatch(source, m_pathname, codecvt()); @@ -212,7 +216,9 @@ namespace filesystem3 path& operator/=(const path& p); template - path& operator/=(Source const& source) + typename boost::enable_if::type>, path&>::type + operator/=(Source const& source) { return append(source, codecvt()); } diff --git a/3party/boost/boost/filesystem/v3/path_traits.hpp b/3party/boost/boost/filesystem/v3/path_traits.hpp index 30723e35bd..71e80e2632 100644 --- a/3party/boost/boost/filesystem/v3/path_traits.hpp +++ b/3party/boost/boost/filesystem/v3/path_traits.hpp @@ -19,9 +19,12 @@ #include #include #include +#include #include +#include // for mbstate_t #include #include +#include #include #include #include @@ -48,6 +51,23 @@ namespace path_traits { typedef std::codecvt codecvt_type; + // is_pathable type trait; allows disabling over-agressive class path member templates + + template + struct is_pathable { static const bool value = false; }; + + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + template<> struct is_pathable > { static const bool value = true; }; + template<> struct is_pathable > { static const bool value = true; }; + template<> struct is_pathable > { static const bool value = true; }; + template<> struct is_pathable > { static const bool value = true; }; + template<> struct is_pathable { static const bool value = true; }; + // Pathable empty template inline @@ -195,13 +215,8 @@ namespace path_traits { convert(c_str, to, cvt); } - // C-style array - template inline - void dispatch(T (&array)[N], U& to, const codecvt_type& cvt) // T, N, U deduced - { -// std::cout << "dispatch() array, N=" << N << "\n"; - convert(array, array + N - 1, to, cvt); - } + // Note: there is no dispatch on C-style arrays because the array may + // contain a string smaller than the array size. BOOST_FILESYSTEM_DECL void dispatch(const directory_entry & de, diff --git a/3party/boost/boost/flyweight/detail/process_id.hpp b/3party/boost/boost/flyweight/detail/process_id.hpp deleted file mode 100644 index b52ce35c7c..0000000000 --- a/3party/boost/boost/flyweight/detail/process_id.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2006-2008 Joaquin M Lopez Munoz. - * 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/flyweight for library home page. - */ - -#ifndef BOOST_FLYWEIGHT_DETAIL_PROCESS_ID_HPP -#define BOOST_FLYWEIGHT_DETAIL_PROCESS_ID_HPP - -#if defined(_MSC_VER)&&(_MSC_VER>=1200) -#pragma once -#endif - -#include - -#if defined(BOOST_WINDOWS)&&!defined(BOOST_DISABLE_WIN32) - -#if defined(BOOST_USE_WINDOWS_H) -#include -#else -namespace boost{ -namespace flyweights{ -namespace detail{ - -extern "C" __declspec(dllimport) -unsigned long __stdcall GetCurrentProcessId(void); - -} /* namespace flyweights::detail */ -} /* namespace flyweights */ -} /* namespace boost */ -#endif - -namespace boost{ - -namespace flyweights{ - -namespace detail{ - -typedef unsigned long process_id_t; - -inline process_id_t process_id() -{ - return GetCurrentProcessId(); -} - -} /* namespace flyweights::detail */ - -} /* namespace flyweights */ - -} /* namespace boost */ - -#elif defined(BOOST_HAS_UNISTD_H) - -#include - -namespace boost{ - -namespace flyweights{ - -namespace detail{ - -typedef pid_t process_id_t; - -inline process_id_t process_id() -{ - return ::getpid(); -} - -} /* namespace flyweights::detail */ - -} /* namespace flyweights */ - -} /* namespace boost */ - -#else -#error Unknown platform -#endif - -#endif diff --git a/3party/boost/boost/flyweight/intermodule_holder.hpp b/3party/boost/boost/flyweight/intermodule_holder.hpp index e8a968eb6d..9ebe493a5a 100644 --- a/3party/boost/boost/flyweight/intermodule_holder.hpp +++ b/3party/boost/boost/flyweight/intermodule_holder.hpp @@ -1,4 +1,4 @@ -/* Copyright 2006-2009 Joaquin M Lopez Munoz. +/* Copyright 2006-2010 Joaquin M Lopez Munoz. * 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) @@ -16,15 +16,8 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include /* intermodule_holder_class guarantees a unique instance across all dynamic * modules of a program. @@ -35,137 +28,10 @@ namespace boost{ namespace flyweights{ template -struct intermodule_holder_class:holder_marker +struct intermodule_holder_class: + interprocess::detail::intermodule_singleton, + holder_marker { - static C& get() - { - static instantiator instance; - return instance.get(); - } - -private: - struct instantiator - { - instantiator(): - mutex(interprocess::open_or_create,compute_mutex_name()), - seg(interprocess::open_or_create,compute_segment_name(),16384), - ppref(0), - pc(0) - { - /* Instance creation is done according to a two-phase protocol so - * that we call "new" in an unlocked situation, thus minimizing the - * chance of leaving dangling locks due to catastrophic failure. - */ - - { - interprocess::scoped_lock lock(mutex); - ppref=seg.find_or_construct( - typeid(C).name())((referenced_instance*)0); - if(*ppref){ - /* As in some OSes Boost.Interprocess memory segments can outlive - * their associated processes, there is a possibility that we - * retrieve a dangling pointer (coming from a previous aborted run, - * for instance). Try to protect against this by checking that - * the contents of the pointed object are consistent. - */ - if(std::strcmp(segment_name,(*ppref)->segment_name)!=0){ - *ppref=0; /* dangling pointer! */ - } - else ++((*ppref)->ref); - } - } - if(!*ppref){ - std::auto_ptr apc( - new referenced_instance(segment_name)); - interprocess::scoped_lock lock(mutex); - ppref=seg.find_or_construct( - typeid(C).name())((referenced_instance*)0); - if(!*ppref)*ppref=apc.release(); - ++((*ppref)->ref); - } - pc=&(*ppref)->c; - } - - ~instantiator() - { - /* As in construction time, actual deletion is performed outside the - * lock to avoid leaving the lock dangling in case of crash. - */ - - referenced_instance* pref=0; - { - interprocess::scoped_lock lock(mutex); - if(--((*ppref)->ref)==0){ - pref=*ppref; - *ppref=0; - } - } - if(pref)delete pref; - } - - C& get()const{return *pc;} - - private: - /* Although mutex and seg are system-wide, their names intend to - * make them specific for the current process and type, hence their - * containing process id and type id info. - */ - - char mutex_name[128]; - char segment_name[128]; - - const char* compute_mutex_name() - { - std::sprintf( - mutex_name, - "boost_flyweight_intermodule_holder_mutex_" - "%ld_%u_%u", - (long)detail::process_id(), - (unsigned)compute_hash(typeid(C).name(),0), - (unsigned)compute_hash(typeid(C).name(),1)); - - return mutex_name; - } - - const char* compute_segment_name() - { - std::sprintf( - segment_name, - "boost_flyweight_intermodule_holder_segment_" - "%ld_%u_%u", - (long)detail::process_id(), - (unsigned)compute_hash(typeid(C).name(),0), - (unsigned)compute_hash(typeid(C).name(),1)); - - return segment_name; - } - - static std::size_t compute_hash(const char* str,std::size_t off) - { - std::size_t len=std::strlen(str); - if(off>len)off=len; - return hash_range(str+off,str+len); - } - - interprocess::named_mutex mutex; - interprocess::managed_shared_memory seg; - struct referenced_instance - { - referenced_instance(const char* segment_name_):ref(0) - { - std::strcpy(segment_name,segment_name_); - } - - ~referenced_instance(){segment_name[0]='\0';} - - char segment_name[128]; /* used to detect dangling pointers */ - mutable long ref; - C c; - }** ppref; - C* pc; - }; - -public: typedef intermodule_holder_class type; BOOST_MPL_AUX_LAMBDA_SUPPORT(1,intermodule_holder_class,(C)) }; diff --git a/3party/boost/boost/flyweight/refcounted.hpp b/3party/boost/boost/flyweight/refcounted.hpp index 98af285df5..28b7629c1c 100644 --- a/3party/boost/boost/flyweight/refcounted.hpp +++ b/3party/boost/boost/flyweight/refcounted.hpp @@ -1,4 +1,4 @@ -/* Copyright 2006-2009 Joaquin M Lopez Munoz. +/* Copyright 2006-2010 Joaquin M Lopez Munoz. * 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) @@ -15,7 +15,6 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#include #include #include #include @@ -36,7 +35,9 @@ * Here is where the deleter count comes into play. This count is * incremented when the reference count changes from 0 to 1, and decremented * when a thread is about to check a value for erasure; it can be seen that a - * value is effectively erasable only when the deleter count goes down to 0. + * value is effectively erasable only when the deleter count goes down to 0 + * (unless there are dangling references due to abnormal program termination, + * for instance if std::exit is called). */ namespace boost{ @@ -57,17 +58,6 @@ public: x(r.x),ref(0),del_ref(0) {} - ~refcounted_value() - { - /* count()!=0 most likely indicates that the flyweight factory - * has been destructed before some of the flyweight objects using - * it. Check for static initialization order problems with this - * flyweight type. - */ - - BOOST_ASSERT(count()==0); - } - refcounted_value& operator=(const refcounted_value& r) { x=r.x; diff --git a/3party/boost/boost/foreach.hpp b/3party/boost/boost/foreach.hpp index 9e074ac5b1..db5b2035c2 100644 --- a/3party/boost/boost/foreach.hpp +++ b/3party/boost/boost/foreach.hpp @@ -246,7 +246,7 @@ struct auto_any_base template struct auto_any : auto_any_base { - auto_any(T const &t) + explicit auto_any(T const &t) : item(t) { } @@ -606,7 +606,7 @@ should_copy_impl(boost::mpl::false_ *, boost::mpl::false_ *, bool *is_rvalue) template inline auto_any contain(T const &t, boost::mpl::true_ *) // rvalue { - return t; + return auto_any(t); } template @@ -614,18 +614,18 @@ inline auto_any contain(T &t, boost::mpl::false_ *) // lvalue { // Cannot seem to get sunpro to handle addressof() with array types. #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570)) - return &t; + return auto_any(&t); #else - return boost::addressof(t); + return auto_any(boost::addressof(t)); #endif } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION template -auto_any > +inline auto_any > contain(T const &t, bool *rvalue) { - return *rvalue ? simple_variant(t) : simple_variant(&t); + return auto_any >(*rvalue ? simple_variant(t) : simple_variant(&t)); } #endif @@ -636,7 +636,8 @@ template inline auto_any::type> begin(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue { - return boost::begin(auto_any_cast(col)); + return auto_any::type>( + boost::begin(auto_any_cast(col))); } template @@ -645,15 +646,17 @@ begin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue { typedef BOOST_DEDUCED_TYPENAME type2type::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator; - return iterator(boost::begin(derefof(auto_any_cast(col)))); + return auto_any::type>( + iterator(boost::begin(derefof(auto_any_cast(col))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION template -auto_any::type> +inline auto_any::type> begin(auto_any_t col, type2type *, bool *) { - return boost::begin(*auto_any_cast, boost::mpl::false_>(col).get()); + return auto_any::type>( + boost::begin(*auto_any_cast, boost::mpl::false_>(col).get())); } #endif @@ -662,7 +665,7 @@ template inline auto_any begin(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings { - return auto_any_cast(col); + return auto_any(auto_any_cast(col)); } #endif @@ -673,7 +676,8 @@ template inline auto_any::type> end(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue { - return boost::end(auto_any_cast(col)); + return auto_any::type>( + boost::end(auto_any_cast(col))); } template @@ -682,15 +686,17 @@ end(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue { typedef BOOST_DEDUCED_TYPENAME type2type::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator::type iterator; - return iterator(boost::end(derefof(auto_any_cast(col)))); + return auto_any::type>( + iterator(boost::end(derefof(auto_any_cast(col))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION template -auto_any::type> +inline auto_any::type> end(auto_any_t col, type2type *, bool *) { - return boost::end(*auto_any_cast, boost::mpl::false_>(col).get()); + return auto_any::type>( + boost::end(*auto_any_cast, boost::mpl::false_>(col).get())); } #endif @@ -699,7 +705,7 @@ template inline auto_any end(auto_any_t, type2type *, boost::mpl::true_ *) // null-terminated C-style strings { - return 0; // not used + return auto_any(0); // not used } #endif @@ -749,7 +755,8 @@ template inline auto_any::type> rbegin(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue { - return boost::rbegin(auto_any_cast(col)); + return auto_any::type>( + boost::rbegin(auto_any_cast(col))); } template @@ -758,15 +765,17 @@ rbegin(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue { typedef BOOST_DEDUCED_TYPENAME type2type::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator; - return iterator(boost::rbegin(derefof(auto_any_cast(col)))); + return auto_any::type>( + iterator(boost::rbegin(derefof(auto_any_cast(col))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION template -auto_any::type> +inline auto_any::type> rbegin(auto_any_t col, type2type *, bool *) { - return boost::rbegin(*auto_any_cast, boost::mpl::false_>(col).get()); + return auto_any::type>( + boost::rbegin(*auto_any_cast, boost::mpl::false_>(col).get())); } #endif @@ -778,7 +787,7 @@ rbegin(auto_any_t col, type2type *, boost::mpl::true_ *) // null-termina T *p = auto_any_cast(col); while(0 != *p) ++p; - return reverse_iterator(p); + return auto_any >(reverse_iterator(p)); } #endif @@ -789,7 +798,8 @@ template inline auto_any::type> rend(auto_any_t col, type2type *, boost::mpl::true_ *) // rvalue { - return boost::rend(auto_any_cast(col)); + return auto_any::type>( + boost::rend(auto_any_cast(col))); } template @@ -798,15 +808,17 @@ rend(auto_any_t col, type2type *, boost::mpl::false_ *) // lvalue { typedef BOOST_DEDUCED_TYPENAME type2type::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator::type iterator; - return iterator(boost::rend(derefof(auto_any_cast(col)))); + return auto_any::type>( + iterator(boost::rend(derefof(auto_any_cast(col))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION template -auto_any::type> +inline auto_any::type> rend(auto_any_t col, type2type *, bool *) { - return boost::rend(*auto_any_cast, boost::mpl::false_>(col).get()); + return auto_any::type>( + boost::rend(*auto_any_cast, boost::mpl::false_>(col).get())); } #endif @@ -815,7 +827,8 @@ template inline auto_any > rend(auto_any_t col, type2type *, boost::mpl::true_ *) // null-terminated C-style strings { - return reverse_iterator(auto_any_cast(col)); + return auto_any >( + reverse_iterator(auto_any_cast(col))); } #endif diff --git a/3party/boost/boost/functional/hash/hash.hpp b/3party/boost/boost/functional/hash/hash.hpp index 108d3eda3a..0eedf7f7f9 100644 --- a/3party/boost/boost/functional/hash/hash.hpp +++ b/3party/boost/boost/functional/hash/hash.hpp @@ -209,9 +209,15 @@ namespace boost template std::size_t hash_value(T* v) #endif { +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + // for some reason ptrdiff_t on OpenVMS compiler with + // 64 bit is not 64 bit !!! + std::size_t x = static_cast( + reinterpret_cast(v)); +#else std::size_t x = static_cast( reinterpret_cast(v)); - +#endif return x + (x >> 3); } diff --git a/3party/boost/boost/fusion/adapted.hpp b/3party/boost/boost/fusion/adapted.hpp index 0968420453..bdd7b8ccfb 100644 --- a/3party/boost/boost/fusion/adapted.hpp +++ b/3party/boost/boost/fusion/adapted.hpp @@ -8,10 +8,10 @@ #if !defined(BOOST_FUSION_ADAPTED_30122005_1420) #define BOOST_FUSION_ADAPTED_30122005_1420 +#include #include #include #include -#include #include #include #include diff --git a/3party/boost/boost/fusion/adapted/class.hpp b/3party/boost/boost/fusion/adapted/adt.hpp similarity index 58% rename from 3party/boost/boost/fusion/adapted/class.hpp rename to 3party/boost/boost/fusion/adapted/adt.hpp index 75150942c9..c9d9f279df 100644 --- a/3party/boost/boost/fusion/adapted/class.hpp +++ b/3party/boost/boost/fusion/adapted/adt.hpp @@ -7,12 +7,12 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_HPP -#define BOOST_FUSION_ADAPTED_CLASS_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_HPP +#define BOOST_FUSION_ADAPTED_ADT_HPP -#include -#include -#include -#include +#include +#include +#include +#include #endif diff --git a/3party/boost/boost/fusion/adapted/class/adapt_class.hpp b/3party/boost/boost/fusion/adapted/adt/adapt_adt.hpp similarity index 69% rename from 3party/boost/boost/fusion/adapted/class/adapt_class.hpp rename to 3party/boost/boost/fusion/adapted/adt/adapt_adt.hpp index fdd5621611..0508a67397 100644 --- a/3party/boost/boost/fusion/adapted/class/adapt_class.hpp +++ b/3party/boost/boost/fusion/adapted/adt/adapt_adt.hpp @@ -7,8 +7,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP -#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_ADAPT_ADT_HPP +#define BOOST_FUSION_ADAPTED_ADT_ADAPT_ADT_HPP #include #include @@ -29,46 +29,45 @@ #include #include #include -#include -#include +#include +#include -#define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\ - ((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1 -#define BOOST_FUSION_ADAPT_CLASS_FILLER_1(A, B, C, D)\ - ((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_0 -#define BOOST_FUSION_ADAPT_CLASS_FILLER_0_END -#define BOOST_FUSION_ADAPT_CLASS_FILLER_1_END +#define BOOST_FUSION_ADAPT_ADT_FILLER_0(A, B, C, D)\ + ((A, B, C, D)) BOOST_FUSION_ADAPT_ADT_FILLER_1 +#define BOOST_FUSION_ADAPT_ADT_FILLER_1(A, B, C, D)\ + ((A, B, C, D)) BOOST_FUSION_ADAPT_ADT_FILLER_0 +#define BOOST_FUSION_ADAPT_ADT_FILLER_0_END +#define BOOST_FUSION_ADAPT_ADT_FILLER_1_END -#define BOOST_FUSION_ADAPT_CLASS_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \ - BOOST_FUSION_ADAPT_CLASS_C_BASE( \ +#define BOOST_FUSION_ADAPT_ADT_C(TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \ + BOOST_FUSION_ADAPT_ADT_C_BASE( \ TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE, 4) -#define BOOST_FUSION_ADAPT_TPL_CLASS(TEMPLATE_PARAMS_SEQ, NAME_SEQ , ATTRIBUTES)\ +#define BOOST_FUSION_ADAPT_TPL_ADT(TEMPLATE_PARAMS_SEQ, NAME_SEQ , ATTRIBUTES) \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ (1)TEMPLATE_PARAMS_SEQ, \ (1)NAME_SEQ, \ struct_tag, \ 0, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_CLASS_C) + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ADT_C) -#define BOOST_FUSION_ADAPT_CLASS(NAME, ATTRIBUTES) \ +#define BOOST_FUSION_ADAPT_ADT(NAME, ATTRIBUTES) \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ (0), \ (0)(NAME), \ struct_tag, \ 0, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_CLASS_C) + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ADT_C) -#define BOOST_FUSION_ADAPT_CLASS_AS_VIEW(NAME, ATTRIBUTES) \ +#define BOOST_FUSION_ADAPT_ADT_AS_VIEW(NAME, ATTRIBUTES) \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ (0), \ (0)(NAME), \ struct_tag, \ 1, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_CLASS_C) - + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ADT_C) #endif diff --git a/3party/boost/boost/fusion/adapted/class/adapt_class_named.hpp b/3party/boost/boost/fusion/adapted/adt/adapt_adt_named.hpp similarity index 72% rename from 3party/boost/boost/fusion/adapted/class/adapt_class_named.hpp rename to 3party/boost/boost/fusion/adapted/adt/adapt_adt_named.hpp index bbc1d1aeac..c2ace0130c 100644 --- a/3party/boost/boost/fusion/adapted/class/adapt_class_named.hpp +++ b/3party/boost/boost/fusion/adapted/adt/adapt_adt_named.hpp @@ -7,24 +7,24 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP -#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_ADAPT_ADT_NAMED_HPP +#define BOOST_FUSION_ADAPTED_ADT_ADAPT_ADT_NAMED_HPP -#include +#include #include -#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \ +#define BOOST_FUSION_ADAPT_ADT_NAMED_NS( \ WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ \ BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \ \ - BOOST_FUSION_ADAPT_CLASS_AS_VIEW( \ + BOOST_FUSION_ADAPT_ADT_AS_VIEW( \ BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \ ATTRIBUTES) -#define BOOST_FUSION_ADAPT_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ - BOOST_FUSION_ADAPT_CLASS_NAMED_NS( \ +#define BOOST_FUSION_ADAPT_ADT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_ADT_NAMED_NS( \ WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES) #endif diff --git a/3party/boost/boost/fusion/adapted/class/adapt_assoc_class.hpp b/3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt.hpp similarity index 74% rename from 3party/boost/boost/fusion/adapted/class/adapt_assoc_class.hpp rename to 3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt.hpp index 60d8d9e42b..b67ba2c5a6 100644 --- a/3party/boost/boost/fusion/adapted/class/adapt_assoc_class.hpp +++ b/3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt.hpp @@ -7,8 +7,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP -#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_HPP +#define BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_HPP #include #include @@ -32,20 +32,20 @@ #include #include #include -#include -#include +#include +#include -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0(A, B, C, D, E)\ - ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1 -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1(A, B, C, D, E)\ - ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0_END -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1_END +#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(A, B, C, D, E)\ + ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1 +#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1(A, B, C, D, E)\ + ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 +#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0_END +#define BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_1_END -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C( \ +#define BOOST_FUSION_ADAPT_ASSOC_ADT_C( \ TEMPLATE_PARAMS_SEQ, NAME_SEQ, I, ATTRIBUTE) \ \ - BOOST_FUSION_ADAPT_CLASS_C_BASE(TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,5) \ + BOOST_FUSION_ADAPT_ADT_C_BASE(TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,5) \ \ template< \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ @@ -55,7 +55,7 @@ typedef BOOST_PP_TUPLE_ELEM(5, 4, ATTRIBUTE) type; \ }; -#define BOOST_FUSION_ADAPT_ASSOC_TPL_CLASS( \ +#define BOOST_FUSION_ADAPT_ASSOC_TPL_ADT( \ TEMPLATE_PARAMS_SEQ, NAME_SEQ, ATTRIBUTES) \ \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ @@ -63,25 +63,25 @@ (1)NAME_SEQ, \ assoc_struct_tag, \ 0, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_ASSOC_CLASS_C) + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_ADT_C) -#define BOOST_FUSION_ADAPT_ASSOC_CLASS(NAME, ATTRIBUTES) \ +#define BOOST_FUSION_ADAPT_ASSOC_ADT(NAME, ATTRIBUTES) \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ (0), \ (0)(NAME), \ assoc_struct_tag, \ 0, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_ASSOC_CLASS_C) + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_ADT_C) -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_AS_VIEW(NAME, ATTRIBUTES) \ +#define BOOST_FUSION_ADAPT_ASSOC_ADT_AS_VIEW(NAME, ATTRIBUTES) \ BOOST_FUSION_ADAPT_STRUCT_BASE( \ (0), \ (0)(NAME), \ assoc_struct_tag, \ 1, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_ASSOC_CLASS_C) + BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \ + BOOST_FUSION_ADAPT_ASSOC_ADT_C) #endif diff --git a/3party/boost/boost/fusion/adapted/class/adapt_assoc_class_named.hpp b/3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp similarity index 69% rename from 3party/boost/boost/fusion/adapted/class/adapt_assoc_class_named.hpp rename to 3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp index 99e45ada1c..b875982533 100644 --- a/3party/boost/boost/fusion/adapted/class/adapt_assoc_class_named.hpp +++ b/3party/boost/boost/fusion/adapted/adt/adapt_assoc_adt_named.hpp @@ -5,24 +5,24 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP -#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_NAMED_HPP +#define BOOST_FUSION_ADAPTED_ADT_ADAPT_ASSOC_ADT_NAMED_HPP -#include +#include #include -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \ +#define BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED_NS( \ WRAPPED_TYPE, NAMESPACE_SEQ, NAME, ATTRIBUTES) \ \ BOOST_FUSION_ADAPT_STRUCT_DEFINE_PROXY_TYPE_IMPL( \ WRAPPED_TYPE,(0)NAMESPACE_SEQ,NAME) \ \ - BOOST_FUSION_ADAPT_ASSOC_CLASS_AS_VIEW( \ + BOOST_FUSION_ADAPT_ASSOC_ADT_AS_VIEW( \ BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \ ATTRIBUTES) -#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ - BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS( \ +#define BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_ASSOC_ADT_NAMED_NS( \ WRAPPED_TYPE,(boost)(fusion)(adapted),NAME,ATTRIBUTES) #endif diff --git a/3party/boost/boost/fusion/adapted/adt/detail/adapt_base.hpp b/3party/boost/boost/fusion/adapted/adt/detail/adapt_base.hpp new file mode 100644 index 0000000000..bddc79de7e --- /dev/null +++ b/3party/boost/boost/fusion/adapted/adt/detail/adapt_base.hpp @@ -0,0 +1,181 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + Copyright (c) 2010 Christopher Schmidt + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_HPP +#define BOOST_FUSION_ADAPTED_ADT_DETAIL_ADAPT_BASE_HPP + +#include +#include +#include +#include +#include + +#define BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_TEMPLATE_IMPL(TEMPLATE_PARAMS_SEQ) \ + typename detail::get_identity< \ + lvalue \ + , BOOST_PP_SEQ_ELEM(1,TEMPLATE_PARAMS_SEQ) \ + >::type + +#define BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_NON_TEMPLATE_IMPL( \ + TEMPLATE_PARAMS_SEQ) \ + \ + boost::remove_const::type>::type + +#define BOOST_FUSION_ADAPT_ADT_C_BASE( \ + TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct access::adt_attribute_access< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + > \ + { \ + template \ + static void \ + boost_fusion_adapt_adt_impl_set( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj, \ + Val const& val) \ + { \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \ + } \ + \ + static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \ + boost_fusion_adapt_adt_impl_get( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \ + { \ + return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ + } \ + \ + static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \ + boost_fusion_adapt_adt_impl_get( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \ + { \ + return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ + } \ + }; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct adt_attribute_proxy< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + , true \ + > \ + { \ + typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) type; \ + \ + explicit \ + adt_attribute_proxy( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& o) \ + : obj(&o) \ + {} \ + \ + type get() const \ + { \ + return access::adt_attribute_access< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + >::boost_fusion_adapt_adt_impl_get(*obj); \ + } \ + \ + operator type() const \ + { \ + return get(); \ + } \ + \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const* obj; \ + }; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct adt_attribute_proxy< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + , false \ + > \ + { \ + typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \ + \ + explicit \ + adt_attribute_proxy( \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& o) \ + : obj(&o) \ + {} \ + \ + template \ + adt_attribute_proxy& \ + operator=(Val const& val) \ + { \ + access::adt_attribute_access< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + >::boost_fusion_adapt_adt_impl_set(*obj, val); \ + return *this; \ + } \ + \ + type get() const \ + { \ + return access::adt_attribute_access< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + >::boost_fusion_adapt_adt_impl_get(*obj); \ + } \ + \ + operator type() const \ + { \ + return get(); \ + } \ + \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)* obj; \ + }; \ + \ + template< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ + > \ + struct access::struct_member< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + > \ + { \ + typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + \ + typedef \ + BOOST_PP_IF( \ + BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), \ + BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_TEMPLATE_IMPL, \ + BOOST_FUSION_ADAPT_ADT_GET_IDENTITY_NON_TEMPLATE_IMPL)( \ + TEMPLATE_PARAMS_SEQ) \ + type; \ + \ + template \ + struct apply \ + { \ + typedef \ + adt_attribute_proxy< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + , is_const::value \ + > \ + type; \ + \ + static type \ + call(Seq& obj) \ + { \ + return type(obj); \ + } \ + }; \ + }; + +#endif diff --git a/3party/boost/boost/fusion/adapted/class/detail/extension.hpp b/3party/boost/boost/fusion/adapted/adt/detail/extension.hpp similarity index 55% rename from 3party/boost/boost/fusion/adapted/class/detail/extension.hpp rename to 3party/boost/boost/fusion/adapted/adt/detail/extension.hpp index 0ad7c66eb2..50c40cf34e 100644 --- a/3party/boost/boost/fusion/adapted/class/detail/extension.hpp +++ b/3party/boost/boost/fusion/adapted/adt/detail/extension.hpp @@ -7,27 +7,18 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP -#define BOOST_FUSION_ADAPTED_CLASS_DETAIL_EXTENSION_HPP +#ifndef BOOST_FUSION_ADAPTED_ADT_DETAIL_EXTENSION_HPP +#define BOOST_FUSION_ADAPTED_ADT_DETAIL_EXTENSION_HPP #include #include -namespace boost { namespace fusion +namespace boost { namespace fusion { namespace detail { - namespace detail - { - template - struct get_identity - : remove_const::type> - {}; - } - - namespace extension - { - template - struct class_member_proxy; - } -}} + template + struct get_identity + : remove_const::type> + {}; +}}} #endif diff --git a/3party/boost/boost/fusion/adapted/class/detail/adapt_base.hpp b/3party/boost/boost/fusion/adapted/class/detail/adapt_base.hpp deleted file mode 100644 index 264390a64c..0000000000 --- a/3party/boost/boost/fusion/adapted/class/detail/adapt_base.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2009 Joel de Guzman - Copyright (c) 2005-2006 Dan Marsden - Copyright (c) 2010 Christopher Schmidt - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ - -#ifndef BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP -#define BOOST_FUSION_ADAPTED_CLASS_DETAIL_ADAPT_BASE_HPP - -#include -#include -#include -#include -#include - -//cschmidt: Spirit relies on Fusion defining class_member_proxy in the -//boost::fusion::extension namespace, with two nested types named lvalue and -//rvalue. - -#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL(TEMPLATE_PARAMS_SEQ)\ - typename detail::get_identity< \ - lvalue \ - , BOOST_PP_SEQ_ELEM(1,TEMPLATE_PARAMS_SEQ) \ - >::type - -#define BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL( \ - TEMPLATE_PARAMS_SEQ) \ - \ - lvalue - -#define BOOST_FUSION_ADAPT_CLASS_C_BASE(\ - TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \ - \ - template< \ - BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ - > \ - struct class_member_proxy< \ - BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ - , I \ - > \ - { \ - typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \ - typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) rvalue; \ - \ - class_member_proxy(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& o) \ - : obj(o) \ - {} \ - \ - template \ - class_member_proxy& \ - operator=(Arg const& val) \ - { \ - BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 3, ATTRIBUTE); \ - return *this; \ - } \ - \ - operator lvalue() \ - { \ - return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ - } \ - \ - BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj; \ - \ - private: \ - class_member_proxy& operator= (class_member_proxy const&); \ - }; \ - \ - template< \ - BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ - > \ - struct struct_member \ - { \ - typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) lvalue; \ - \ - typedef \ - BOOST_PP_IF( \ - BOOST_PP_SEQ_HEAD(TEMPLATE_PARAMS_SEQ), \ - BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_TEMPLATE_IMPL, \ - BOOST_FUSION_ADAPT_CLASS_GET_IDENTITY_NON_TEMPLATE_IMPL)( \ - TEMPLATE_PARAMS_SEQ) \ - type; \ - \ - template \ - struct apply \ - { \ - typedef \ - class_member_proxy< \ - BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ - , I \ - > \ - proxy; \ - \ - typedef typename \ - mpl::if_< \ - is_const \ - , BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \ - , proxy \ - >::type \ - type; \ - \ - static proxy \ - call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)& obj) \ - { \ - return proxy(obj); \ - } \ - \ - static BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 1, ATTRIBUTE) \ - call(BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) const& obj) \ - { \ - return BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 2, ATTRIBUTE); \ - } \ - }; \ - }; - -#endif diff --git a/3party/boost/boost/fusion/adapted/struct/detail/adapt_base.hpp b/3party/boost/boost/fusion/adapted/struct/detail/adapt_base.hpp index b2d81cf8cb..503fc2361c 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/adapt_base.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/adapt_base.hpp @@ -87,15 +87,41 @@ I, \ ATTRIBUTE) +#ifdef BOOST_MSVC +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAM(R,_,ELEM) \ + typedef ELEM ELEM; +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS_IMPL(SEQ) \ + BOOST_PP_SEQ_FOR_EACH( \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAM, \ + _, \ + BOOST_PP_SEQ_TAIL(SEQ)) +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS(SEQ) \ + BOOST_PP_IF( \ + BOOST_PP_SEQ_HEAD(SEQ), \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS_IMPL, \ + BOOST_PP_TUPLE_EAT(1))(SEQ) +#else +# define BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS(SEQ) +#endif + #define BOOST_FUSION_ADAPT_STRUCT_C_BASE( \ TEMPLATE_PARAMS_SEQ,NAME_SEQ,I,PREFIX,ATTRIBUTE,ATTRIBUTE_TUPEL_SIZE) \ \ template< \ BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS(TEMPLATE_PARAMS_SEQ) \ > \ - struct struct_member \ + struct access::struct_member< \ + BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ) \ + , I \ + > \ { \ - typedef BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) type; \ + typedef \ + BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE, 0, ATTRIBUTE) \ + attribute_type; \ + BOOST_FUSION_ADAPT_STRUCT_MSVC_REDEFINE_TEMPLATE_PARAMS( \ + TEMPLATE_PARAMS_SEQ) \ + \ + typedef attribute_type type; \ \ template \ struct apply \ @@ -104,12 +130,8 @@ add_reference< \ typename mpl::eval_if< \ is_const \ - , add_const \ - , mpl::identity \ + , add_const \ + , mpl::identity \ >::type \ >::type \ type; \ diff --git a/3party/boost/boost/fusion/adapted/struct/detail/at_impl.hpp b/3party/boost/boost/fusion/adapted/struct/detail/at_impl.hpp index febb63358b..99c63e9a34 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/at_impl.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/at_impl.hpp @@ -22,7 +22,7 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : extension::struct_member< + : access::struct_member< typename remove_const::type , N::value >::template apply diff --git a/3party/boost/boost/fusion/adapted/struct/detail/deref_impl.hpp b/3party/boost/boost/fusion/adapted/struct/detail/deref_impl.hpp index 498617a359..3f25efef58 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/deref_impl.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/deref_impl.hpp @@ -20,7 +20,7 @@ namespace boost { namespace fusion { namespace extension struct apply { typedef typename - extension::struct_member< + access::struct_member< typename remove_const::type , It::index::value >::template apply diff --git a/3party/boost/boost/fusion/adapted/struct/detail/extension.hpp b/3party/boost/boost/fusion/adapted/struct/detail/extension.hpp index 1f9f4f75e0..17edb89dca 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/extension.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/extension.hpp @@ -27,8 +27,17 @@ namespace boost { namespace fusion { struct no_such_member; - template - struct struct_member; + struct access + { + template + struct struct_member; + + template + struct adt_attribute_access; + }; + + template + struct adt_attribute_proxy; template struct struct_member_name; diff --git a/3party/boost/boost/fusion/adapted/struct/detail/value_at_impl.hpp b/3party/boost/boost/fusion/adapted/struct/detail/value_at_impl.hpp index 5ecf4ac730..08c82fc0c9 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/value_at_impl.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/value_at_impl.hpp @@ -20,7 +20,7 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : struct_member::type, N::value> + : access::struct_member::type, N::value> {}; }; diff --git a/3party/boost/boost/fusion/adapted/struct/detail/value_of_impl.hpp b/3party/boost/boost/fusion/adapted/struct/detail/value_of_impl.hpp index 55d37ed7a7..63dcbe52ff 100644 --- a/3party/boost/boost/fusion/adapted/struct/detail/value_of_impl.hpp +++ b/3party/boost/boost/fusion/adapted/struct/detail/value_of_impl.hpp @@ -18,7 +18,7 @@ namespace boost { namespace fusion { namespace extension { template struct apply - : extension::struct_member< + : access::struct_member< typename remove_const::type , It::index::value > diff --git a/3party/boost/boost/fusion/algorithm/iteration/detail/fold.hpp b/3party/boost/boost/fusion/algorithm/iteration/detail/fold.hpp index 3ce672b3e0..56302fb8be 100644 --- a/3party/boost/boost/fusion/algorithm/iteration/detail/fold.hpp +++ b/3party/boost/boost/fusion/algorithm/iteration/detail/fold.hpp @@ -68,7 +68,7 @@ namespace boost { namespace fusion namespace detail { template - struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state) + struct BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state) : boost::result_of< F( typename add_reference::type>::type, @@ -102,24 +102,20 @@ namespace boost { namespace fusion It3; It3 it3 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it2); + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State2; + State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State3; + State3 const state3=f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); + return BOOST_PP_CAT(unrolled_,BOOST_FUSION_FOLD_NAME)< Result , N-4 >::call( - f( - f( - f( - f( - state, - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( - it0) - ), - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1) - ), - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2) - ), - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it3) - ), + f(state3,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it3)), fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it3), f); } @@ -145,17 +141,13 @@ namespace boost { namespace fusion It2; It2 it2 = fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1); - return f( - f( - f( - state, - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0) - ), - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1) - ), - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( - fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it1) - )); + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State2; + State2 const state2=f(state1,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it1)); + + return f(state2,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it2)); } }; @@ -166,9 +158,11 @@ namespace boost { namespace fusion static Result call(State const& state,It0 const& it0,F f) { + typedef typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)::type State1; + State1 const state1=f(state,BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)); + return f( - f(state, - BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM(it0)), + state1, BOOST_FUSION_FOLD_IMPL_INVOKE_IT_TRANSFORM( fusion::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION(it0))); } @@ -201,7 +195,7 @@ namespace boost { namespace fusion struct BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME) { typedef typename - BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< StateRef , It0 const , F @@ -213,7 +207,7 @@ namespace boost { namespace fusion >::type it1; typedef typename - BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< rest1 , it1 , F @@ -223,7 +217,7 @@ namespace boost { namespace fusion result_of::BOOST_FUSION_FOLD_IMPL_NEXT_IT_FUNCTION::type it2; typedef typename - BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< rest2 , it2 , F @@ -236,7 +230,7 @@ namespace boost { namespace fusion typedef typename BOOST_PP_CAT(result_of_unrolled_,BOOST_FUSION_FOLD_NAME)< typename BOOST_PP_CAT( - BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_FUSION_FOLD_NAME, _lvalue_state)< rest3 , it3 , F @@ -259,7 +253,7 @@ namespace boost { namespace fusion > { typedef typename - BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< StateRef , It0 const , F @@ -272,9 +266,9 @@ namespace boost { namespace fusion it1; typedef typename - BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< typename BOOST_PP_CAT( - BOOST_FUSION_FOLD_NAME, _rvalue_state)< + BOOST_FUSION_FOLD_NAME, _lvalue_state)< rest1 , it1 , F @@ -294,8 +288,8 @@ namespace boost { namespace fusion , F , 2 > - : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< - typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< + typename BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< StateRef , It0 const , F @@ -314,7 +308,7 @@ namespace boost { namespace fusion , F , 1 > - : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _rvalue_state)< + : BOOST_PP_CAT(BOOST_FUSION_FOLD_NAME, _lvalue_state)< StateRef , It0 const , F @@ -405,7 +399,11 @@ namespace boost { namespace fusion } template - inline typename result_of::fold::type + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq + , State const + , F + >::type BOOST_FUSION_FOLD_NAME(Seq& seq,State const& state,F f) { return result_of::BOOST_FUSION_FOLD_NAME::call( @@ -415,7 +413,11 @@ namespace boost { namespace fusion } template - inline typename result_of::fold::type + inline typename result_of::BOOST_FUSION_FOLD_NAME< + Seq const + , State const + , F + >::type BOOST_FUSION_FOLD_NAME(Seq const& seq,State const& state,F f) { return result_of::BOOST_FUSION_FOLD_NAME::call( diff --git a/3party/boost/boost/fusion/include/adapt_class.hpp b/3party/boost/boost/fusion/include/adapt_adt.hpp similarity index 71% rename from 3party/boost/boost/fusion/include/adapt_class.hpp rename to 3party/boost/boost/fusion/include/adapt_adt.hpp index 77f519be7b..87ef15e848 100644 --- a/3party/boost/boost/fusion/include/adapt_class.hpp +++ b/3party/boost/boost/fusion/include/adapt_adt.hpp @@ -5,9 +5,9 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_INCLUDE_ADAPT_CLASS_HPP -#define BOOST_FUSION_INCLUDE_ADAPT_CLASS_HPP +#ifndef BOOST_FUSION_INCLUDE_ADAPT_ADT_HPP +#define BOOST_FUSION_INCLUDE_ADAPT_ADT_HPP -#include +#include #endif diff --git a/3party/boost/boost/fusion/include/adapted_class_named.cpp b/3party/boost/boost/fusion/include/adapt_adt_named.cpp similarity index 71% rename from 3party/boost/boost/fusion/include/adapted_class_named.cpp rename to 3party/boost/boost/fusion/include/adapt_adt_named.cpp index 0002ad6fc7..8ac033a019 100644 --- a/3party/boost/boost/fusion/include/adapted_class_named.cpp +++ b/3party/boost/boost/fusion/include/adapt_adt_named.cpp @@ -4,9 +4,9 @@ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#if !defined(FUSION_INCLUDE_ADAPT_CLASS_NAMED) -#define FUSION_INCLUDE_ADAPT_CLASS_NAMED +#if !defined(FUSION_INCLUDE_ADAPT_ADT_NAMED) +#define FUSION_INCLUDE_ADAPT_ADT_NAMED -#include +#include #endif diff --git a/3party/boost/boost/fusion/include/adapt_class_named.hpp b/3party/boost/boost/fusion/include/adapt_adt_named.hpp similarity index 69% rename from 3party/boost/boost/fusion/include/adapt_class_named.hpp rename to 3party/boost/boost/fusion/include/adapt_adt_named.hpp index 81136a1fd9..308249e818 100644 --- a/3party/boost/boost/fusion/include/adapt_class_named.hpp +++ b/3party/boost/boost/fusion/include/adapt_adt_named.hpp @@ -5,9 +5,9 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ -#ifndef BOOST_FUSION_INCLUDE_ADAPT_CLASS_NAMED_HPP -#define BOOST_FUSION_INCLUDE_ADAPT_CLASS_NAMED_HPP +#ifndef BOOST_FUSION_INCLUDE_ADAPT_ADT_NAMED_HPP +#define BOOST_FUSION_INCLUDE_ADAPT_ADT_NAMED_HPP -#include +#include #endif diff --git a/3party/boost/boost/fusion/include/adapt_assoc_adt.hpp b/3party/boost/boost/fusion/include/adapt_assoc_adt.hpp new file mode 100644 index 0000000000..55bd551465 --- /dev/null +++ b/3party/boost/boost/fusion/include/adapt_assoc_adt.hpp @@ -0,0 +1,13 @@ +/*============================================================================= + Copyright (c) 2010 Christopher Schmidt + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADT_HPP +#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADR_HPP + +#include + +#endif diff --git a/3party/boost/boost/fusion/include/adapt_assoc_adt_named.hpp b/3party/boost/boost/fusion/include/adapt_assoc_adt_named.hpp new file mode 100644 index 0000000000..aa356e756d --- /dev/null +++ b/3party/boost/boost/fusion/include/adapt_assoc_adt_named.hpp @@ -0,0 +1,13 @@ +/*============================================================================= + Copyright (c) 2010 Christopher Schmidt + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ + +#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADT_NAMED_HPP +#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_ADT_NAMED_HPP + +#include + +#endif diff --git a/3party/boost/boost/gil/bit_aligned_pixel_reference.hpp b/3party/boost/boost/gil/bit_aligned_pixel_reference.hpp index 1756abf455..a1582a0727 100644 --- a/3party/boost/boost/gil/bit_aligned_pixel_reference.hpp +++ b/3party/boost/boost/gil/bit_aligned_pixel_reference.hpp @@ -169,8 +169,8 @@ private: private: static void check_gray() { BOOST_STATIC_ASSERT((is_same::value)); } - template void assign(const Channel& chan, mpl::false_) const { check_gray(); at_c<0>(*this)=chan; } - template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return at_c<0>(*this)==chan; } + template void assign(const Channel& chan, mpl::false_) const { check_gray(); gil::at_c<0>(*this)=chan; } + template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return gil::at_c<0>(*this)==chan; } }; ///////////////////////////// diff --git a/3party/boost/boost/gil/channel.hpp b/3party/boost/boost/gil/channel.hpp index 4b34d04969..823691b350 100644 --- a/3party/boost/boost/gil/channel.hpp +++ b/3party/boost/boost/gil/channel.hpp @@ -208,6 +208,18 @@ namespace detail { >::type >::type > {}; + + template + struct num_value_fn : public mpl::if_c< ( NumBits < 32 ) + , uint32_t + , uint64_t + > {}; + + template + struct max_value_fn : public mpl::if_c< ( NumBits <= 32 ) + , uint32_t + , uint64_t + > {}; } /** @@ -230,10 +242,14 @@ BOOST_STATIC_ASSERT((boost::is_integral::value)); /// \brief The value of a subbyte channel. Models: ChannelValueConcept template class packed_channel_value { - static const std::size_t num_values = 1<::type num_value_t; + static const num_value_t num_values = static_cast< num_value_t >( 1 ) << NumBits ; + public: typedef typename detail::min_fast_uint::type integer_t; + typedef packed_channel_value value_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -245,9 +261,12 @@ public: BOOST_STATIC_CONSTANT(bool, is_mutable=true); packed_channel_value() {} - packed_channel_value(integer_t v) : _value(v % num_values) {} + packed_channel_value(integer_t v) { _value = static_cast< integer_t >( v % num_values ); } packed_channel_value(const packed_channel_value& v) : _value(v._value) {} - template packed_channel_value(Scalar v) : _value(integer_t(v) % num_values) {} // suppress GCC implicit conversion warnings in channel regression file + template packed_channel_value(Scalar v) { _value = static_cast< integer_t >( v ) % num_values; } + + static unsigned int num_bits() { return NumBits; } + operator integer_t() const { return _value; } private: @@ -307,8 +326,13 @@ public: operator integer_t() const { return get(); } data_ptr_t operator &() const {return _data_ptr;} protected: - static const integer_t max_val = (1<::type num_value_t; + typedef typename detail::max_value_fn< NumBits >::type max_value_t; + + static const num_value_t num_values = static_cast< num_value_t >( 1 ) << NumBits ; + static const max_value_t max_val = static_cast< max_value_t >( num_values - 1 ); + #ifdef GIL_NONWORD_POINTER_ALIGNMENT_SUPPORTED const bitfield_t& get_data() const { return *static_cast(_data_ptr); } void set_data(const bitfield_t& val) const { *static_cast< bitfield_t*>(_data_ptr) = val; } @@ -368,6 +392,7 @@ class packed_channel_reference friend class packed_channel_reference; static const BitField channel_mask = static_cast< BitField >( parent_t::max_val ) << FirstBit; + void operator=(const packed_channel_reference&); public: typedef const packed_channel_reference const_reference; @@ -392,6 +417,7 @@ class packed_channel_reference friend class packed_channel_reference; static const BitField channel_mask = static_cast< BitField >( parent_t::max_val ) << FirstBit; + public: typedef const packed_channel_reference const_reference; typedef const packed_channel_reference mutable_reference; @@ -409,8 +435,8 @@ public: unsigned first_bit() const { return FirstBit; } - integer_t get() const { return integer_t((this->get_data()&channel_mask) >> FirstBit); } - void set_unsafe(integer_t value) const { this->set_data((this->get_data() & ~channel_mask) | (( static_cast< BitField >( value )<get_data()&channel_mask) >> FirstBit); } + void set_unsafe(integer_t value) const { this->set_data((this->get_data() & ~channel_mask) | (( static_cast< BitField >( value )<set_data((this->get_data() & ~channel_mask) | (other_bits & channel_mask)); } }; @@ -491,8 +517,8 @@ public: unsigned first_bit() const { return _first_bit; } integer_t get() const { - const BitField channel_mask = parent_t::max_val<<_first_bit; - return ( static_cast< integer_t >( this->get_data()&channel_mask ) >> _first_bit ); + const BitField channel_mask = static_cast< integer_t >( parent_t::max_val ) <<_first_bit; + return static_cast< integer_t >(( this->get_data()&channel_mask ) >> _first_bit ); } }; @@ -526,11 +552,12 @@ public: unsigned first_bit() const { return _first_bit; } integer_t get() const { - const BitField channel_mask = parent_t::max_val<<_first_bit; - return ( static_cast< integer_t >( this->get_data()&channel_mask ) >> _first_bit ); + const BitField channel_mask = static_cast< integer_t >( parent_t::max_val ) << _first_bit; + return static_cast< integer_t >(( this->get_data()&channel_mask ) >> _first_bit ); } + void set_unsafe(integer_t value) const { - const BitField channel_mask = parent_t::max_val<<_first_bit; + const BitField channel_mask = static_cast< integer_t >( parent_t::max_val ) << _first_bit; this->set_data((this->get_data() & ~channel_mask) | value<<_first_bit); } }; diff --git a/3party/boost/boost/gil/channel_algorithm.hpp b/3party/boost/boost/gil/channel_algorithm.hpp index 7ef58da735..1361219a33 100644 --- a/3party/boost/boost/gil/channel_algorithm.hpp +++ b/3party/boost/boost/gil/channel_algorithm.hpp @@ -243,18 +243,22 @@ struct channel_converter_unsigned_integral_nondivisible struct channel_converter_unsigned_integral_nondivisible { DstChannelV operator()(SrcChannelV src) const { - typedef typename unsigned_integral_max_value::value_type integer_t; - static const double div = unsigned_integral_max_value::value / double(unsigned_integral_max_value::value); - static const integer_t div2 = integer_t(div/2); - return DstChannelV((src + div2) / div); + typedef typename detail::unsigned_integral_max_value< SrcChannelV >::value_type src_integer_t; + typedef typename detail::unsigned_integral_max_value< DstChannelV >::value_type dst_integer_t; + + static const double div = unsigned_integral_max_value::value + / static_cast< double >( unsigned_integral_max_value::value ); + + static const src_integer_t div2 = static_cast< src_integer_t >( div / 2.0 ); + + return DstChannelV( static_cast< dst_integer_t >(( static_cast< double >( src + div2 ) / div ))); } }; @@ -265,7 +269,11 @@ struct channel_converter_unsigned_integral_nondivisible struct channel_converter_unsigned : public std::unary_function { - DstChannelV operator()(bits32f x) const { return DstChannelV(x*channel_traits::max_value()+0.5f); } + DstChannelV operator()(bits32f x) const + { + typedef typename detail::unsigned_integral_max_value< DstChannelV >::value_type dst_integer_t; + return DstChannelV( static_cast< dst_integer_t >(x*channel_traits::max_value()+0.5f )); + } }; template struct channel_converter_unsigned : public std::unary_function { diff --git a/3party/boost/boost/gil/image.hpp b/3party/boost/boost/gil/image.hpp index 7e6adf391d..414997a86e 100644 --- a/3party/boost/boost/gil/image.hpp +++ b/3party/boost/boost/gil/image.hpp @@ -47,7 +47,7 @@ namespace boost { namespace gil { /// //////////////////////////////////////////////////////////////////////////////////////// -template > +template< typename Pixel, bool IsPlanar = false, typename Alloc=std::allocator > class image { public: typedef typename Alloc::template rebind::other allocator_type; @@ -194,13 +194,24 @@ private: } std::size_t total_allocated_size_in_bytes(const point_t& dimensions) const { + + typedef typename view_t::x_iterator x_iterator; + + // when value_type is a non-pixel, like int or float, num_channels< ... > doesn't work. + const std::size_t _channels_in_image = mpl::eval_if< is_pixel< value_type > + , num_channels< view_t > + , mpl::int_< 1 > + >::type::value; + std::size_t size_in_units = get_row_size_in_memunits(dimensions.x)*dimensions.y; + if (IsPlanar) - size_in_units = size_in_units*num_channels::value; + size_in_units = size_in_units * _channels_in_image ; // return the size rounded up to the nearest byte - return (size_in_units + byte_to_memunit::value - 1) / byte_to_memunit::value - + (_align_in_bytes>0 ? _align_in_bytes-1:0); // add extra padding in case we need to align the first image pixel + return ( size_in_units + byte_to_memunit< x_iterator >::value - 1 ) + / byte_to_memunit::value + + ( _align_in_bytes > 0 ? _align_in_bytes - 1 : 0 ); // add extra padding in case we need to align the first image pixel } std::size_t get_row_size_in_memunits(x_coord_t width) const { // number of units per row diff --git a/3party/boost/boost/gil/pixel.hpp b/3party/boost/boost/gil/pixel.hpp index cf448fbc98..4d3e42bbf4 100644 --- a/3party/boost/boost/gil/pixel.hpp +++ b/3party/boost/boost/gil/pixel.hpp @@ -47,6 +47,8 @@ template struct is_planar; template struct color_space_type : public color_space_type {}; template struct channel_mapping_type : public channel_mapping_type {}; template struct channel_type : public channel_type {}; + +template struct is_planar : mpl::false_ {}; template struct is_planar : public is_planar {}; diff --git a/3party/boost/boost/graph/adjacency_list.hpp b/3party/boost/boost/graph/adjacency_list.hpp index 1a24680faa..5034fec5a5 100644 --- a/3party/boost/boost/graph/adjacency_list.hpp +++ b/3party/boost/boost/graph/adjacency_list.hpp @@ -28,6 +28,8 @@ # endif #endif +#include + #include #include #include @@ -368,37 +370,24 @@ namespace boost { EdgeListS>::vertex_descriptor, VertexProperty> { - public: // TODO Remove me + public: #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename detail::retag_property_list::retagged - maybe_vertex_bundled; + typedef typename graph_detail::graph_prop::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; - typedef typename detail::retag_property_list::retagged - maybe_edge_bundled; -#endif + typedef typename graph_detail::vertex_prop::property vertex_property_type; + typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - public: -#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) - typedef typename detail::retag_property_list::type - vertex_property_type; - typedef typename detail::retag_property_list::type - edge_property_type; - - // The types that are actually bundled - typedef typename mpl::if_c<(is_same::value), - no_vertex_bundle, - maybe_vertex_bundled>::type vertex_bundled; - typedef typename mpl::if_c<(is_same::value), - no_edge_bundle, - maybe_edge_bundled>::type edge_bundled; + typedef typename graph_detail::edge_prop::property edge_property_type; + typedef typename graph_detail::edge_prop::bundle edge_bundled; #else + typedef GraphProperty graph_property_type; + typedef no_graph_bundle graph_bundled; + typedef VertexProperty vertex_property_type; - typedef EdgeProperty edge_property_type; typedef no_vertex_bundle vertex_bundled; + + typedef EdgeProperty edge_property_type; typedef no_edge_bundle edge_bundled; #endif @@ -421,44 +410,51 @@ namespace boost { typedef DirectedS directed_selector; typedef EdgeListS edge_list_selector; - typedef GraphProperty graph_property_type; - inline adjacency_list(const GraphProperty& p = GraphProperty()) - : m_property(p) { } + adjacency_list(const GraphProperty& p = GraphProperty()) + : m_property(new graph_property_type(p)) + { } - inline adjacency_list(const adjacency_list& x) - : Base(x), m_property(x.m_property) { } + adjacency_list(const adjacency_list& x) + : Base(x), m_property(new graph_property_type(*x.m_property)) + { } - inline adjacency_list& operator=(const adjacency_list& x) { + adjacency_list& operator=(const adjacency_list& x) { // TBD: probably should give the strong guarantee if (&x != this) { Base::operator=(x); - m_property = x.m_property; + + // Copy/swap the ptr since we can't just assign it... + property_ptr p(new graph_property_type(*x.m_property)); + m_property.swap(p); } return *this; } // Required by Mutable Graph - inline adjacency_list(vertices_size_type num_vertices, + adjacency_list(vertices_size_type num_vertices, const GraphProperty& p = GraphProperty()) - : Base(num_vertices), m_property(p) { } + : Base(num_vertices), m_property(new graph_property_type(p)) + { } #if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 // Required by Iterator Constructible Graph template - inline adjacency_list(EdgeIterator first, EdgeIterator last, + adjacency_list(EdgeIterator first, EdgeIterator last, vertices_size_type n, edges_size_type = 0, const GraphProperty& p = GraphProperty()) - : Base(n, first, last), m_property(p) { } + : Base(n, first, last), m_property(new graph_property_type(p)) + { } template - inline adjacency_list(EdgeIterator first, EdgeIterator last, + adjacency_list(EdgeIterator first, EdgeIterator last, EdgePropertyIterator ep_iter, vertices_size_type n, edges_size_type = 0, const GraphProperty& p = GraphProperty()) - : Base(n, first, last, ep_iter), m_property(p) { } + : Base(n, first, last, ep_iter), m_property(new graph_property_type(p)) + { } #endif void swap(adjacency_list& x) { @@ -487,35 +483,39 @@ namespace boost { const edge_bundled& operator[](edge_descriptor e) const { return get(edge_bundle, *this)[e]; } + + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + graph_bundled const& operator[](graph_bundle_t) const + { return get_property(*this); } #endif // protected: (would be protected if friends were more portable) - GraphProperty m_property; + typedef scoped_ptr property_ptr; + property_ptr m_property; }; - template - inline void - set_property(adjacency_list& g, Tag, - const Value& value) { - get_property_value(g.m_property, Tag()) = value;; +#define ADJLIST_PARAMS \ + typename OEL, typename VL, typename D, typename VP, typename EP, \ + typename GP, typename EL +#define ADJLIST adjacency_list + + template + inline void set_property(ADJLIST& g, Tag, Value const& value) { + get_property_value(*g.m_property, Tag()) = value; } - template - inline - typename graph_property, Tag>::type& - get_property(adjacency_list& g, Tag) { - return get_property_value(g.m_property, Tag()); + template + inline typename graph_property::type& + get_property(ADJLIST& g, Tag) { + return get_property_value(*g.m_property, Tag()); } - template - inline - const - typename graph_property, Tag>::type& - get_property(const adjacency_list& g, Tag) { - return get_property_value(g.m_property, Tag()); + template + inline typename graph_property::type const& + get_property(ADJLIST const& g, Tag) { + return get_property_value(*g.m_property, Tag()); } // dwa 09/25/00 - needed to be more explicit so reverse_graph would work. @@ -598,10 +598,6 @@ namespace boost { #endif // Mutability Traits -#define ADJLIST_PARAMS \ - typename OEL, typename VL, typename D, typename VP, typename EP, \ - typename GP, typename EL -#define ADJLIST adjacency_list template struct graph_mutability_traits { typedef mutable_property_graph_tag category; diff --git a/3party/boost/boost/graph/adjacency_matrix.hpp b/3party/boost/boost/graph/adjacency_matrix.hpp index e841333b0f..6fb1f48651 100644 --- a/3party/boost/boost/graph/adjacency_matrix.hpp +++ b/3party/boost/boost/graph/adjacency_matrix.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -80,36 +80,36 @@ namespace boost { } - + // NOTE: These functions collide with the get_property function for + // accessing bundled graph properties. Be excplicit when using them. template const EdgeProperty& - get_property(const std::pair& stored_edge) { + get_edge_property(const std::pair& stored_edge) { return stored_edge.second; } template EdgeProperty& - get_property(std::pair& stored_edge) { + get_edge_property(std::pair& stored_edge) { return stored_edge.second; } template inline void - set_property(std::pair& stored_edge, - const EdgeProperty& ep, int) { + set_edge_property(std::pair& stored_edge, + const EdgeProperty& ep, int) { stored_edge.second = ep; } - inline const no_property& get_property(const char&) { + inline const no_property& get_edge_property(const char&) { static no_property s_prop; return s_prop; } - inline no_property& get_property(char&) { + inline no_property& get_edge_property(char&) { static no_property s_prop; return s_prop; } template - inline void - set_property(EdgeProxy, const EdgeProperty&, ...) {} + inline void set_edge_property(EdgeProxy, const EdgeProperty&, ...) {} //======================================================================= // Directed Out Edge Iterator @@ -155,8 +155,9 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, - &get_property(*this->base())); + return EdgeDescriptor(get_edge_exists(*this->base(), 0), + m_src, m_targ, + &get_edge_property(*this->base())); } VertexDescriptor m_src, m_targ; VerticesSizeType m_n; @@ -211,8 +212,9 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, - &get_property(*this->base())); + return EdgeDescriptor(get_edge_exists(*this->base(), 0), + m_src, m_targ, + &get_edge_property(*this->base())); } MatrixIter m_last; VertexDescriptor m_src, m_targ; @@ -276,10 +278,9 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor( - get_edge_exists(*this->base(), 0), m_src, m_targ - , &get_property(*this->base()) - ); + return EdgeDescriptor(get_edge_exists(*this->base(), 0), + m_src, m_targ, + &get_edge_property(*this->base())); } VertexDescriptor m_src, m_inc, m_targ; @@ -343,10 +344,9 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor( - get_edge_exists(*this->base(), 0), m_targ, m_src - , &get_property(*this->base()) - ); + return EdgeDescriptor(get_edge_exists(*this->base(), 0), + m_targ, m_src, + &get_edge_property(*this->base())); } VertexDescriptor m_src, m_inc, m_targ; @@ -418,10 +418,9 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor( - get_edge_exists( - *this->base(), 0), m_src, m_targ, &get_property(*this->base()) - ); + return EdgeDescriptor(get_edge_exists(*this->base(), 0), + m_src, m_targ, + &get_edge_property(*this->base())); } MatrixIter m_start; @@ -485,34 +484,25 @@ namespace boost { BOOST_STATIC_ASSERT(!(is_same::value)); #endif -#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - typedef typename detail::retag_property_list::type - vertex_property_type; - typedef typename detail::retag_property_list::type - edge_property_type; +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) + typedef typename graph_detail::graph_prop::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; - private: - typedef typename detail::retag_property_list::retagged - maybe_vertex_bundled; + typedef typename graph_detail::vertex_prop::property vertex_property_type; + typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - typedef typename detail::retag_property_list::retagged - maybe_edge_bundled; - - public: - // The types that are actually bundled - typedef typename mpl::if_c<(is_same::value), - no_vertex_bundle, - maybe_vertex_bundled>::type vertex_bundled; - typedef typename mpl::if_c<(is_same::value), - no_edge_bundle, - maybe_edge_bundled>::type edge_bundled; + typedef typename graph_detail::edge_prop::property edge_property_type; + typedef typename graph_detail::edge_prop::bundle edge_bundled; #else - typedef EdgeProperty edge_property_type; - typedef VertexProperty vertex_property_type; + typedef GraphProperty graph_property_type; + typedef no_graph_bundle graph_bundled; + + typedef VertexProperty vertex_property_type; typedef no_vertex_bundle vertex_bundled; - typedef no_edge_bundle edge_bundled; + + typedef EdgeProperty edge_property_type; + typedef no_edge_bundle edge_bundled; #endif - typedef GraphProperty graph_property_type; public: // should be private typedef typename mpl::if_::type, @@ -660,6 +650,12 @@ namespace boost { const edge_bundled& operator[](edge_descriptor e) const { return get(edge_bundle, *this)[e]; } + + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + const graph_bundled& operator[](graph_bundle_t) const + { return get_property(*this); } #endif //private: if friends worked, these would be private @@ -689,7 +685,7 @@ namespace boost { VertexList m_vertex_set; std::vector m_vertex_properties; size_type m_num_edges; - GraphProperty m_property; + graph_property_type m_property; }; //========================================================================= @@ -704,7 +700,7 @@ namespace boost { { bool exists = detail::get_edge_exists(g.get_edge(u,v), 0); typename adjacency_matrix::edge_descriptor - e(exists, u, v, &detail::get_property(g.get_edge(u,v))); + e(exists, u, v, &detail::get_edge_property(g.get_edge(u,v))); return std::make_pair(e, exists); } @@ -937,14 +933,14 @@ namespace boost { edge_descriptor; if (detail::get_edge_exists(g.get_edge(u,v), 0) == false) { ++(g.m_num_edges); - detail::set_property(g.get_edge(u,v), EP(ep), 0); + detail::set_edge_property(g.get_edge(u,v), EP(ep), 0); detail::set_edge_exists(g.get_edge(u,v), true, 0); return std::make_pair - (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), + (edge_descriptor(true, u, v, &detail::get_edge_property(g.get_edge(u,v))), true); } else return std::make_pair - (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), + (edge_descriptor(true, u, v, &detail::get_edge_property(g.get_edge(u,v))), false); } // O(1) @@ -1050,8 +1046,7 @@ namespace boost { template - inline - typename graph_property, Tag>::type& + inline typename graph_property, Tag>::type& get_property(adjacency_matrix& g, Tag) { return get_property_value(g.m_property, Tag()); @@ -1059,9 +1054,7 @@ namespace boost { template - inline - const - typename graph_property, Tag>::type& + inline const typename graph_property, Tag>::type& get_property(const adjacency_matrix& g, Tag) { return get_property_value(g.m_property, Tag()); diff --git a/3party/boost/boost/graph/buffer_concepts.hpp b/3party/boost/boost/graph/buffer_concepts.hpp new file mode 100644 index 0000000000..2bad8af35d --- /dev/null +++ b/3party/boost/boost/graph/buffer_concepts.hpp @@ -0,0 +1,91 @@ +// Copyright Daniel Trebbien 2010. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or the copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GRAPH_BUFFER_CONCEPTS_HPP +#define BOOST_GRAPH_BUFFER_CONCEPTS_HPP 1 +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + BOOST_concept(Buffer, (B)) + { + typedef typename B::value_type value_type; + typedef typename B::size_type size_type; + + BOOST_CONCEPT_USAGE(Buffer) { + typedef typename boost::add_reference::type reference; + + BOOST_CONCEPT_ASSERT((Assignable)); + + buf.push(g_ct); + buf.pop(); + reference t = buf.top(); + boost::ignore_unused_variable_warning(t); + } + + void const_constraints(const B& cbuf) { + typedef typename boost::add_const::type>::type& const_reference; + + const_reference ct = cbuf.top(); + s = cbuf.size(); + if (cbuf.empty()) + dummy = __LINE__; + } + + int dummy; + + static const value_type g_ct; + size_type s; + B buf; + }; + + BOOST_concept(UpdatableQueue, (Q)) + : Buffer + { + BOOST_CONCEPT_USAGE(UpdatableQueue) { + q.update(g_ct); + } + + void const_constraints(const Q& cq) { + if (cq.contains(g_ct)) + dummy = __LINE__; + } + + int dummy; + + static const typename Buffer::value_type g_ct; + Q q; + }; + + BOOST_concept(KeyedUpdatableQueue, (Q)) + : UpdatableQueue + { + typedef typename Q::key_type key_type; + typedef typename Q::key_map key_map; + + BOOST_CONCEPT_USAGE(KeyedUpdatableQueue) { + BOOST_CONCEPT_ASSERT((boost::ReadWritePropertyMapConcept::value_type>)); + } + + void const_constraints(const Q& cq) { + km = cq.keys(); + k = get(km, g_ct); + } + + static const typename Buffer::value_type g_ct; + key_type k; + key_map km; + Q q; + }; + +} // end `namespace boost` + +#endif // !BOOST_GRAPH_BUFFER_CONCEPTS_HPP diff --git a/3party/boost/boost/graph/compressed_sparse_row_graph.hpp b/3party/boost/boost/graph/compressed_sparse_row_graph.hpp index 58ef87ee31..9b5a4d52ce 100644 --- a/3party/boost/boost/graph/compressed_sparse_row_graph.hpp +++ b/3party/boost/boost/graph/compressed_sparse_row_graph.hpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -170,7 +171,7 @@ namespace detail { * Vertex and EdgeIndex should be unsigned integral types and should * specialize numeric_limits. */ -template::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; typedef detail::compressed_sparse_row_structure forward_type; public: /* At this time, the compressed sparse row graph can only be used to - * create directed and bidirectional graphs. In the future, + * create directed and bidirectional graphs. In the future, * undirected CSR graphs will also be supported. */ // BOOST_STATIC_ASSERT((is_same::value)); @@ -623,7 +625,7 @@ class compressed_sparse_row_graph(), global_to_local); } - template void add_edges_sorted_internal_global( @@ -637,7 +639,7 @@ class compressed_sparse_row_graph inline void - add_edges_internal(InputIterator first, InputIterator last, + add_edges_internal(InputIterator first, InputIterator last, const GlobalToLocal& global_to_local) { typedef compressed_sparse_row_graph Graph; typedef typename boost::graph_traits::vertex_descriptor vertex_t; @@ -711,6 +713,13 @@ class compressed_sparse_row_graph::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; + // typedef GraphProperty graph_property_type; typedef detail::compressed_sparse_row_structure forward_type; typedef EdgeIndex /* typename boost::mpl::if_c, boost::no_property, EdgeIndex> */ backward_edge_property; @@ -990,7 +1001,7 @@ class compressed_sparse_row_graph(), global_to_local); } - template void add_edges_sorted_internal_global( @@ -1004,7 +1015,7 @@ class compressed_sparse_row_graph inline void - add_edges_internal(InputIterator first, InputIterator last, + add_edges_internal(InputIterator first, InputIterator last, const GlobalToLocal& global_to_local) { typedef compressed_sparse_row_graph Graph; typedef typename boost::graph_traits::vertex_descriptor vertex_t; @@ -1098,7 +1109,7 @@ add_vertex(BOOST_CSR_GRAPH_TYPE& g) { template inline Vertex -add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g, +add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g, typename BOOST_DIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); @@ -1108,7 +1119,7 @@ add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g, template inline Vertex -add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g, +add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g, typename BOOST_BIDIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); @@ -1160,7 +1171,7 @@ add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_ EPIterOrig ep_iter_sorted, const GlobalToLocal& global_to_local, BOOST_DIR_CSR_GRAPH_TYPE& g) { - g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted, + g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted, global_to_local); } @@ -1180,7 +1191,7 @@ add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_ template inline void - add_edges_global(InputIterator first, InputIterator last, + add_edges_global(InputIterator first, InputIterator last, const GlobalToLocal& global_to_local, BOOST_DIR_CSR_GRAPH_TYPE& g) { g.add_edges_internal(first, last, global_to_local); } @@ -1303,7 +1314,7 @@ adjacent_vertices(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) // Extra, common functions template inline typename graph_traits::vertex_descriptor -vertex(typename graph_traits::vertex_descriptor i, +vertex(typename graph_traits::vertex_descriptor i, const BOOST_CSR_GRAPH_TYPE&) { return i; diff --git a/3party/boost/boost/graph/copy.hpp b/3party/boost/boost/graph/copy.hpp index 402e75f246..8ef01238c5 100644 --- a/3party/boost/boost/graph/copy.hpp +++ b/3party/boost/boost/graph/copy.hpp @@ -350,15 +350,28 @@ namespace boost { : g_out(graph), orig2copy(c), copy_vertex(cv), copy_edge(ce) { } template - void examine_vertex(Vertex u, const Graph& g_in) const { + typename graph_traits::vertex_descriptor copy_one_vertex(Vertex u) const { typename graph_traits::vertex_descriptor new_u = add_vertex(g_out); put(orig2copy, u, new_u); copy_vertex(u, new_u); + return new_u; } template - void examine_edge(Edge e, const Graph& g_in) const { + void tree_edge(Edge e, const Graph& g_in) const { + // For a tree edge, the target vertex has not been copied yet. + typename graph_traits::edge_descriptor new_e; + bool inserted; + boost::tie(new_e, inserted) = add_edge(get(orig2copy, source(e, g_in)), + this->copy_one_vertex(target(e, g_in)), + g_out); + copy_edge(e, new_e); + } + + template + void non_tree_edge(Edge e, const Graph& g_in) const { + // For a non-tree edge, the target vertex has already been copied. typename graph_traits::edge_descriptor new_e; bool inserted; boost::tie(new_e, inserted) = add_edge(get(orig2copy, source(e, g_in)), @@ -387,8 +400,10 @@ namespace boost { { graph_copy_visitor vis(g_out, orig2copy, copy_vertex, copy_edge); + typename graph_traits::vertex_descriptor src_copy + = vis.copy_one_vertex(src); breadth_first_search(g_in, src, params.visitor(vis)); - return get(orig2copy, src); + return src_copy; } } // namespace detail diff --git a/3party/boost/boost/graph/detail/adjacency_list.hpp b/3party/boost/boost/graph/detail/adjacency_list.hpp index 1bd98cd926..0cbf5f4e9c 100644 --- a/3party/boost/boost/graph/detail/adjacency_list.hpp +++ b/3party/boost/boost/graph/detail/adjacency_list.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -993,10 +993,19 @@ namespace boost { typename Config::OutEdgeList& el = g.out_edge_list(u); typename Config::OutEdgeList::iterator ei = el.begin(), ei_end = el.end(); - for (; ei != ei_end; ++ei) { - detail::erase_from_incidence_list - (g.out_edge_list((*ei).get_target()), u, Cat()); - g.m_edges.erase((*ei).get_iter()); + for (; ei != ei_end; /* Increment below */ ) { + bool is_self_loop = (*ei).get_target() == u; + // Don't erase from our own incidence list in the case of a self-loop + // since we're clearing it anyway. + if (!is_self_loop) { + detail::erase_from_incidence_list + (g.out_edge_list((*ei).get_target()), u, Cat()); + typename Config::OutEdgeList::iterator ei_copy = ei; + ++ei; + if (!is_self_loop) g.m_edges.erase((*ei_copy).get_iter()); + } else { + ++ei; + } } g.out_edge_list(u).clear(); } @@ -1505,51 +1514,6 @@ namespace boost { typedef typename Config::global_edgelist_selector global_edgelist_selector; - - // protected: - - // The edge_dispatch() functions should be static, but - // Borland gets confused about constness. - - // O(E/V) - inline std::pair - edge_dispatch(const AdjList& g, - vertex_descriptor u, vertex_descriptor v, - boost::allow_parallel_edge_tag) const - { - bool found; - const typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::const_iterator - i = std::find_if(el.begin(), el.end(), - detail::target_is(v)); - found = (i != g.out_edge_list(u).end()); - if (found) - return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), - true); - else - return std::make_pair(edge_descriptor(u, v, 0), false); - } - // O(log(E/V)) - inline std::pair - edge_dispatch(const AdjList& g, - vertex_descriptor u, vertex_descriptor v, - boost::disallow_parallel_edge_tag) const - { - bool found; - /* According to the standard, this should be iterator, not const_iterator, - but the VC++ std::set::find() const returns const_iterator. - And since iterator should be convertible to const_iterator, the - following should work everywhere. -Jeremy */ - typename Config::OutEdgeList::const_iterator - i = g.out_edge_list(u).find(StoredEdge(v)), - end = g.out_edge_list(u).end(); - found = (i != end); - if (found) - return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), - true); - else - return std::make_pair(edge_descriptor(u, v, 0), false); - } }; template @@ -1630,9 +1594,16 @@ namespace boost { const adj_list_helper& g_) { typedef typename Config::graph_type Graph; - typedef typename Config::edge_parallel_category Cat; - const Graph& g = static_cast(g_); - return g_.edge_dispatch(g, u, v, Cat()); + typedef typename Config::StoredEdge StoredEdge; + const Graph& cg = static_cast(g_); + typedef typename Config::out_edge_iterator out_edge_iterator; + const typename Config::OutEdgeList& el = cg.out_edge_list(u); + typename Config::OutEdgeList::const_iterator it = graph_detail:: + find(el, StoredEdge(v)); + return std::make_pair( + typename Config::edge_descriptor + (u, v, (it == el.end() ? 0 : &(*it).get_property())), + (it != el.end())); } template diff --git a/3party/boost/boost/graph/detail/d_ary_heap.hpp b/3party/boost/boost/graph/detail/d_ary_heap.hpp index 2ec716d3af..c3b3ef7fd5 100644 --- a/3party/boost/boost/graph/detail/d_ary_heap.hpp +++ b/3party/boost/boost/graph/detail/d_ary_heap.hpp @@ -92,6 +92,8 @@ namespace boost { public: typedef typename Container::size_type size_type; typedef Value value_type; + typedef typename boost::property_traits::value_type key_type; + typedef DistanceMap key_map; d_ary_heap_indirect(DistanceMap distance, IndexInHeapPropertyMap index_in_heap, @@ -164,6 +166,10 @@ namespace boost { verify_heap(); } + DistanceMap keys() const { + return distance; + } + private: Compare compare; Container data; diff --git a/3party/boost/boost/graph/directed_graph.hpp b/3party/boost/boost/graph/directed_graph.hpp index ceb3d6e353..992546d46c 100644 --- a/3party/boost/boost/graph/directed_graph.hpp +++ b/3party/boost/boost/graph/directed_graph.hpp @@ -33,9 +33,13 @@ template < class directed_graph { public: - typedef typename graph_detail::vertex_prop::type vertex_property_type; + typedef typename graph_detail::graph_prop::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; + + typedef typename graph_detail::vertex_prop::property vertex_property_type; typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - typedef typename graph_detail::edge_prop::type edge_property_type; + + typedef typename graph_detail::edge_prop::property edge_property_type; typedef typename graph_detail::edge_prop::bundle edge_bundled; private: @@ -58,9 +62,6 @@ private: typedef typename graph_type::directed_selector directed_selector; public: - typedef directed_graph_tag graph_tag; - typedef typename graph_type::graph_property_type graph_property_type; - // more commonly used graph types typedef typename graph_type::stored_vertex stored_vertex; typedef typename graph_type::vertices_size_type vertices_size_type; @@ -77,6 +78,7 @@ public: typedef typename graph_type::adjacency_iterator adjacency_iterator; // miscellaneous types + typedef directed_graph_tag graph_tag; typedef typename graph_type::directed_category directed_category; typedef typename graph_type::edge_parallel_category edge_parallel_category; typedef typename graph_type::traversal_category traversal_category; @@ -283,6 +285,12 @@ public: edge_bundled const& operator[](edge_descriptor e) const { return m_graph[e]; } + + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + graph_bundled const& operator[](graph_bundle_t) const + { return get_property(*this); } #endif // Graph concepts @@ -345,14 +353,12 @@ private: // IncidenceGraph concepts template inline typename DIRECTED_GRAPH::vertex_descriptor -source(typename DIRECTED_GRAPH::edge_descriptor e, - DIRECTED_GRAPH const& g) +source(typename DIRECTED_GRAPH::edge_descriptor e, DIRECTED_GRAPH const& g) { return source(e, g.impl()); } template inline typename DIRECTED_GRAPH::vertex_descriptor -target(typename DIRECTED_GRAPH::edge_descriptor e, - DIRECTED_GRAPH const& g) +target(typename DIRECTED_GRAPH::edge_descriptor e, DIRECTED_GRAPH const& g) { return target(e, g.impl()); } template diff --git a/3party/boost/boost/graph/distributed/adjacency_list.hpp b/3party/boost/boost/graph/distributed/adjacency_list.hpp index d72cddcb97..8c01c535a4 100644 --- a/3party/boost/boost/graph/distributed/adjacency_list.hpp +++ b/3party/boost/boost/graph/distributed/adjacency_list.hpp @@ -1371,6 +1371,7 @@ namespace boost { typedef typename inherited::graph_property_type graph_property_type; typedef typename inherited::vertex_bundled vertex_bundled; typedef typename inherited::edge_bundled edge_bundled; + typedef typename inherited::graph_bundled graph_bundled; typedef typename container_gen::type local_edge_list_type; @@ -1713,6 +1714,12 @@ namespace boost { return base()[e.local]; } + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + graph_bundled const& operator[](graph_bundle_t) const + { return get_property(*this); } + template void save(std::string const& filename) const; diff --git a/3party/boost/boost/graph/distributed/compressed_sparse_row_graph.hpp b/3party/boost/boost/graph/distributed/compressed_sparse_row_graph.hpp index ea41002184..5c1d1bd97f 100644 --- a/3party/boost/boost/graph/distributed/compressed_sparse_row_graph.hpp +++ b/3party/boost/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -129,14 +129,20 @@ class compressed_sparse_row_graph< // ----------------------------------------------------------------- // Workarounds + // NOTE: This graph type does not have old-style graph properties. It only + // accepts bundles. typedef no_property vertex_property_type; typedef no_property edge_property_type; + typedef no_property graph_property_type; typedef typename mpl::if_, void****, VertexProperty>::type vertex_bundled; typedef typename mpl::if_, void****, EdgeProperty>::type edge_bundled; + typedef typename mpl::if_, + void****, + GraphProperty>::type graph_bundled; // ----------------------------------------------------------------- // Useful types diff --git a/3party/boost/boost/graph/edge_list.hpp b/3party/boost/boost/graph/edge_list.hpp index 32c5c25964..5f0265efa7 100644 --- a/3party/boost/boost/graph/edge_list.hpp +++ b/3party/boost/boost/graph/edge_list.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -37,7 +37,7 @@ namespace boost { // If the iterators are random access, then Graph::edge_descriptor // is of Integral type, otherwise it is a struct, though it is // convertible to an Integral type. - // + // struct edge_list_tag { }; @@ -129,7 +129,7 @@ namespace boost { typedef type const_type; }; }; - template <> + template <> struct edge_property_selector { typedef edge_list_edge_property_selector type; }; @@ -137,7 +137,7 @@ namespace boost { template typename property_map< edge_list_impl, edge_index_t>::type get(edge_index_t, const edge_list_impl&) { - typedef typename property_map< edge_list_impl, + typedef typename property_map< edge_list_impl, edge_index_t>::type EdgeIndexMap; return EdgeIndexMap(); } @@ -180,7 +180,7 @@ namespace boost { const G& g = static_cast(g_); typedef typename edge_list_impl_ra::edge_iterator edge_iterator; return std::make_pair(edge_iterator(0), edge_iterator(g._last - g._first)); - } + } template typename edge_list_impl_ra::vertex_descriptor source(typename edge_list_impl_ra::edge_descriptor e, @@ -217,22 +217,22 @@ namespace boost { typedef type const_type; }; }; - template <> + template <> struct edge_property_selector { typedef edge_list_ra_edge_property_selector type; }; template - inline + inline typename property_map< edge_list_impl_ra, edge_index_t>::type get(edge_index_t, const edge_list_impl_ra&) { - typedef typename property_map< edge_list_impl_ra, + typedef typename property_map< edge_list_impl_ra, edge_index_t>::type EdgeIndexMap; return EdgeIndexMap(); } template inline D - get(edge_index_t, const edge_list_impl_ra&, + get(edge_index_t, const edge_list_impl_ra&, typename edge_list_impl_ra::edge_descriptor e) { return e; } @@ -241,31 +241,31 @@ namespace boost { // Some helper classes for determining if the iterators are random access template struct is_random { - enum { RET = false }; - typedef mpl::false_ type; + enum { RET = false }; + typedef mpl::false_ type; }; template <> - struct is_random { - enum { RET = true }; typedef mpl::true_ type; + struct is_random { + enum { RET = true }; typedef mpl::true_ type; }; // The edge_list class conditionally inherits from one of the // above two classes. - template ::value_type, class D = typename std::iterator_traits::difference_type, class Cat = typename std::iterator_traits::iterator_category> #else class T, - class D, + class D, class Cat> #endif class edge_list : public mpl::if_< typename is_random::type, edge_list_impl_ra< edge_list, EdgeIter,T,D>, - edge_list_impl< edge_list, EdgeIter,T,D> + edge_list_impl< edge_list, EdgeIter,T,D> >::type { public: @@ -275,12 +275,12 @@ namespace boost { typedef std::size_t edges_size_type; typedef std::size_t vertices_size_type; typedef std::size_t degree_size_type; - edge_list(EdgeIter first, EdgeIter last) : _first(first), _last(last) { + edge_list(EdgeIter first, EdgeIter last) : _first(first), _last(last) { m_num_edges = std::distance(first, last); } edge_list(EdgeIter first, EdgeIter last, edges_size_type E) - : _first(first), _last(last), m_num_edges(E) { } - + : _first(first), _last(last), m_num_edges(E) { } + EdgeIter _first, _last; edges_size_type m_num_edges; }; @@ -298,7 +298,7 @@ namespace boost { return edge_list(first, last); } #endif - + } /* namespace boost */ #endif /* BOOST_GRAPH_EDGE_LIST_HPP */ diff --git a/3party/boost/boost/graph/graph_concepts.hpp b/3party/boost/boost/graph/graph_concepts.hpp index 4cf5e63d80..7c2b2795b9 100644 --- a/3party/boost/boost/graph/graph_concepts.hpp +++ b/3party/boost/boost/graph/graph_concepts.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -493,28 +494,6 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); Graph g; }; - // This needs to move out of the graph library - BOOST_concept(Buffer,(B)) - { - BOOST_CONCEPT_USAGE(Buffer) { - b.push(t); - b.pop(); - typename B::value_type& v = b.top(); - const_constraints(b); - ignore_unused_variable_warning(v); - } - void const_constraints(const B& cb) { - const typename B::value_type& v = cb.top(); - n = cb.size(); - bool e = cb.empty(); - ignore_unused_variable_warning(v); - ignore_unused_variable_warning(e); - } - typename B::size_type n; - typename B::value_type t; - B b; - }; - BOOST_concept(ColorValue,(C)) : EqualityComparable , DefaultConstructible @@ -614,7 +593,6 @@ using boost::concepts::VertexIndexGraphConcept; using boost::concepts::EdgeIndexGraphConcept; // Utility concepts -using boost::concepts::BufferConcept; using boost::concepts::ColorValueConcept; using boost::concepts::BasicMatrixConcept; using boost::concepts::NumericValueConcept; diff --git a/3party/boost/boost/graph/graph_traits.hpp b/3party/boost/boost/graph/graph_traits.hpp index 3664daed2f..fd1b0415c8 100644 --- a/3party/boost/boost/graph/graph_traits.hpp +++ b/3party/boost/boost/graph/graph_traits.hpp @@ -217,31 +217,37 @@ namespace boost { //?? not the right place ?? Lee typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; + template + struct graph_property_type { + typedef typename G::graph_property_type type; + }; template struct edge_property_type { - typedef typename G::edge_property_type type; + typedef typename G::edge_property_type type; }; template struct vertex_property_type { - typedef typename G::vertex_property_type type; - }; - template - struct graph_property_type { - typedef typename G::graph_property_type type; + typedef typename G::vertex_property_type type; }; struct no_bundle { }; + struct no_graph_bundle : no_bundle { }; struct no_vertex_bundle : no_bundle { }; struct no_edge_bundle : no_bundle { }; + template + struct graph_bundle_type { + typedef typename G::graph_bundled type; + }; + template struct vertex_bundle_type { - typedef typename G::vertex_bundled type; + typedef typename G::vertex_bundled type; }; template struct edge_bundle_type { - typedef typename G::edge_bundled type; + typedef typename G::edge_bundled type; }; namespace graph { namespace detail { @@ -258,12 +264,11 @@ namespace boost { } } // namespace graph::detail namespace graph_detail { - // A helper metafunction for determining whether or not a type is - // bundled. - template - struct is_no_bundle - : mpl::bool_::value> - { }; + // A helper metafunction for determining whether or not a type is + // bundled. + template + struct is_no_bundle : mpl::bool_::value> + { }; } // namespace graph_detail /** @name Graph Property Traits @@ -272,24 +277,43 @@ namespace boost { * edges. */ //@{ + template + struct has_graph_property + : mpl::not_< + typename detail::is_no_property< + typename graph_property_type::type + >::type + >::type + { }; + + template + struct has_bundled_graph_property + : mpl::not_< + graph_detail::is_no_bundle::type> + > + { }; + template struct has_vertex_property : mpl::not_< typename detail::is_no_property::type> >::type { }; - template - struct has_edge_property - : mpl::not_< - typename detail::is_no_property::type> - >::type - { }; + template struct has_bundled_vertex_property : mpl::not_< graph_detail::is_no_bundle::type> > { }; + + template + struct has_edge_property + : mpl::not_< + typename detail::is_no_property::type> + >::type + { }; + template struct has_bundled_edge_property : mpl::not_< diff --git a/3party/boost/boost/graph/labeled_graph.hpp b/3party/boost/boost/graph/labeled_graph.hpp index 51743a4abe..e1a2f7c2d7 100644 --- a/3party/boost/boost/graph/labeled_graph.hpp +++ b/3party/boost/boost/graph/labeled_graph.hpp @@ -278,10 +278,13 @@ public: typedef typename graph_traits::edge_iterator edge_iterator; typedef typename graph_traits::edges_size_type edges_size_type; - typedef typename graph_type::vertex_property_type vertex_property_type; - typedef typename graph_type::edge_property_type edge_property_type; typedef typename graph_type::graph_property_type graph_property_type; + typedef typename graph_type::graph_bundled graph_bundled; + + typedef typename graph_type::vertex_property_type vertex_property_type; typedef typename graph_type::vertex_bundled vertex_bundled; + + typedef typename graph_type::edge_property_type edge_property_type; typedef typename graph_type::edge_bundled edge_bundled; typedef typename Base::label_type label_type; diff --git a/3party/boost/boost/graph/named_function_params.hpp b/3party/boost/boost/graph/named_function_params.hpp index d3be9f22c4..e08c5c4c5f 100644 --- a/3party/boost/boost/graph/named_function_params.hpp +++ b/3party/boost/boost/graph/named_function_params.hpp @@ -10,19 +10,23 @@ #ifndef BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP #define BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP -#include +#include +#include #include #include #include #include #include #include -#include +#include +#include #include #include namespace boost { + struct parity_map_t { }; + struct vertex_assignment_map_t { }; struct distance_compare_t { }; struct distance_combine_t { }; struct distance_inf_t { }; @@ -51,6 +55,8 @@ namespace boost { struct learning_constant_range_t { }; struct vertices_equivalent_t { }; struct edges_equivalent_t { }; + struct index_in_heap_map_t { }; + struct max_priority_queue_t { }; #define BOOST_BGL_DECLARE_NAMED_PARAMS \ BOOST_BGL_ONE_PARAM_CREF(weight_map, edge_weight) \ @@ -62,6 +68,7 @@ namespace boost { BOOST_BGL_ONE_PARAM_CREF(root_vertex, root_vertex) \ BOOST_BGL_ONE_PARAM_CREF(edge_centrality_map, edge_centrality) \ BOOST_BGL_ONE_PARAM_CREF(centrality_map, vertex_centrality) \ + BOOST_BGL_ONE_PARAM_CREF(parity_map, parity_map) \ BOOST_BGL_ONE_PARAM_CREF(color_map, vertex_color) \ BOOST_BGL_ONE_PARAM_CREF(edge_color_map, edge_color) \ BOOST_BGL_ONE_PARAM_CREF(capacity_map, edge_capacity) \ @@ -72,6 +79,7 @@ namespace boost { BOOST_BGL_ONE_PARAM_CREF(vertex_index_map, vertex_index) \ BOOST_BGL_ONE_PARAM_CREF(vertex_index1_map, vertex_index1) \ BOOST_BGL_ONE_PARAM_CREF(vertex_index2_map, vertex_index2) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_assignment_map, vertex_assignment_map) \ BOOST_BGL_ONE_PARAM_CREF(visitor, graph_visitor) \ BOOST_BGL_ONE_PARAM_CREF(distance_compare, distance_compare) \ BOOST_BGL_ONE_PARAM_CREF(distance_combine, distance_combine) \ @@ -98,7 +106,9 @@ namespace boost { BOOST_BGL_ONE_PARAM_CREF(diameter_range, diameter_range) \ BOOST_BGL_ONE_PARAM_CREF(learning_constant_range, learning_constant_range) \ BOOST_BGL_ONE_PARAM_CREF(vertices_equivalent, vertices_equivalent) \ - BOOST_BGL_ONE_PARAM_CREF(edges_equivalent, edges_equivalent) + BOOST_BGL_ONE_PARAM_CREF(edges_equivalent, edges_equivalent) \ + BOOST_BGL_ONE_PARAM_CREF(index_in_heap_map, index_in_heap_map) \ + BOOST_BGL_ONE_PARAM_REF(max_priority_queue, max_priority_queue) template struct bgl_named_params : public Base @@ -382,8 +392,8 @@ BOOST_BGL_DECLARE_NAMED_PARAMS template struct override_const_property_t { - typedef ArgType result_type; - result_type operator()(const Graph&, const typename boost::add_reference::type a) const {return a;} + typedef typename boost::remove_const::type result_type; + result_type operator()(const Graph&, const ArgType& a) const {return a;} }; template @@ -541,7 +551,68 @@ BOOST_BGL_DECLARE_NAMED_PARAMS boost::graph::keywords::tag::color_map, default_color_type> make_color_map_from_arg_pack(white_color); - } + + template + struct priority_queue_maker_helper { + typedef Q priority_queue_type; + + static priority_queue_type + make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + return q; + } + }; + + template + struct priority_queue_maker_helper { + typedef typename std::vector::size_type default_index_in_heap_type; + typedef typename map_maker::helper::map_type index_in_heap_map; + typedef boost::d_ary_heap_indirect::helper::map_type, Compare> priority_queue_type; + + static priority_queue_type + make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q& q) { + return priority_queue_type( + map_maker::make_map(g, ap, defaultKey), + map_maker::make_map(g, ap, typename boost::property_traits::value_type(-1)) + ); + } + }; + + template + struct priority_queue_maker { + BOOST_STATIC_CONSTANT( + bool, + g_hasQ = + (parameter_exists + ::value)); + typedef priority_queue_maker_helper + >::type::type + >::type> helper; + typedef typename helper::priority_queue_type priority_queue_type; + + static priority_queue_type make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey) { + return helper::make_queue(g, ap, defaultKey, ap[::boost::parameter::keyword::instance | 0]); + } + }; + + template , class KeyMapTag = boost::graph::keywords::tag::distance_map, class IndexInHeapMapTag = boost::graph::keywords::tag::index_in_heap_map> + struct make_priority_queue_from_arg_pack_gen { + KeyT defaultKey; + + make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { } + + template + typename priority_queue_maker::priority_queue_type + operator()(const Graph& g, const ArgPack& ap) const { + return priority_queue_maker::make_queue(g, ap, defaultKey); + } + }; + + } // namespace detail } // namespace boost diff --git a/3party/boost/boost/graph/properties.hpp b/3party/boost/boost/graph/properties.hpp index 3245962453..fa8440e93f 100644 --- a/3party/boost/boost/graph/properties.hpp +++ b/3party/boost/boost/graph/properties.hpp @@ -126,6 +126,7 @@ namespace boost { BOOST_DEF_PROPERTY(graph, visitor); // These tags are used for property bundles + BOOST_DEF_PROPERTY(graph, bundle); BOOST_DEF_PROPERTY(vertex, bundle); BOOST_DEF_PROPERTY(edge, bundle); @@ -199,6 +200,7 @@ namespace boost { }; template class vertex_property_map { + public: typedef typename vertex_property_type::type Property; typedef typename graph_tag_or_void::type graph_tag; typedef typename vertex_property_selector::type Selector; @@ -242,7 +244,7 @@ namespace boost { template struct property_map { - private: + // private: typedef typename property_kind::type Kind; typedef typename detail::property_map_kind_selector::type Selector; typedef typename Selector::template bind_ Bind; @@ -263,8 +265,9 @@ namespace boost { template class graph_property { public: - typedef typename property_value::type type; + typedef typename property_value< + typename Graph::graph_property_type, Property + >::type type; }; template @@ -432,44 +435,71 @@ namespace boost { // These metafunctions help implement the process of determining the vertex // and edge properties of a graph. namespace graph_detail { - template + template struct retagged_property { typedef typename Retag::type type; }; - template + // Search the normalized PropList (as returned by retagged<>::type) for + // the given bundle. Return the type error if no such bundle can be found. + template struct retagged_bundle { - typedef typename mpl::if_< - is_same, - Without, - With - >::type type; + typedef typename property_value::type Value; + typedef typename mpl::if_< + is_same, no_bundle, Value + >::type type; }; - template - struct vertex_prop { - private: - typedef detail::retag_property_list Retag; + template + class normal_property { + // Normalize the property into a property list. + typedef detail::retag_property_list List; public: - typedef typename retagged_property::type type; - typedef typename retagged_bundle< - Retag, Prop, no_vertex_bundle - >::type bundle; + // Extract the normalized property and bundle types. + typedef typename retagged_property::type property; + typedef typename retagged_bundle::type bundle; }; - template - struct edge_prop { -// private: - typedef detail::retag_property_list Retag; - public: - typedef typename Retag::retagged retagged; - typedef typename retagged_property::type type; - typedef typename retagged_bundle< - Retag, Prop, no_edge_bundle - >::type bundle; - }; + template + struct graph_prop : normal_property + { }; + + template + struct vertex_prop : normal_property + { }; + + template + struct edge_prop : normal_property + { }; } // namespace graph_detail +// NOTE: These functions are declared, but never defined since they need to +// be overloaded by graph implementations. However, we need them to be +// declared for the functions below. +template +typename graph_property::type& +get_property(Graph& g, Tag); + +template +typename graph_property::type const& +get_property(Graph const& g, Tag); + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +// NOTE: This operation is a simple adaptor over the overloaded get_property +// operations. +template +inline typename graph_property::type& +get_property(Graph& g) { + return get_property(g, graph_bundle); +} + +template +inline typename graph_property::type const& +get_property(Graph const& g) { + return get_property(g, graph_bundle); +} +#endif + } // namespace boost #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) diff --git a/3party/boost/boost/graph/r_c_shortest_paths.hpp b/3party/boost/boost/graph/r_c_shortest_paths.hpp index 37bf3f347c..9d395799ea 100644 --- a/3party/boost/boost/graph/r_c_shortest_paths.hpp +++ b/3party/boost/boost/graph/r_c_shortest_paths.hpp @@ -559,8 +559,10 @@ void r_c_shortest_paths dominance, la, vis ); - pareto_optimal_solution = pareto_optimal_solutions[0]; - pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; + if (!pareto_optimal_solutions.empty()) { + pareto_optimal_solution = pareto_optimal_solutions[0]; + pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; + } } // third overload: @@ -644,8 +646,10 @@ void r_c_shortest_paths dominance, default_r_c_shortest_paths_allocator(), default_r_c_shortest_paths_visitor() ); - pareto_optimal_solution = pareto_optimal_solutions[0]; - pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; + if (!pareto_optimal_solutions.empty()) { + pareto_optimal_solution = pareto_optimal_solutions[0]; + pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; + } } // r_c_shortest_paths diff --git a/3party/boost/boost/graph/random.hpp b/3party/boost/boost/graph/random.hpp index c79c9c68fc..7e1d659694 100644 --- a/3party/boost/boost/graph/random.hpp +++ b/3party/boost/boost/graph/random.hpp @@ -125,6 +125,7 @@ namespace boost { bool self_edges = false) { typedef graph_traits Traits; + typedef typename Traits::edge_descriptor edge_t; typedef typename Traits::vertices_size_type v_size_t; typedef typename Traits::edges_size_type e_size_t; typedef typename Traits::vertex_descriptor vertex_descriptor; @@ -149,12 +150,23 @@ namespace boost { for (v_size_t i = 0; i < V; ++i) add_vertex(g); - for (e_size_t j = 0; j < E; ++j) { + e_size_t not_inserted_counter = 0; /* Number of edge insertion failures */ + e_size_t num_vertices_squared = num_vertices(g) * num_vertices(g); + for (e_size_t j = 0; j < E; /* Increment in body */) { vertex_descriptor a = random_vertex(g, gen), b; do { b = random_vertex(g, gen); } while (self_edges == false && a == b); - add_edge(a, b, g); + edge_t e; bool inserted; + boost::tie(e, inserted) = add_edge(a, b, g); + if (inserted) { + ++j; + } else { + ++not_inserted_counter; + } + if (not_inserted_counter >= num_vertices_squared) { + return; /* Rather than looping forever on complete graph */ + } } } } @@ -191,15 +203,24 @@ namespace boost { for (v_size_t i = 0; i < V; ++i) *vertex_out++ = add_vertex(g); - for (e_size_t j = 0; j < E; ++j) { + e_size_t not_inserted_counter = 0; /* Number of edge insertion failures */ + e_size_t num_vertices_squared = num_vertices(g) * num_vertices(g); + for (e_size_t j = 0; j < E; /* Increment in body */) { vertex_t a = random_vertex(g, gen), b; do { b = random_vertex(g, gen); } while (self_edges == false && a == b); edge_t e; bool inserted; boost::tie(e, inserted) = add_edge(a, b, g); - if (inserted) + if (inserted) { *edge_out++ = std::make_pair(source(e, g), target(e, g)); + ++j; + } else { + ++not_inserted_counter; + } + if (not_inserted_counter >= num_vertices_squared) { + return; /* Rather than looping forever on complete graph */ + } } } diff --git a/3party/boost/boost/graph/read_dimacs.hpp b/3party/boost/boost/graph/read_dimacs.hpp index 0fedbfaed9..b19c81392b 100644 --- a/3party/boost/boost/graph/read_dimacs.hpp +++ b/3party/boost/boost/graph/read_dimacs.hpp @@ -28,19 +28,22 @@ namespace boost { + namespace detail { + template -int read_dimacs_max_flow(Graph& g, - CapacityMap capacity, - ReverseEdgeMap reverse_edge, - typename graph_traits::vertex_descriptor& src, - typename graph_traits::vertex_descriptor& sink, - std::istream& in = std::cin) +int read_dimacs_max_flow_internal(Graph& g, + CapacityMap capacity, + ReverseEdgeMap reverse_edge, + typename graph_traits::vertex_descriptor& src, + typename graph_traits::vertex_descriptor& sink, + std::istream& in, + bool require_source_and_sink, + const std::string& problem_type) { // const int MAXLINE = 100; /* max line length in the input file */ const int ARC_FIELDS = 3; /* no of fields in arc line */ const int NODE_FIELDS = 2; /* no of fields in node line */ const int P_FIELDS = 3; /* no of fields in problem line */ - const char* PROBLEM_TYPE = "max"; /* name of problem type*/ typedef typename graph_traits::vertices_size_type vertices_size_type; typedef typename graph_traits::vertex_descriptor vertex_descriptor; @@ -145,7 +148,7 @@ int read_dimacs_max_flow(Graph& g, /*wrong number of parameters in the problem line*/ { err_no = EN2; goto error; } - if ( std::strcmp ( pr_type, PROBLEM_TYPE ) ) + if ( pr_type != problem_type ) /*wrong problem type*/ { err_no = EN3; goto error; } @@ -203,7 +206,7 @@ int read_dimacs_max_flow(Graph& g, break; case 'a': /* arc description */ - if ( no_nslines == 0 || no_nklines == 0 ) + if ( require_source_and_sink && (no_nslines == 0 || no_nklines == 0) ) /* there was not source and sink description above */ { err_no = EN14; goto error; } @@ -264,7 +267,8 @@ int read_dimacs_max_flow(Graph& g, if ( no_alines < m ) /* not enough arcs */ { err_no = EN19; goto error; } - if ( out_degree(src, g) == 0 || out_degree(sink, g) == 0 ) + if ( require_source_and_sink && + (out_degree(src, g) == 0 || out_degree(sink, g) == 0) ) /* no arc goes out of the source */ { err_no = EN20; goto error; } @@ -282,6 +286,27 @@ int read_dimacs_max_flow(Graph& g, } /* -------------------- end of parser -------------------*/ + } // namespace detail + +template +int read_dimacs_max_flow(Graph& g, + CapacityMap capacity, + ReverseEdgeMap reverse_edge, + typename graph_traits::vertex_descriptor& src, + typename graph_traits::vertex_descriptor& sink, + std::istream& in = std::cin) { + return detail::read_dimacs_max_flow_internal(g, capacity, reverse_edge, src, sink, in, true, "max"); +} + +template +int read_dimacs_min_cut(Graph& g, + CapacityMap capacity, + ReverseEdgeMap reverse_edge, + std::istream& in = std::cin) { + typename graph_traits::vertex_descriptor dummy_src, dummy_sink; // Not filled in + return detail::read_dimacs_max_flow_internal(g, capacity, reverse_edge, dummy_src, dummy_sink, in, false, "cut"); +} + } // namespace boost #endif // BOOST_GRAPH_READ_DIMACS_HPP diff --git a/3party/boost/boost/graph/reverse_graph.hpp b/3party/boost/boost/graph/reverse_graph.hpp index 5669bb9bf0..60de2b0ee7 100644 --- a/3party/boost/boost/graph/reverse_graph.hpp +++ b/3party/boost/boost/graph/reverse_graph.hpp @@ -79,19 +79,33 @@ class reverse_graph { typedef reverse_graph_tag graph_tag; + // Graph, vertex, and edge properties + typedef typename graph_property_type::type graph_property_type; + typedef typename graph_bundle_type::type graph_bundled; + + typedef typename vertex_property_type::type vertex_property_type; + typedef typename vertex_bundle_type::type vertex_bundled; + + typedef typename edge_property_type::type edge_property_type; + typedef typename edge_bundle_type::type edge_bundled; + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Bundled properties support template - typename graph::detail::bundled_result::type& + typename graph::detail::bundled_result::type& operator[](Descriptor x) { return m_g[x]; } template - typename graph::detail::bundled_result::type const& + typename graph::detail::bundled_result::type const& operator[](Descriptor x) const { return m_g[x]; } + + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + graph_bundled const& operator[](graph_bundle_t) const + { return get_property(*this); } #endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES static vertex_descriptor null_vertex() @@ -116,11 +130,11 @@ struct edge_property_type > { #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template - struct vertex_bundle_type > + struct vertex_bundle_type > : vertex_bundle_type { }; template - struct edge_bundle_type > + struct edge_bundle_type > : edge_bundle_type { }; #endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES @@ -194,7 +208,7 @@ vertex(const typename graph_traits::vertices_size_type v, } template -inline std::pair::edge_descriptor, +inline std::pair::edge_descriptor, bool> edge(const typename graph_traits::vertex_descriptor u, const typename graph_traits::vertex_descriptor v, @@ -318,7 +332,7 @@ put(Property p, const reverse_graph& g, const Key& k, template inline void -set_property(const reverse_graph& g, Tag tag, +set_property(const reverse_graph& g, Tag tag, const Value& value) { set_property(g.m_g, tag, value); diff --git a/3party/boost/boost/graph/smallest_last_ordering.hpp b/3party/boost/boost/graph/smallest_last_ordering.hpp index 648efc61e8..210bb532ea 100644 --- a/3party/boost/boost/graph/smallest_last_ordering.hpp +++ b/3party/boost/boost/graph/smallest_last_ordering.hpp @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace boost { @@ -44,7 +45,7 @@ namespace boost { const size_type num = num_vertices(G); - typedef typename boost::detail::vertex_property_map::type ID; + typedef typename boost::property_map::type ID; typedef bucket_sorter BucketSorter; BucketSorter degree_bucket_sorter(num, num, degree, @@ -116,6 +117,23 @@ namespace boost { //at this point, order[i] = v_i; } + template + void + smallest_last_vertex_ordering(const VertexListGraph& G, Order order) { + typedef typename graph_traits::vertex_descriptor vertex_descriptor; + typedef typename graph_traits::degree_size_type degree_size_type; + smallest_last_vertex_ordering(G, order, + make_shared_array_property_map(num_vertices(G), degree_size_type(0), get(vertex_index, G)), + make_shared_array_property_map(num_vertices(G), (std::size_t)(0), get(vertex_index, G))); + } + + template + std::vector::vertex_descriptor> + smallest_last_vertex_ordering(const VertexListGraph& G) { + std::vector::vertex_descriptor> o(num_vertices(G)); + smallest_last_vertex_ordering(G, make_iterator_property_map(o.begin(), typed_identity_property_map())); + return o; + } } #endif diff --git a/3party/boost/boost/graph/stoer_wagner_min_cut.hpp b/3party/boost/boost/graph/stoer_wagner_min_cut.hpp new file mode 100644 index 0000000000..9cd2d0da06 --- /dev/null +++ b/3party/boost/boost/graph/stoer_wagner_min_cut.hpp @@ -0,0 +1,240 @@ +// Copyright Daniel Trebbien 2010. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or the copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GRAPH_STOER_WAGNER_MIN_CUT_HPP +#define BOOST_GRAPH_STOER_WAGNER_MIN_CUT_HPP 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { + + namespace detail { + + /** + * \brief Performs a phase of the Stoer-Wagner min-cut algorithm + * + * Performs a phase of the Stoer-Wagner min-cut algorithm. + * + * As described by Stoer & Wagner (1997), a phase is simply a maximum adjacency search + * (also called a maximum cardinality search), which results in the selection of two vertices + * \em s and \em t, and, as a side product, a minimum s-t cut of + * the input graph. Here, the input graph is basically \p g, but some vertices are virtually + * assigned to others as a way of viewing \p g as a graph with some sets of + * vertices merged together. + * + * This implementation is a translation of pseudocode by Professor Uri Zwick, + * School of Computer Science, Tel Aviv University. + * + * \pre \p g is a connected, undirected graph + * \param[in] g the input graph + * \param[in] assignments a read/write property map from each vertex to the vertex that it is assigned to + * \param[in] assignedVertices a list of vertices that are assigned to others + * \param[in] weights a readable property map from each edge to its weight (a non-negative value) + * \param[out] pq a keyed, updatable max-priority queue + * \returns a tuple (\em s, \em t, \em w) of the "s" and "t" + * of the minimum s-t cut and the cut weight \em w + * of the minimum s-t cut. + * \see http://www.cs.tau.ac.il/~zwick/grad-algo-08/gmc.pdf + * + * \author Daniel Trebbien + * \date 2010-09-11 + */ + template + boost::tuple::vertex_descriptor, typename boost::graph_traits::vertex_descriptor, typename boost::property_traits::value_type> + stoer_wagner_phase(const UndirectedGraph& g, VertexAssignmentMap assignments, const std::set::vertex_descriptor>& assignedVertices, WeightMap weights, KeyedUpdatablePriorityQueue& pq) { + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::property_traits::value_type weight_type; + + assert(pq.empty()); + typename KeyedUpdatablePriorityQueue::key_map keys = pq.keys(); + + BGL_FORALL_VERTICES_T(v, g, UndirectedGraph) { + if (v == get(assignments, v)) { // foreach u \in V do + put(keys, v, weight_type(0)); + + pq.push(v); + } + } + + assert(pq.size() >= 2); + + vertex_descriptor s, t; + weight_type w; + while (!pq.empty()) { // while PQ \neq {} do + const vertex_descriptor u = pq.top(); // u = extractmax(PQ) + w = get(keys, u); + pq.pop(); + + s = t; t = u; + + BGL_FORALL_OUTEDGES_T(u, e, g, UndirectedGraph) { // foreach (u, v) \in E do + const vertex_descriptor v = get(assignments, target(e, g)); + + if (pq.contains(v)) { // if v \in PQ then + put(keys, v, get(keys, v) + get(weights, e)); // increasekey(PQ, v, wA(v) + w(u, v)) + pq.update(v); + } + } + + typename std::set::const_iterator assignedVertexIt, assignedVertexEnd = assignedVertices.end(); + for (assignedVertexIt = assignedVertices.begin(); assignedVertexIt != assignedVertexEnd; ++assignedVertexIt) { + const vertex_descriptor uPrime = *assignedVertexIt; + + if (get(assignments, uPrime) == u) { + BGL_FORALL_OUTEDGES_T(uPrime, e, g, UndirectedGraph) { // foreach (u, v) \in E do + const vertex_descriptor v = get(assignments, target(e, g)); + + if (pq.contains(v)) { // if v \in PQ then + put(keys, v, get(keys, v) + get(weights, e)); // increasekey(PQ, v, wA(v) + w(u, v)) + pq.update(v); + } + } + } + } + } + + return boost::make_tuple(s, t, w); + } + + /** + * \brief Computes a min-cut of the input graph + * + * Computes a min-cut of the input graph using the Stoer-Wagner algorithm. + * + * \pre \p g is a connected, undirected graph + * \pre pq.empty() + * \param[in] g the input graph + * \param[in] weights a readable property map from each edge to its weight (a non-negative value) + * \param[out] parities a writable property map from each vertex to a bool type object for + * distinguishing the two vertex sets of the min-cut + * \param[out] assignments a read/write property map from each vertex to a \c vertex_descriptor object. This + * map serves as work space, and no particular meaning should be derived from property values + * after completion of the algorithm. + * \param[out] pq a keyed, updatable max-priority queue + * \returns the cut weight of the min-cut + * \see http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.114.6687&rep=rep1&type=pdf + * \see http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.31.614&rep=rep1&type=pdf + * + * \author Daniel Trebbien + * \date 2010-09-11 + */ + template + typename boost::property_traits::value_type + stoer_wagner_min_cut(const UndirectedGraph& g, WeightMap weights, ParityMap parities, VertexAssignmentMap assignments, KeyedUpdatablePriorityQueue& pq) { + BOOST_CONCEPT_ASSERT((boost::IncidenceGraphConcept)); + BOOST_CONCEPT_ASSERT((boost::VertexListGraphConcept)); + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits::vertices_size_type vertices_size_type; + typedef typename boost::graph_traits::edge_descriptor edge_descriptor; + BOOST_CONCEPT_ASSERT((boost::Convertible::directed_category, boost::undirected_tag>)); + BOOST_CONCEPT_ASSERT((boost::ReadablePropertyMapConcept)); + typedef typename boost::property_traits::value_type weight_type; + BOOST_CONCEPT_ASSERT((boost::WritablePropertyMapConcept)); + typedef typename boost::property_traits::value_type parity_type; + BOOST_CONCEPT_ASSERT((boost::ReadWritePropertyMapConcept)); + BOOST_CONCEPT_ASSERT((boost::Convertible::value_type>)); + BOOST_CONCEPT_ASSERT((boost::KeyedUpdatableQueueConcept)); + + vertices_size_type n = num_vertices(g); + if (n < 2) + throw boost::bad_graph("the input graph must have at least two vertices."); + else if (!pq.empty()) + throw std::invalid_argument("the max-priority queue must be empty initially."); + + std::set assignedVertices; + + // initialize `assignments` (all vertices are initially assigned to themselves) + BGL_FORALL_VERTICES_T(v, g, UndirectedGraph) { + put(assignments, v, v); + } + + vertex_descriptor s, t; + weight_type bestW; + + boost::tie(s, t, bestW) = boost::detail::stoer_wagner_phase(g, assignments, assignedVertices, weights, pq); + assert(s != t); + BGL_FORALL_VERTICES_T(v, g, UndirectedGraph) { + put(parities, v, parity_type(v == t ? 1 : 0)); + } + put(assignments, t, s); + assignedVertices.insert(t); + --n; + + for (; n >= 2; --n) { + weight_type w; + boost::tie(s, t, w) = boost::detail::stoer_wagner_phase(g, assignments, assignedVertices, weights, pq); + assert(s != t); + + if (w < bestW) { + BGL_FORALL_VERTICES_T(v, g, UndirectedGraph) { + put(parities, v, parity_type(get(assignments, v) == t ? 1 : 0)); + + if (get(assignments, v) == t) // all vertices that were assigned to t are now assigned to s + put(assignments, v, s); + } + + bestW = w; + } else { + BGL_FORALL_VERTICES_T(v, g, UndirectedGraph) { + if (get(assignments, v) == t) // all vertices that were assigned to t are now assigned to s + put(assignments, v, s); + } + } + put(assignments, t, s); + assignedVertices.insert(t); + } + + assert(pq.empty()); + + return bestW; + } + + } // end `namespace detail` within `namespace boost` + + template + inline typename boost::property_traits::value_type + stoer_wagner_min_cut(const UndirectedGraph& g, WeightMap weights, const boost::bgl_named_params& params) { + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef typename std::vector::size_type heap_container_size_type; + typedef typename boost::property_traits::value_type weight_type; + + typedef boost::bgl_named_params params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + + BOOST_AUTO(pq, (boost::detail::make_priority_queue_from_arg_pack_gen >(choose_param(get_param(params, boost::distance_zero_t()), weight_type(0)))(g, arg_pack))); + + return boost::detail::stoer_wagner_min_cut(g, + weights, + choose_param(get_param(params, boost::parity_map_t()), boost::dummy_property_map()), + boost::detail::make_property_map_from_arg_pack_gen(vertex_descriptor())(g, arg_pack), + pq + ); + } + + template + inline typename boost::property_traits::value_type + stoer_wagner_min_cut(const UndirectedGraph& g, WeightMap weights) { + return boost::stoer_wagner_min_cut(g, weights, boost::vertex_index_map(get(boost::vertex_index, g))); + } + +} // end `namespace boost` + +#include + +#endif // !BOOST_GRAPH_STOER_WAGNER_MIN_CUT_HPP diff --git a/3party/boost/boost/graph/subgraph.hpp b/3party/boost/boost/graph/subgraph.hpp index 093da7b03a..33f67a4065 100644 --- a/3party/boost/boost/graph/subgraph.hpp +++ b/3party/boost/boost/graph/subgraph.hpp @@ -677,17 +677,35 @@ remove_edge(typename subgraph::edge_descriptor e, subgraph& g) } } -// TODO: This is wrong... +// This is slow, but there may not be a good way to do it safely otherwise template void -remove_edge_if(Predicate p, subgraph& g) -{ remove_edge_if(p, g.m_graph); } +remove_edge_if(Predicate p, subgraph& g) { + while (true) { + bool any_removed = false; + typedef typename subgraph::edge_iterator ei_type; + for (std::pair ep = edges(g); + ep.first != ep.second; ++ep.first) { + if (p(*ep.first)) { + any_removed = true; + remove_edge(*ep.first, g); + continue; /* Since iterators may be invalidated */ + } + } + if (!any_removed) break; + } +} -// TODO: Ths is wrong template void -clear_vertex(typename subgraph::vertex_descriptor v, subgraph& g) -{ clear_vertex(v, g.m_graph); } +clear_vertex(typename subgraph::vertex_descriptor v, subgraph& g) { + while (true) { + typedef typename subgraph::out_edge_iterator oei_type; + std::pair p = out_edges(v, g); + if (p.first == p.second) break; + remove_edge(*p.first, g); + } +} namespace detail { template @@ -727,10 +745,12 @@ add_vertex(subgraph& g) } +#if 0 // TODO: Under Construction template void remove_vertex(typename subgraph::vertex_descriptor u, subgraph& g) { assert(false); } +#endif //=========================================================================== // Functions required by the PropertyGraph concept diff --git a/3party/boost/boost/graph/undirected_graph.hpp b/3party/boost/boost/graph/undirected_graph.hpp index 6dee3cc521..d5374101e2 100644 --- a/3party/boost/boost/graph/undirected_graph.hpp +++ b/3party/boost/boost/graph/undirected_graph.hpp @@ -33,17 +33,22 @@ struct undirected_graph_tag { }; */ template < typename VertexProp = no_property, - typename EdgeProp= no_property, + typename EdgeProp = no_property, typename GraphProp = no_property> class undirected_graph { public: - typedef typename graph_detail::vertex_prop::type vertex_property_type; + typedef typename graph_detail::graph_prop::property graph_property_type; + typedef typename graph_detail::graph_prop::bundle graph_bundled; + + typedef typename graph_detail::vertex_prop::property vertex_property_type; typedef typename graph_detail::vertex_prop::bundle vertex_bundled; - typedef typename graph_detail::edge_prop::type edge_property_type; + + typedef typename graph_detail::edge_prop::property edge_property_type; typedef typename graph_detail::edge_prop::bundle edge_bundled; private: + // Embed indices into the vertex type. typedef property vertex_property; typedef property edge_property; public: @@ -62,9 +67,6 @@ private: typedef typename graph_type::directed_selector directed_selector; public: - typedef undirected_graph_tag graph_tag; - typedef typename graph_type::graph_property_type graph_property_type; - // more commonly used graph types typedef typename graph_type::stored_vertex stored_vertex; typedef typename graph_type::vertices_size_type vertices_size_type; @@ -81,6 +83,7 @@ public: typedef typename graph_type::adjacency_iterator adjacency_iterator; // miscellaneous types + typedef undirected_graph_tag graph_tag; typedef typename graph_type::directed_category directed_category; typedef typename graph_type::edge_parallel_category edge_parallel_category; typedef typename graph_type::traversal_category traversal_category; @@ -276,6 +279,12 @@ public: edge_bundled const& operator[](edge_descriptor e) const { return m_graph[e]; } + + graph_bundled& operator[](graph_bundle_t) + { return get_property(*this); } + + graph_bundled const& operator[](graph_bundle_t) const + { return get_property(*this); } #endif // Graph concepts diff --git a/3party/boost/boost/graph/vector_as_graph.hpp b/3party/boost/boost/graph/vector_as_graph.hpp index 8ca1b916f8..ee0df4bc90 100644 --- a/3party/boost/boost/graph/vector_as_graph.hpp +++ b/3party/boost/boost/graph/vector_as_graph.hpp @@ -19,8 +19,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -315,14 +315,14 @@ namespace boost { }; template - identity_property_map + identity_property_map get(vertex_index_t, const std::vector&) { return identity_property_map(); } template - identity_property_map + identity_property_map get(vertex_index_t, std::vector&) { return identity_property_map(); diff --git a/3party/boost/boost/integer/integer_mask.hpp b/3party/boost/boost/integer/integer_mask.hpp index 8c4e1bb1c4..2acf7f7dff 100644 --- a/3party/boost/boost/integer/integer_mask.hpp +++ b/3party/boost/boost/integer/integer_mask.hpp @@ -20,6 +20,17 @@ #include // for std::numeric_limits +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer/integer_mask.hpp:93:35: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif namespace boost { @@ -89,6 +100,19 @@ BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int ); BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long ); #endif +#if defined(BOOST_HAS_LONG_LONG) + #if ((defined(ULLONG_MAX) && (ULLONG_MAX > ULONG_MAX)) ||\ + (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX > ULONG_MAX)) ||\ + (defined(ULONGLONG_MAX) && (ULONGLONG_MAX > ULONG_MAX)) ||\ + (defined(_ULLONG_MAX) && (_ULLONG_MAX > ULONG_MAX))) + BOOST_LOW_BITS_MASK_SPECIALIZE( boost::ulong_long_type ); + #endif +#elif defined(BOOST_HAS_MS_INT64) + #if 18446744073709551615ui64 > ULONG_MAX + BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned __int64 ); + #endif +#endif + #ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/3party/boost/boost/integer_fwd.hpp b/3party/boost/boost/integer_fwd.hpp index e6045ca39d..20eff2bcf6 100644 --- a/3party/boost/boost/integer_fwd.hpp +++ b/3party/boost/boost/integer_fwd.hpp @@ -136,22 +136,6 @@ template < std::size_t Bits > template < > struct low_bits_mask_t< ::std::numeric_limits::digits >; -#if USHRT_MAX > UCHAR_MAX -template < > - struct low_bits_mask_t< ::std::numeric_limits::digits >; -#endif - -#if UINT_MAX > USHRT_MAX -template < > - struct low_bits_mask_t< ::std::numeric_limits::digits >; -#endif - -#if ULONG_MAX > UINT_MAX -template < > - struct low_bits_mask_t< ::std::numeric_limits::digits >; -#endif - - // From ------------------------------------// template diff --git a/3party/boost/boost/interprocess/allocators/detail/adaptive_node_pool.hpp b/3party/boost/boost/interprocess/allocators/detail/adaptive_node_pool.hpp index c66a6002c7..99cee8aef3 100644 --- a/3party/boost/boost/interprocess/allocators/detail/adaptive_node_pool.hpp +++ b/3party/boost/boost/interprocess/allocators/detail/adaptive_node_pool.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include //!\file //!Describes the real adaptive pool shared by many Interprocess pool allocators diff --git a/3party/boost/boost/interprocess/allocators/detail/allocator_common.hpp b/3party/boost/boost/interprocess/allocators/detail/allocator_common.hpp index 3bdc7c6f48..6dbe33d4a4 100644 --- a/3party/boost/boost/interprocess/allocators/detail/allocator_common.hpp +++ b/3party/boost/boost/interprocess/allocators/detail/allocator_common.hpp @@ -21,6 +21,7 @@ #include //std::pair #include //boost::addressof #include //BOOST_ASSERT +#include #include //bad_alloc #include //scoped_lock #include //boost::interprocess::allocation_type @@ -290,6 +291,14 @@ class cache_impl //Deallocate all new linked list at once mp_node_pool->deallocate_nodes(boost::interprocess::move(chain)); } + + public: + void swap(cache_impl &other) + { + detail::do_swap(mp_node_pool, other.mp_node_pool); + m_cached_nodes.swap(other.m_cached_nodes); + detail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); + } }; template @@ -656,11 +665,7 @@ class cached_allocator_impl //!Swaps allocators. Does not throw. If each allocator is placed in a //!different shared memory segments, the result is undefined. friend void swap(cached_allocator_impl &alloc1, cached_allocator_impl &alloc2) - { - detail::do_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); - alloc1.m_cached_nodes.swap(alloc2.m_cached_nodes); - detail::do_swap(alloc1.m_max_cached_nodes, alloc2.m_max_cached_nodes); - } + { alloc1.m_cache.swap(alloc2.m_cache); } void deallocate_cache() { m_cache.deallocate_all_cached_nodes(); } @@ -808,7 +813,7 @@ class shared_pool_impl //----------------------- boost::interprocess::scoped_lock guard(m_header); //----------------------- - assert(m_header.m_usecount > 0); + BOOST_ASSERT(m_header.m_usecount > 0); return --m_header.m_usecount; } diff --git a/3party/boost/boost/interprocess/containers/container/deque.hpp b/3party/boost/boost/interprocess/containers/container/deque.hpp index 06a6477ed6..4631d95a7b 100644 --- a/3party/boost/boost/interprocess/containers/container/deque.hpp +++ b/3party/boost/boost/interprocess/containers/container/deque.hpp @@ -1,29 +1,3 @@ -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2006. Distributed under the Boost @@ -33,13 +7,6 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_deque.h and stl_uninitialized.h files. -// Modified by Ion Gaztanaga 2005. -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINERS_DEQUE_HPP #define BOOST_CONTAINERS_DEQUE_HPP @@ -48,17 +15,17 @@ # pragma once #endif -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include -#include +#include #include #include #include @@ -68,8 +35,8 @@ #include #include #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { @@ -532,13 +499,13 @@ class deque : protected deque_base /// @cond private: // Internal typedefs - BOOST_COPYABLE_AND_MOVABLE(deque) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(deque) typedef ptr_alloc_ptr index_pointer; static std::size_t s_buffer_size() { return Base::s_buffer_size(); } typedef containers_detail::advanced_insert_aux_int advanced_insert_aux_int_t; typedef repeat_iterator r_iterator; - typedef boost::interprocess::move_iterator move_it; + typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator move_it; /// @endcond @@ -628,7 +595,7 @@ class deque : protected deque_base } } - deque(BOOST_INTERPROCESS_RV_REF(deque) mx) + deque(BOOST_MOVE_MACRO_RV_REF(deque) mx) : Base(mx.alloc()) { this->swap(mx); } @@ -655,7 +622,7 @@ class deque : protected deque_base priv_destroy_range(this->members_.m_start, this->members_.m_finish); } - deque& operator= (BOOST_INTERPROCESS_COPY_ASSIGN_REF(deque) x) + deque& operator= (BOOST_MOVE_MACRO_COPY_ASSIGN_REF(deque) x) { const size_type len = size(); if (&x != this) { @@ -670,7 +637,7 @@ class deque : protected deque_base return *this; } - deque& operator= (BOOST_INTERPROCESS_RV_REF(deque) x) + deque& operator= (BOOST_MOVE_MACRO_RV_REF(deque) x) { this->clear(); this->swap(x); @@ -697,21 +664,21 @@ class deque : protected deque_base this->priv_assign_dispatch(first, last, Result()); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_back(T &x) { push_back(const_cast(x)); } template - void push_back(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_back(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_push_back(u); } #endif void push_back(insert_const_ref_type t) { return priv_push_back(t); } - void push_back(BOOST_INTERPROCESS_RV_REF(value_type) t) + void push_back(BOOST_MOVE_MACRO_RV_REF(value_type) t) { if(this->priv_push_back_simple_available()){ - new(this->priv_push_back_simple_pos())value_type(boost::interprocess::move(t)); + new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t)); this->priv_push_back_simple_commit(); } else{ @@ -719,21 +686,21 @@ class deque : protected deque_base } } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_front(T &x) { push_front(const_cast(x)); } template - void push_front(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_front(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_push_front(u); } #endif void push_front(insert_const_ref_type t) { return priv_push_front(t); } - void push_front(BOOST_INTERPROCESS_RV_REF(value_type) t) + void push_front(BOOST_MOVE_MACRO_RV_REF(value_type) t) { if(this->priv_push_front_simple_available()){ - new(this->priv_push_front_simple_pos())value_type(boost::interprocess::move(t)); + new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t)); this->priv_push_front_simple_commit(); } else{ @@ -761,26 +728,26 @@ class deque : protected deque_base this->priv_pop_front_aux(); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert(position, u); } #endif iterator insert(const_iterator position, insert_const_ref_type x) { return this->priv_insert(position, x); } - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(value_type) mx) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) mx) { if (position == cbegin()) { - this->push_front(boost::interprocess::move(mx)); + this->push_front(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx)); return begin(); } else if (position == cend()) { - this->push_back(boost::interprocess::move(mx)); + this->push_back(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx)); return(end()-1); } else { @@ -810,12 +777,12 @@ class deque : protected deque_base void emplace_back(Args&&... args) { if(this->priv_push_back_simple_available()){ - new(this->priv_push_back_simple_pos())value_type(boost::interprocess::forward(args)...); + new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->priv_push_back_simple_commit(); } else{ typedef containers_detail::advanced_insert_aux_emplace type; - type &&proxy = type(boost::interprocess::forward(args)...); + type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->priv_insert_aux_impl(this->cend(), 1, proxy); } } @@ -824,12 +791,12 @@ class deque : protected deque_base void emplace_front(Args&&... args) { if(this->priv_push_front_simple_available()){ - new(this->priv_push_front_simple_pos())value_type(boost::interprocess::forward(args)...); + new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->priv_push_front_simple_commit(); } else{ typedef containers_detail::advanced_insert_aux_emplace type; - type &&proxy = type(boost::interprocess::forward(args)...); + type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->priv_insert_aux_impl(this->cbegin(), 1, proxy); } } @@ -838,17 +805,17 @@ class deque : protected deque_base iterator emplace(const_iterator p, Args&&... args) { if(p == this->cbegin()){ - this->emplace_front(boost::interprocess::forward(args)...); + this->emplace_front(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); return this->begin(); } else if(p == this->cend()){ - this->emplace_back(boost::interprocess::forward(args)...); + this->emplace_back(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); return (this->end()-1); } else{ size_type n = p - this->cbegin(); typedef containers_detail::advanced_insert_aux_emplace type; - type &&proxy = type(boost::interprocess::forward(args)...); + type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->priv_insert_aux_impl(p, 1, proxy); return iterator(this->begin() + n); } @@ -986,11 +953,11 @@ class deque : protected deque_base ++next; difference_type index = pos - this->members_.m_start; if (size_type(index) < (this->size() >> 1)) { - boost::interprocess::move_backward(begin(), iterator(pos), iterator(next)); + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(pos), iterator(next)); pop_front(); } else { - boost::interprocess::move(iterator(next), end(), iterator(pos)); + BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(next), end(), iterator(pos)); pop_back(); } return this->members_.m_start + index; @@ -1006,7 +973,7 @@ class deque : protected deque_base difference_type n = last - first; difference_type elems_before = first - this->members_.m_start; if (elems_before < static_cast(this->size() - n) - elems_before) { - boost::interprocess::move_backward(begin(), iterator(first), iterator(last)); + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(first), iterator(last)); iterator new_start = this->members_.m_start + n; if(!Base::traits_t::trivial_dctr_after_move) this->priv_destroy_range(this->members_.m_start, new_start); @@ -1014,7 +981,7 @@ class deque : protected deque_base this->members_.m_start = new_start; } else { - boost::interprocess::move(iterator(last), end(), iterator(first)); + BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(last), end(), iterator(first)); iterator new_finish = this->members_.m_finish - n; if(!Base::traits_t::trivial_dctr_after_move) this->priv_destroy_range(new_finish, this->members_.m_finish); @@ -1120,7 +1087,7 @@ class deque : protected deque_base void priv_insert_aux(const_iterator pos, InpIt first, InpIt last, std::input_iterator_tag) { for(;first != last; ++first){ - this->insert(pos, boost::interprocess::move(value_type(*first))); + this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first))); } } @@ -1172,7 +1139,7 @@ class deque : protected deque_base template void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_) - { this->priv_fill_assign((size_type) n, (T) val); } + { this->priv_fill_assign((size_type) n, (value_type)val); } template void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_) @@ -1209,7 +1176,7 @@ class deque : protected deque_base template void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, containers_detail::true_) - { this->priv_fill_insert(pos, (size_type) n, (value_type) x); } + { this->priv_fill_insert(pos, (size_type) n, (value_type)x); } template void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, containers_detail::false_) @@ -1248,9 +1215,9 @@ class deque : protected deque_base pos = this->members_.m_start + elemsbefore; if (elemsbefore >= difference_type(n)) { iterator start_n = this->members_.m_start + difference_type(n); - ::boost::interprocess::uninitialized_move(this->members_.m_start, start_n, new_start); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(this->members_.m_start, start_n, new_start); this->members_.m_start = new_start; - boost::interprocess::move(start_n, pos, old_start); + BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start); interf.copy_all_to(pos - difference_type(n)); } else { @@ -1258,7 +1225,7 @@ class deque : protected deque_base iterator mid_start = old_start - mid_count; interf.uninitialized_copy_some_and_update(mid_start, mid_count, true); this->members_.m_start = mid_start; - ::boost::interprocess::uninitialized_move(old_start, pos, new_start); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start); this->members_.m_start = new_start; interf.copy_all_to(old_start); } @@ -1271,15 +1238,15 @@ class deque : protected deque_base pos = this->members_.m_finish - elemsafter; if (elemsafter >= difference_type(n)) { iterator finish_n = this->members_.m_finish - difference_type(n); - ::boost::interprocess::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish); this->members_.m_finish = new_finish; - boost::interprocess::move_backward(pos, finish_n, old_finish); + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish); interf.copy_all_to(pos); } else { interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false); this->members_.m_finish += n-elemsafter; - ::boost::interprocess::uninitialized_move(pos, old_finish, this->members_.m_finish); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, this->members_.m_finish); this->members_.m_finish = new_finish; interf.copy_all_to(pos); } @@ -1339,10 +1306,10 @@ class deque : protected deque_base ++cur_node) { FwdIt mid = first; std::advance(mid, this->s_buffer_size()); - ::boost::interprocess::uninitialized_copy_or_move(first, mid, *cur_node); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, *cur_node); first = mid; } - ::boost::interprocess::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first); } BOOST_CATCH(...){ this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node)); @@ -1433,9 +1400,9 @@ class deque : protected deque_base new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2 + (add_at_front ? nodes_to_add : 0); if (new_nstart < this->members_.m_start.m_node) - boost::interprocess::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); + BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); else - boost::interprocess::move_backward + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward (this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes); } else { @@ -1445,7 +1412,7 @@ class deque : protected deque_base index_pointer new_map = this->priv_allocate_map(new_map_size); new_nstart = new_map + (new_map_size - new_num_nodes) / 2 + (add_at_front ? nodes_to_add : 0); - boost::interprocess::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); + BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); this->members_.m_map = new_map; @@ -1516,6 +1483,6 @@ struct has_trivial_destructor_after_move > /// @endcond -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // #ifndef BOOST_CONTAINERS_DEQUE_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp b/3party/boost/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp index 6361e7b2a1..d2c88d9139 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/adaptive_node_pool_impl.hpp @@ -15,18 +15,18 @@ # pragma once #endif -#include -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP #include #include #include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP +#include #include namespace boost { @@ -69,6 +69,9 @@ struct adaptive_pool_types const bool is_equal = l.free_nodes.size() == r.free_nodes.size(); return is_less || (is_equal && (&l < &r)); } + + friend bool operator ==(const block_info_t &l, const block_info_t &r) + { return &l == &r; } }; typedef typename bi::make_multiset >::type block_multiset_t; @@ -270,11 +273,11 @@ class private_adaptive_node_pool_impl } } catch(...){ - this->deallocate_nodes(boost::interprocess::move(chain)); + this->deallocate_nodes(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain)); throw; } priv_invariants(); - return boost::interprocess::move(chain); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain); } //!Deallocates a linked list of nodes. Never throws @@ -302,10 +305,10 @@ class private_adaptive_node_pool_impl void swap(private_adaptive_node_pool_impl &other) { - assert(m_max_free_blocks == other.m_max_free_blocks); - assert(m_real_node_size == other.m_real_node_size); - assert(m_real_block_alignment == other.m_real_block_alignment); - assert(m_real_num_node == other.m_real_num_node); + BOOST_ASSERT(m_max_free_blocks == other.m_max_free_blocks); + BOOST_ASSERT(m_real_node_size == other.m_real_node_size); + BOOST_ASSERT(m_real_block_alignment == other.m_real_block_alignment); + BOOST_ASSERT(m_real_num_node == other.m_real_num_node); std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base); std::swap(m_totally_free_blocks, other.m_totally_free_blocks); m_block_multiset.swap(other.m_block_multiset); @@ -326,10 +329,10 @@ class private_adaptive_node_pool_impl ; m_totally_free_blocks > max_free_blocks ; --m_totally_free_blocks ){ - assert(!m_block_multiset.empty()); + BOOST_ASSERT(!m_block_multiset.empty()); block_iterator it = itend; --it; - assert(it->free_nodes.size() == m_real_num_node); + BOOST_ASSERT(it->free_nodes.size() == m_real_num_node); m_block_multiset.erase_and_dispose(it, block_destroyer(this)); } } @@ -342,7 +345,7 @@ class private_adaptive_node_pool_impl chain.pop_front(); priv_invariants(); block_info_t *block_info = this->priv_block_from_node(pElem); - assert(block_info->free_nodes.size() < m_real_num_node); + BOOST_ASSERT(block_info->free_nodes.size() < m_real_num_node); //We put the node at the beginning of the free node list node_t * to_deallocate = static_cast(pElem); block_info->free_nodes.push_front(*to_deallocate); @@ -379,12 +382,12 @@ class private_adaptive_node_pool_impl node_t *priv_take_first_node() { - assert(m_block_multiset.begin() != m_block_multiset.end()); + BOOST_ASSERT(m_block_multiset.begin() != m_block_multiset.end()); //We take the first free node the multiset can't be empty free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes; node_t *first_node = &free_nodes.front(); const std::size_t free_nodes_count = free_nodes.size(); - assert(0 != free_nodes_count); + BOOST_ASSERT(0 != free_nodes_count); free_nodes.pop_front(); if(free_nodes_count == 1){ m_block_multiset.erase(m_block_multiset.begin()); @@ -414,7 +417,7 @@ class private_adaptive_node_pool_impl { std::size_t free_nodes = to_deallocate->free_nodes.size(); (void)free_nodes; - assert(free_nodes == mp_impl->m_real_num_node); + BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node); mp_impl->mp_segment_mngr_base->deallocate(to_deallocate); } @@ -422,8 +425,8 @@ class private_adaptive_node_pool_impl { std::size_t free_nodes = to_deallocate->free_nodes.size(); (void)free_nodes; - assert(free_nodes == mp_impl->m_real_num_node); - assert(0 == to_deallocate->hdr_offset); + BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node); + BOOST_ASSERT(0 == to_deallocate->hdr_offset); hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(containers_detail::get_pointer(to_deallocate)); mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder); } @@ -446,7 +449,7 @@ class private_adaptive_node_pool_impl --prev; std::size_t sp = prev->free_nodes.size(), si = it->free_nodes.size(); - assert(sp <= si); + BOOST_ASSERT(sp <= si); (void)sp; (void)si; } } @@ -457,7 +460,7 @@ class private_adaptive_node_pool_impl for(; it != itend; ++it){ total_free_nodes += it->free_nodes.size(); } - assert(total_free_nodes >= m_totally_free_blocks*m_real_num_node); + BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node); //Check that the total totally free blocks are correct it = m_block_multiset.begin(); @@ -466,7 +469,7 @@ class private_adaptive_node_pool_impl for(; it != itend; ++it){ total_free += it->free_nodes.size() == m_real_num_node; } - assert(total_free >= m_totally_free_blocks); + BOOST_ASSERT(total_free >= m_totally_free_blocks); if(!AlignOnly){ //Check that header offsets are correct @@ -474,9 +477,9 @@ class private_adaptive_node_pool_impl for(; it != itend; ++it){ hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it); for(std::size_t i = 0, max = m_num_subblocks; i < max; ++i){ - assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast(&*it)- reinterpret_cast(hdr_off_holder))); - assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); - assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); + BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast(&*it)- reinterpret_cast(hdr_off_holder))); + BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); + BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); hdr_off_holder = reinterpret_cast(reinterpret_cast(hdr_off_holder) + m_real_block_alignment); } } @@ -495,10 +498,10 @@ class private_adaptive_node_pool_impl std::size_t num_free_nodes = 0; for(; it != itend; ++it){ //Check for memory leak - assert(it->free_nodes.size() == m_real_num_node); + BOOST_ASSERT(it->free_nodes.size() == m_real_num_node); ++num_free_nodes; } - assert(num_free_nodes == m_totally_free_blocks); + BOOST_ASSERT(num_free_nodes == m_totally_free_blocks); #endif //Check for memory leaks priv_invariants(); @@ -510,11 +513,11 @@ class private_adaptive_node_pool_impl { hdr_offset_holder *hdr_off_holder = reinterpret_cast((std::size_t)node & std::size_t(~(m_real_block_alignment - 1))); - assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); - assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); + BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); + BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); block_info_t *block = reinterpret_cast (reinterpret_cast(hdr_off_holder) + hdr_off_holder->hdr_offset); - assert(block->hdr_offset == 0); + BOOST_ASSERT(block->hdr_offset == 0); return block; } @@ -530,9 +533,9 @@ class private_adaptive_node_pool_impl { hdr_offset_holder *hdr_off_holder = reinterpret_cast (reinterpret_cast(block) - (m_num_subblocks-1)*m_real_block_alignment); - assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast(block) - reinterpret_cast(hdr_off_holder))); - assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); - assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); + BOOST_ASSERT(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast(block) - reinterpret_cast(hdr_off_holder))); + BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); + BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); return hdr_off_holder; } @@ -579,7 +582,7 @@ class private_adaptive_node_pool_impl char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1); block_info_t *c_info = new(hdr_addr)block_info_t; //Some structural checks - assert(static_cast(&static_cast(c_info)->hdr_offset) == + BOOST_ASSERT(static_cast(&static_cast(c_info)->hdr_offset) == static_cast(c_info)); typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin(); for( std::size_t subblock = 0, maxsubblock = m_num_subblocks - 1 @@ -633,6 +636,6 @@ class private_adaptive_node_pool_impl } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/advanced_insert_int.hpp b/3party/boost/boost/interprocess/containers/container/detail/advanced_insert_int.hpp index 8a073b095c..bb9126d624 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/advanced_insert_int.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/advanced_insert_int.hpp @@ -15,13 +15,12 @@ # pragma once #endif -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include //std::iterator_traits -#include //std::copy, std::uninitialized_copy #include //placement new -#include +#include namespace boost { namespace container { namespace containers_detail { @@ -51,21 +50,21 @@ struct advanced_insert_aux_proxy {} virtual void copy_all_to(Iterator p) - { std::copy(first_, last_, p); } + { ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(first_, last_, p); } virtual void uninitialized_copy_all_to(Iterator p) - { ::boost::interprocess::uninitialized_copy_or_move(first_, last_, p); } + { ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, last_, p); } virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n) { FwdIt mid = first_; std::advance(mid, division_count); if(first_n){ - ::boost::interprocess::uninitialized_copy_or_move(first_, mid, pos); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, mid, pos); first_ = mid; } else{ - ::boost::interprocess::uninitialized_copy_or_move(mid, last_, pos); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last_, pos); last_ = mid; } } @@ -75,11 +74,11 @@ struct advanced_insert_aux_proxy FwdIt mid = first_; std::advance(mid, division_count); if(first_n){ - std::copy(first_, mid, pos); + ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(first_, mid, pos); first_ = mid; } else{ - std::copy(mid, last_, pos); + ::BOOST_CONTAINER_MOVE_NAMESPACE::copy_or_move(mid, last_, pos); last_ = mid; } } @@ -99,7 +98,7 @@ struct default_construct_aux_proxy void uninitialized_copy_impl(Iterator p, const SizeType n) { - assert(n <= count_); + BOOST_ASSERT(n <= count_); Iterator orig_p = p; SizeType i = 0; try{ @@ -121,7 +120,7 @@ struct default_construct_aux_proxy virtual void copy_all_to(Iterator) { //This should never be called with any count - assert(count_ == 0); + BOOST_ASSERT(count_ == 0); } virtual void uninitialized_copy_all_to(Iterator p) @@ -134,7 +133,7 @@ struct default_construct_aux_proxy new_count = division_count; } else{ - assert(difference_type(count_)>= division_count); + BOOST_ASSERT(difference_type(count_)>= division_count); new_count = count_ - division_count; } this->uninitialized_copy_impl(pos, new_count); @@ -142,17 +141,17 @@ struct default_construct_aux_proxy virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n) { - assert(count_ == 0); + BOOST_ASSERT(count_ == 0); SizeType new_count; if(first_n){ new_count = division_count; } else{ - assert(difference_type(count_)>= division_count); + BOOST_ASSERT(difference_type(count_)>= division_count); new_count = count_ - division_count; } //This function should never called with a count different to zero - assert(new_count == 0); + BOOST_ASSERT(new_count == 0); (void)new_count; } @@ -163,8 +162,9 @@ struct default_construct_aux_proxy #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include //#include //For debugging purposes @@ -181,7 +181,8 @@ struct advanced_insert_aux_emplace typedef typename build_number_seq::type index_tuple_t; explicit advanced_insert_aux_emplace(Args&&... args) - : args_(args...), used_(false) + : args_(args...) + , used_(false) {} ~advanced_insert_aux_emplace() @@ -204,7 +205,7 @@ struct advanced_insert_aux_emplace void priv_copy_all_to(const index_tuple&, Iterator p) { if(!used_){ - *p = boost::interprocess::move(T (boost::interprocess::forward(get(args_))...)); + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T (::boost::container::containers_detail::stored_ref::forward(get(args_))...)); used_ = true; } } @@ -213,7 +214,7 @@ struct advanced_insert_aux_emplace void priv_uninitialized_copy_all_to(const index_tuple&, Iterator p) { if(!used_){ - new(containers_detail::get_pointer(&*p))T(boost::interprocess::forward(get(args_))...); + new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref::forward(get(args_))...); used_ = true; } } @@ -221,10 +222,10 @@ struct advanced_insert_aux_emplace template void priv_uninitialized_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n) { - assert(division_count <=1); + BOOST_ASSERT(division_count <=1); if((first_n && division_count == 1) || (!first_n && division_count == 0)){ if(!used_){ - new(containers_detail::get_pointer(&*p))T(boost::interprocess::forward(get(args_))...); + new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref::forward(get(args_))...); used_ = true; } } @@ -233,15 +234,15 @@ struct advanced_insert_aux_emplace template void priv_copy_some_and_update(const index_tuple&, Iterator p, difference_type division_count, bool first_n) { - assert(division_count <=1); + BOOST_ASSERT(division_count <=1); if((first_n && division_count == 1) || (!first_n && division_count == 0)){ if(!used_){ - *p = boost::interprocess::move(T(boost::interprocess::forward(get(args_))...)); + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T(::boost::container::containers_detail::stored_ref::forward(get(args_))...)); used_ = true; } } } - tuple args_; + tuple args_; bool used_; }; @@ -249,8 +250,8 @@ struct advanced_insert_aux_emplace #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP namespace boost { namespace container { @@ -273,7 +274,7 @@ struct advanced_insert_aux_emplace { if(!used_){ value_initv; - *p = boost::interprocess::move(v.m_t); + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t); used_ = true; } } @@ -288,7 +289,7 @@ struct advanced_insert_aux_emplace virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n) { - assert(division_count <=1); + BOOST_ASSERT(division_count <=1); if((first_n && division_count == 1) || (!first_n && division_count == 0)){ if(!used_){ new(containers_detail::get_pointer(&*p))T(); @@ -299,11 +300,11 @@ struct advanced_insert_aux_emplace virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n) { - assert(division_count <=1); + BOOST_ASSERT(division_count <=1); if((first_n && division_count == 1) || (!first_n && division_count == 0)){ if(!used_){ value_initv; - *p = boost::interprocess::move(v.m_t); + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t); used_ = true; } } @@ -327,7 +328,7 @@ struct advanced_insert_aux_emplace { \ if(!used_){ \ T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \ - *p = boost::interprocess::move(v); \ + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v); \ used_ = true; \ } \ } \ @@ -344,7 +345,7 @@ struct advanced_insert_aux_emplace virtual void uninitialized_copy_some_and_update \ (Iterator p, difference_type division_count, bool first_n) \ { \ - assert(division_count <=1); \ + BOOST_ASSERT(division_count <=1); \ if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \ if(!used_){ \ new(containers_detail::get_pointer(&*p))T \ @@ -357,11 +358,11 @@ struct advanced_insert_aux_emplace virtual void copy_some_and_update \ (Iterator p, difference_type division_count, bool first_n) \ { \ - assert(division_count <=1); \ + BOOST_ASSERT(division_count <=1); \ if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \ if(!used_){ \ T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \ - *p = boost::interprocess::move(v); \ + *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v); \ used_ = true; \ } \ } \ @@ -379,6 +380,6 @@ struct advanced_insert_aux_emplace #endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_ADVANCED_INSERT_INT_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/algorithms.hpp b/3party/boost/boost/interprocess/containers/container/detail/algorithms.hpp index 5cd1abb40f..a028a5e250 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/algorithms.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/algorithms.hpp @@ -17,17 +17,17 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #include #include #include #include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP #include @@ -35,7 +35,7 @@ namespace boost { namespace container { -#if !defined(BOOST_HAS_RVALUE_REFS) +#if defined(BOOST_NO_RVALUE_REFERENCES) template struct has_own_construct_from_it { @@ -209,7 +209,7 @@ FwdIt uninitialized_copy_copy } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_ALGORITHMS_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/allocation_type.hpp b/3party/boost/boost/interprocess/containers/container/detail/allocation_type.hpp index 9b8ac94dd4..88f08ba8db 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/allocation_type.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/allocation_type.hpp @@ -15,8 +15,8 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP namespace boost { namespace container { @@ -49,6 +49,6 @@ static const allocation_type zero_memory = (allocation_type)zero_memory_v } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //BOOST_CONTAINERS_ALLOCATION_TYPE_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/config_begin.hpp b/3party/boost/boost/interprocess/containers/container/detail/config_begin.hpp index 2cd129b0d5..da16ffa98e 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/config_begin.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/config_begin.hpp @@ -10,6 +10,104 @@ #ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED #define BOOST_CONTAINERS_CONTAINER_DETAIL_CONFIG_INCLUDED #include + +#define BOOST_CONTAINER_IN_INTERPROCESS +#define BOOST_MOVE_IN_INTERPROCESS + +#ifdef BOOST_MOVE_IN_INTERPROCESS + +#define INCLUDE_BOOST_CONTAINER_MOVE_HPP +#define BOOST_CONTAINER_MOVE_NAMESPACE boost::interprocess + +#else + +#define INCLUDE_BOOST_CONTAINER_MOVE_HPP +#define BOOST_CONTAINER_MOVE_NAMESPACE boost + +#endif + +#ifdef BOOST_CONTAINER_IN_INTERPROCESS + +#define INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#define INCLUDE_BOOST_CONTAINER_DEQUE_HPP +#define INCLUDE_BOOST_CONTAINER_FLAT_MAP_HPP +#define INCLUDE_BOOST_CONTAINER_FLAT_SET_HPP +#define INCLUDE_BOOST_CONTAINER_LIST_HPP +#define INCLUDE_BOOST_CONTAINER_MAP_HPP +#define INCLUDE_BOOST_CONTAINER_SET_HPP +#define INCLUDE_BOOST_CONTAINER_SLIST_HPP +#define INCLUDE_BOOST_CONTAINER_STABLE_VECTOR_HPP +#define INCLUDE_BOOST_CONTAINER_STRING_HPP +#define INCLUDE_BOOST_CONTAINER_VECTOR_HPP +//detail +#define INCLUDE_BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_NODE_POOL_IMPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATOR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#else //BOOST_CONTAINER_IN_INTERPROCESS + +#define INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#define INCLUDE_BOOST_CONTAINER_DEQUE_HPP +#define INCLUDE_BOOST_CONTAINER_FLAT_MAP_HPP +#define INCLUDE_BOOST_CONTAINER_FLAT_SET_HPP +#define INCLUDE_BOOST_CONTAINER_LIST_HPP +#define INCLUDE_BOOST_CONTAINER_MAP_HPP +#define INCLUDE_BOOST_CONTAINER_SET_HPP +#define INCLUDE_BOOST_CONTAINER_SLIST_HPP +#define INCLUDE_BOOST_CONTAINER_STABLE_VECTOR_HPP +#define INCLUDE_BOOST_CONTAINER_STRING_HPP +#define INCLUDE_BOOST_CONTAINER_VECTOR_HPP +//detail +#define INCLUDE_BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_BEGIN_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_NODE_POOL_IMPL_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATOR_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#define INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#endif //BOOST_CONTAINER_IN_INTERPROCESS + #endif #ifdef BOOST_MSVC diff --git a/3party/boost/boost/interprocess/containers/container/detail/destroyers.hpp b/3party/boost/boost/interprocess/containers/container/detail/destroyers.hpp index 8db5c57147..25f80436f9 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/destroyers.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/destroyers.hpp @@ -17,10 +17,10 @@ # pragma once #endif -#include -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP namespace boost { namespace container { @@ -149,6 +149,6 @@ class allocator_destroyer } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DESTROYERS_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/flat_tree.hpp b/3party/boost/boost/interprocess/containers/container/detail/flat_tree.hpp index ad35ad485d..eb69df90f1 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/flat_tree.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/flat_tree.hpp @@ -32,23 +32,23 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include #include -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP +#include INCLUDE_BOOST_CONTAINER_VECTOR_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP namespace boost { @@ -56,37 +56,51 @@ namespace container { namespace containers_detail { +template +class flat_tree_value_compare + : private Compare +{ + typedef Value first_argument_type; + typedef Value second_argument_type; + typedef bool return_type; + public: + flat_tree_value_compare(const Compare &pred) + : Compare(pred) + {} + + bool operator()(const Value& lhs, const Value& rhs) const + { + KeyOfValue key_extract; + return Compare::operator()(key_extract(lhs), key_extract(rhs)); + } + + const Compare &get_comp() const + { return *this; } + + Compare &get_comp() + { return *this; } +}; + +template +struct get_flat_tree_iterators +{ + typedef typename containers_detail:: + vector_iterator iterator; + typedef typename containers_detail:: + vector_const_iterator const_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +}; + template class flat_tree { typedef boost::container::vector vector_t; - typedef Alloc allocator_t; + typedef Alloc allocator_t; public: - class value_compare - : private Compare - { - typedef Value first_argument_type; - typedef Value second_argument_type; - typedef bool return_type; - public: - value_compare(const Compare &pred) - : Compare(pred) - {} - - bool operator()(const Value& lhs, const Value& rhs) const - { - KeyOfValue key_extract; - return Compare::operator()(key_extract(lhs), key_extract(rhs)); - } - - const Compare &get_comp() const - { return *this; } - - Compare &get_comp() - { return *this; } - }; + typedef flat_tree_value_compare value_compare; private: struct Data @@ -94,7 +108,7 @@ class flat_tree : public value_compare { private: - BOOST_COPYABLE_AND_MOVABLE(Data) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(Data) public: Data(const Data &d) : value_compare(d), m_vect(d.m_vect) @@ -111,17 +125,17 @@ class flat_tree const allocator_t &alloc) : value_compare(comp), m_vect(alloc){} - Data& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(Data) d) + Data& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(Data) d) { - value_compare::operator=(d); + this->value_compare::operator=(d); m_vect = d.m_vect; return *this; } - Data& operator=(BOOST_INTERPROCESS_RV_REF(Data) d) + Data& operator=(BOOST_MOVE_MACRO_RV_REF(Data) d) { - value_compare::operator=(boost::interprocess::move(static_cast(d))); - m_vect = boost::interprocess::move(d.m_vect); + this->value_compare::operator=(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast(d))); + m_vect = BOOST_CONTAINER_MOVE_NAMESPACE::move(d.m_vect); return *this; } @@ -129,7 +143,7 @@ class flat_tree }; Data m_data; - BOOST_COPYABLE_AND_MOVABLE(flat_tree) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_tree) public: @@ -160,8 +174,8 @@ class flat_tree : m_data(x.m_data, x.m_data.m_vect) { } - flat_tree(BOOST_INTERPROCESS_RV_REF(flat_tree) x) - : m_data(boost::interprocess::move(x.m_data)) + flat_tree(BOOST_MOVE_MACRO_RV_REF(flat_tree) x) + : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_data)) { } template @@ -174,11 +188,11 @@ class flat_tree ~flat_tree() { } - flat_tree& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(flat_tree) x) + flat_tree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_tree) x) { m_data = x.m_data; return *this; } - flat_tree& operator=(BOOST_INTERPROCESS_RV_REF(flat_tree) mx) - { m_data = boost::interprocess::move(mx.m_data); return *this; } + flat_tree& operator=(BOOST_MOVE_MACRO_RV_REF(flat_tree) mx) + { m_data = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_data); return *this; } public: // accessors: @@ -261,12 +275,12 @@ class flat_tree return ret; } - std::pair insert_unique(BOOST_INTERPROCESS_RV_REF(value_type) val) + std::pair insert_unique(BOOST_MOVE_MACRO_RV_REF(value_type) val) { insert_commit_data data; std::pair ret = priv_insert_unique_prepare(val, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return ret; } @@ -279,10 +293,10 @@ class flat_tree return i; } - iterator insert_equal(BOOST_INTERPROCESS_RV_REF(value_type) mval) + iterator insert_equal(BOOST_MOVE_MACRO_RV_REF(value_type) mval) { iterator i = this->upper_bound(KeyOfValue()(mval)); - i = this->m_data.m_vect.insert(i, boost::interprocess::move(mval)); + i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval)); return i; } @@ -296,12 +310,12 @@ class flat_tree return ret.first; } - iterator insert_unique(const_iterator pos, BOOST_INTERPROCESS_RV_REF(value_type) mval) + iterator insert_unique(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval) { insert_commit_data data; std::pair ret = priv_insert_unique_prepare(pos, mval, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(mval)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval)); } return ret.first; } @@ -313,11 +327,11 @@ class flat_tree return priv_insert_commit(data, val); } - iterator insert_equal(const_iterator pos, BOOST_INTERPROCESS_RV_REF(value_type) mval) + iterator insert_equal(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval) { insert_commit_data data; priv_insert_equal_prepare(pos, mval, data); - return priv_insert_commit(data, boost::interprocess::move(mval)); + return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval)); } template @@ -340,12 +354,12 @@ class flat_tree template iterator emplace_unique(Args&&... args) { - value_type && val = value_type(boost::interprocess::forward(args)...); + value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); insert_commit_data data; std::pair ret = priv_insert_unique_prepare(val, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return ret.first; } @@ -353,11 +367,11 @@ class flat_tree template iterator emplace_hint_unique(const_iterator hint, Args&&... args) { - value_type && val = value_type(boost::interprocess::forward(args)...); + value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); insert_commit_data data; std::pair ret = priv_insert_unique_prepare(hint, val, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return ret.first; } @@ -365,19 +379,19 @@ class flat_tree template iterator emplace_equal(Args&&... args) { - value_type &&val = value_type(boost::interprocess::forward(args)...); + value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); iterator i = this->upper_bound(KeyOfValue()(val)); - i = this->m_data.m_vect.insert(i, boost::interprocess::move(val)); + i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); return i; } template iterator emplace_hint_equal(const_iterator hint, Args&&... args) { - value_type &&val = value_type(boost::interprocess::forward(args)...); + value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); insert_commit_data data; priv_insert_equal_prepare(hint, val, data); - return priv_insert_commit(data, boost::interprocess::move(val)); + return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -390,7 +404,7 @@ class flat_tree std::pair ret = priv_insert_unique_prepare(val, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return ret.first; } @@ -402,7 +416,7 @@ class flat_tree insert_commit_data data; std::pair ret = priv_insert_unique_prepare(hint, val, data); if(ret.second){ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return ret.first; } @@ -412,7 +426,7 @@ class flat_tree containers_detail::value_init vval; value_type &val = vval.m_t; iterator i = this->upper_bound(KeyOfValue()(val)); - i = this->m_data.m_vect.insert(i, boost::interprocess::move(val)); + i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); return i; } @@ -422,7 +436,7 @@ class flat_tree value_type &val = vval.m_t; insert_commit_data data; priv_insert_equal_prepare(hint, val, data); - return priv_insert_commit(data, boost::interprocess::move(val)); + return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } #define BOOST_PP_LOCAL_MACRO(n) \ @@ -433,7 +447,7 @@ class flat_tree insert_commit_data data; \ std::pair ret = priv_insert_unique_prepare(val, data); \ if(ret.second){ \ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); \ + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \ } \ return ret.first; \ } \ @@ -446,7 +460,7 @@ class flat_tree insert_commit_data data; \ std::pair ret = priv_insert_unique_prepare(hint, val, data); \ if(ret.second){ \ - ret.first = priv_insert_commit(data, boost::interprocess::move(val)); \ + ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \ } \ return ret.first; \ } \ @@ -456,7 +470,7 @@ class flat_tree { \ value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \ iterator i = this->upper_bound(KeyOfValue()(val)); \ - i = this->m_data.m_vect.insert(i, boost::interprocess::move(val)); \ + i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \ return i; \ } \ \ @@ -467,7 +481,7 @@ class flat_tree value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \ insert_commit_data data; \ priv_insert_equal_prepare(hint, val, data); \ - return priv_insert_commit(data, boost::interprocess::move(val)); \ + return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); \ } \ //! #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS) @@ -663,11 +677,11 @@ class flat_tree template iterator priv_insert_commit - (insert_commit_data &commit_data, BOOST_INTERPROCESS_FWD_REF(Convertible) convertible) + (insert_commit_data &commit_data, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible) { return this->m_data.m_vect.insert ( commit_data.position - , boost::interprocess::forward(convertible)); + , BOOST_CONTAINER_MOVE_NAMESPACE::forward(convertible)); } template @@ -856,6 +870,6 @@ struct has_trivial_destructor_after_move +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // BOOST_CONTAINERS_FLAT_TREE_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/iterators.hpp b/3party/boost/boost/interprocess/containers/container/detail/iterators.hpp index 99e00cdd25..bfc4e1d042 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/iterators.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/iterators.hpp @@ -18,14 +18,15 @@ # pragma once #endif -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP #else -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif #include @@ -58,6 +59,16 @@ class constant_iterator return result; } + constant_iterator& operator--() + { decrement(); return *this; } + + constant_iterator operator--(int) + { + constant_iterator result (*this); + decrement(); + return result; + } + friend bool operator== (const constant_iterator& i, const constant_iterator& i2) { return i.equal(i2); } @@ -102,6 +113,9 @@ class constant_iterator const T& operator*() const { return dereference(); } + const T& operator[] (Difference n) const + { return dereference(); } + const T* operator->() const { return &(dereference()); } @@ -156,6 +170,16 @@ class default_construct_iterator return result; } + default_construct_iterator& operator--() + { decrement(); return *this; } + + default_construct_iterator operator--(int) + { + default_construct_iterator result (*this); + decrement(); + return result; + } + friend bool operator== (const default_construct_iterator& i, const default_construct_iterator& i2) { return i.equal(i2); } @@ -203,6 +227,9 @@ class default_construct_iterator const T* operator->() const { return &(dereference()); } + const T& operator[] (Difference n) const + { return dereference(); } + private: Difference m_num; @@ -255,6 +282,16 @@ class repeat_iterator return result; } + this_type& operator--() + { increment(); return *this; } + + this_type operator--(int) + { + this_type result (*this); + increment(); + return result; + } + friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } @@ -299,6 +336,9 @@ class repeat_iterator T& operator*() const { return dereference(); } + T& operator[] (Difference n) const + { return dereference(); } + T *operator->() const { return &(dereference()); } @@ -352,6 +392,16 @@ class emplace_iterator return result; } + this_type& operator--() + { decrement(); return *this; } + + this_type operator--(int) + { + this_type result (*this); + decrement(); + return result; + } + friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } @@ -396,6 +446,9 @@ class emplace_iterator const T& operator*() const { return dereference(); } + const T& operator[](std::ptrdiff_t) const + { return dereference(); } + const T* operator->() const { return &(dereference()); } @@ -447,9 +500,9 @@ struct emplace_functor template void inplace_impl(T* ptr, const containers_detail::index_tuple&) - { ::new(ptr) T(boost::interprocess::forward(containers_detail::get(args_))...); } + { ::new(ptr) T(containers_detail::stored_ref::forward(containers_detail::get(args_))...); } - containers_detail::tuple args_; + containers_detail::tuple args_; }; #else @@ -486,7 +539,7 @@ struct emplace_functor } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_ITERATORS_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/multiallocation_chain.hpp b/3party/boost/boost/interprocess/containers/container/detail/multiallocation_chain.hpp index 7da34254d1..30d0cca6b5 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/multiallocation_chain.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/multiallocation_chain.hpp @@ -11,14 +11,14 @@ #ifndef BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP #define BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP -#include -#include -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATOR_HPP #include #include -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP namespace boost { namespace container { @@ -41,7 +41,7 @@ class basic_multiallocation_chain static node & to_node(VoidPointer p) { return *static_cast(static_cast(containers_detail::get_pointer(p))); } - BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain) + BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain) public: @@ -53,13 +53,13 @@ class basic_multiallocation_chain : slist_impl_() {} - basic_multiallocation_chain(BOOST_INTERPROCESS_RV_REF(basic_multiallocation_chain) other) + basic_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other) : slist_impl_() { slist_impl_.swap(other.slist_impl_); } - basic_multiallocation_chain& operator=(BOOST_INTERPROCESS_RV_REF(basic_multiallocation_chain) other) + basic_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other) { - basic_multiallocation_chain tmp(boost::interprocess::move(other)); + basic_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other)); this->swap(tmp); return *this; } @@ -144,7 +144,7 @@ template class transform_multiallocation_chain { private: - BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain) + BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain) MultiallocationChain holder_; typedef typename MultiallocationChain::void_pointer void_pointer; @@ -165,17 +165,17 @@ class transform_multiallocation_chain : holder_() {} - transform_multiallocation_chain(BOOST_INTERPROCESS_RV_REF(transform_multiallocation_chain) other) + transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other) : holder_() { this->swap(other); } - transform_multiallocation_chain(BOOST_INTERPROCESS_RV_REF(MultiallocationChain) other) - : holder_(boost::interprocess::move(other)) + transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(MultiallocationChain) other) + : holder_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other)) {} - transform_multiallocation_chain& operator=(BOOST_INTERPROCESS_RV_REF(transform_multiallocation_chain) other) + transform_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other) { - transform_multiallocation_chain tmp(boost::interprocess::move(other)); + transform_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other)); this->swap(tmp); return *this; } @@ -230,7 +230,7 @@ class transform_multiallocation_chain MultiallocationChain extract_multiallocation_chain() { - return MultiallocationChain(boost::interprocess::move(holder_)); + return MultiallocationChain(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder_)); } }; @@ -240,6 +240,6 @@ class transform_multiallocation_chain // namespace container { // namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //BOOST_CONTAINERS_DETAIL_MULTIALLOCATION_CHAIN_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/node_alloc_holder.hpp b/3party/boost/boost/interprocess/containers/container/detail/node_alloc_holder.hpp index 6c763bc28c..102542f7ac 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/node_alloc_holder.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/node_alloc_holder.hpp @@ -15,26 +15,26 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #include #include -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP namespace boost { @@ -60,7 +60,7 @@ struct scoped_deallocator void priv_deallocate(allocator_v2) { m_alloc.deallocate_one(m_ptr); } - BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator) + BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator) public: @@ -74,7 +74,7 @@ struct scoped_deallocator ~scoped_deallocator() { if (m_ptr)priv_deallocate(alloc_version()); } - scoped_deallocator(BOOST_INTERPROCESS_RV_REF(scoped_deallocator) o) + scoped_deallocator(BOOST_MOVE_MACRO_RV_REF(scoped_deallocator) o) : m_ptr(o.m_ptr), m_alloc(o.m_alloc) { o.release(); } @@ -128,7 +128,7 @@ class allocator_multialloc_chain_node_deallocator ~allocator_multialloc_chain_node_deallocator() { if(!c_.empty()) - a_.deallocate_individual(boost::interprocess::move(c_)); + a_.deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(c_)); } }; @@ -177,7 +177,7 @@ struct node_alloc_holder typedef allocator_destroyer Destroyer; private: - BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(node_alloc_holder) public: @@ -189,14 +189,14 @@ struct node_alloc_holder : members_(other.node_alloc()) {} - node_alloc_holder(BOOST_INTERPROCESS_RV_REF(node_alloc_holder) other) - : members_(boost::interprocess::move(other.node_alloc())) + node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other) + : members_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other.node_alloc())) { this->swap(other); } - node_alloc_holder & operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(node_alloc_holder) other) + node_alloc_holder & operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(node_alloc_holder) other) { members_.assign(other.node_alloc()); } - node_alloc_holder & operator=(BOOST_INTERPROCESS_RV_REF(node_alloc_holder) other) + node_alloc_holder & operator=(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other) { members_.assign(other.node_alloc()); } template @@ -205,7 +205,7 @@ struct node_alloc_holder {} template - node_alloc_holder(BOOST_INTERPROCESS_RV_REF(ValAlloc) a, const Pred &c) + node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(ValAlloc) a, const Pred &c) : members_(a, typename ICont::value_compare(c)) {} @@ -240,7 +240,7 @@ struct node_alloc_holder template static void construct(const NodePtr &ptr, - BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value) + BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value) { typedef typename Node::hook_type hook_type; typedef typename Node::value_type::first_type first_type; @@ -251,9 +251,9 @@ struct node_alloc_holder new(static_cast(nodeptr))hook_type(); //Now construct pair members_holder value_type *valueptr = &nodeptr->get_data(); - new((void*)&valueptr->first) first_type(boost::interprocess::move(value.first)); + new((void*)&valueptr->first) first_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.first)); BOOST_TRY{ - new((void*)&valueptr->second) second_type(boost::interprocess::move(value.second)); + new((void*)&valueptr->second) second_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.second)); } BOOST_CATCH(...){ valueptr->first.~first_type(); @@ -275,14 +275,14 @@ struct node_alloc_holder template static void construct(const NodePtr &ptr, Args &&...args) - { new((void*)containers_detail::get_pointer(ptr)) Node(boost::interprocess::forward(args)...); } + { new((void*)containers_detail::get_pointer(ptr)) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } template NodePtr create_node(Args &&...args) { NodePtr p = this->allocate_one(); Deallocator node_deallocator(p, this->node_alloc()); - self_t::construct(p, boost::interprocess::forward(args)...); + self_t::construct(p, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); node_deallocator.release(); return (p); } @@ -383,7 +383,7 @@ struct node_alloc_holder if(constructed){ this->destroy(p); } - this->node_alloc().deallocate_individual(boost::interprocess::move(mem)); + this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem)); BOOST_RETHROW } BOOST_CATCH_END @@ -399,9 +399,9 @@ struct node_alloc_holder typename NodeAlloc::multiallocation_chain chain; allocator_destroyer_and_chain_builder builder(this->node_alloc(), chain); this->icont().clear_and_dispose(builder); - BOOST_STATIC_ASSERT((::boost::interprocess::is_movable::value == true)); + BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value == true)); if(!chain.empty()) - this->node_alloc().deallocate_individual(boost::interprocess::move(chain)); + this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain)); } icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1) @@ -496,6 +496,6 @@ struct node_alloc_holder } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // BOOST_CONTAINERS_DETAIL_NODE_ALLOC_HPP_ diff --git a/3party/boost/boost/interprocess/containers/container/detail/node_pool_impl.hpp b/3party/boost/boost/interprocess/containers/container/detail/node_pool_impl.hpp index b69dabe4eb..90f629636d 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/node_pool_impl.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/node_pool_impl.hpp @@ -15,18 +15,18 @@ # pragma once #endif -#include -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP #include #include #include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP +#include #include #include //std::unary_function @@ -120,7 +120,7 @@ class private_node_pool_impl multiallocation_chain chain; chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n); m_allocated += n; - return boost::interprocess::move(chain); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain); } void deallocate_nodes(multiallocation_chain chain) @@ -185,7 +185,7 @@ class private_node_pool_impl } } //We should have removed all the nodes from the free list - assert(m_freelist.empty()); + BOOST_ASSERT(m_freelist.empty()); //Now pass all the node to the free list again m_freelist.splice_after @@ -204,7 +204,7 @@ class private_node_pool_impl void purge_blocks() { //check for memory leaks - assert(m_allocated==0); + BOOST_ASSERT(m_allocated==0); std::size_t blocksize = get_rounded_size (m_real_node_size*m_nodes_per_block, alignment_of::value); typename blockslist_t::iterator @@ -222,8 +222,8 @@ class private_node_pool_impl void swap(private_node_pool_impl &other) { - assert(m_nodes_per_block == other.m_nodes_per_block); - assert(m_real_node_size == other.m_real_node_size); + BOOST_ASSERT(m_nodes_per_block == other.m_nodes_per_block); + BOOST_ASSERT(m_real_node_size == other.m_real_node_size); std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base); m_blocklist.swap(other.m_blocklist); m_freelist.swap(other.m_freelist); @@ -289,7 +289,7 @@ class private_node_pool_impl //We put the node at the beginning of the free node list node_t * to_deallocate = static_cast(pElem); m_freelist.push_front(*to_deallocate); - assert(m_allocated>0); + BOOST_ASSERT(m_allocated>0); --m_allocated; } @@ -361,6 +361,6 @@ class private_node_pool_impl } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/pair.hpp b/3party/boost/boost/interprocess/containers/container/detail/pair.hpp index ee39133488..da705729c4 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/pair.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/pair.hpp @@ -17,18 +17,18 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP #include //std::pair -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif namespace boost { @@ -39,7 +39,7 @@ template struct pair { private: - BOOST_COPYABLE_AND_MOVABLE(pair) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(pair) public: typedef T1 first_type; @@ -61,8 +61,8 @@ struct pair {} template - pair(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p) - : first(boost::interprocess::move(p.first)), second(boost::interprocess::move(p.second)) + pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p) + : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second)) {} pair() @@ -79,40 +79,40 @@ struct pair : first(x.first), second(x.second) {} - pair(BOOST_INTERPROCESS_RV_REF(pair) p) - : first(boost::interprocess::move(p.first)), second(boost::interprocess::move(p.second)) + pair(BOOST_MOVE_MACRO_RV_REF(pair) p) + : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second)) {} template - pair(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(pair, D, S) p) - : first(boost::interprocess::move(p.first)), second(boost::interprocess::move(p.second)) + pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(pair, D, S) p) + : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second)) {} #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING template pair(U &&u, Args &&... args) - : first(boost::interprocess::forward(u)) - , second(boost::interprocess::forward(args)...) + : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward(u)) + , second(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...) {} #else template pair( BOOST_CONTAINERS_PARAM(U, u) - #ifndef BOOST_HAS_RVALUE_REFS + #ifdef BOOST_NO_RVALUE_REFERENCES , typename containers_detail::disable_if - < containers_detail::is_same > >::type* = 0 + < containers_detail::is_same > >::type* = 0 #endif ) - : first(boost::interprocess::forward(const_cast(u))) + : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward(const_cast(u))) {} #define BOOST_PP_LOCAL_MACRO(n) \ template \ pair(BOOST_CONTAINERS_PARAM(U, u) \ ,BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \ - : first(boost::interprocess::forward(const_cast(u))) \ + : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward(const_cast(u))) \ , second(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \ {} \ //! @@ -120,32 +120,32 @@ struct pair #include BOOST_PP_LOCAL_ITERATE() #endif - pair& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(pair) p) + pair& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(pair) p) { first = p.first; second = p.second; return *this; } - pair& operator=(BOOST_INTERPROCESS_RV_REF(pair) p) + pair& operator=(BOOST_MOVE_MACRO_RV_REF(pair) p) { - first = boost::interprocess::move(p.first); - second = boost::interprocess::move(p.second); + first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first); + second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second); return *this; } - pair& operator=(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p) + pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p) { - first = boost::interprocess::move(p.first); - second = boost::interprocess::move(p.second); + first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first); + second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second); return *this; } template - pair& operator=(BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p) + pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p) { - first = boost::interprocess::move(p.first); - second = boost::interprocess::move(p.second); + first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first); + second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second); return *this; } @@ -192,8 +192,21 @@ inline void swap(pair& x, pair& y) } //namespace containers_detail { } //namespace container { + +//Without this specialization recursive flat_(multi)map instantiation fails +//because is_enum needs to instantiate the recursive pair, leading to a compilation error). +//This breaks the cycle clearly stating that pair is not an enum avoiding any instantiation. +template +struct is_enum; + +template +struct is_enum< ::boost::container::containers_detail::pair > +{ + static const bool value = false; +}; + } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_PAIR_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/pool_common.hpp b/3party/boost/boost/interprocess/containers/container/detail/pool_common.hpp index 12e3649ba1..c6241bfa59 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/pool_common.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/pool_common.hpp @@ -15,7 +15,7 @@ # pragma once #endif -#include +#include "config_begin.hpp" #include #include @@ -47,6 +47,6 @@ struct is_stateless_segment_manager } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/preprocessor.hpp b/3party/boost/boost/interprocess/containers/container/detail/preprocessor.hpp index 050a5531d0..2f32aefa85 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/preprocessor.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/preprocessor.hpp @@ -15,8 +15,13 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" + +#ifndef BOOST_NO_RVALUE_REFERENCES +#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP +#endif + +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING #error "This file is not needed when perfect forwarding is available" @@ -36,7 +41,7 @@ //This cast is ugly but it is necessary until "perfect forwarding" //is achieved in C++0x. Meanwhile, if we want to be able to //bind rvalues with non-const references, we have to be ugly -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES #define BOOST_CONTAINERS_PP_PARAM_LIST(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ //! @@ -46,7 +51,7 @@ //! #endif -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES #define BOOST_CONTAINERS_PARAM(U, u) \ U && u \ //! @@ -56,10 +61,22 @@ //! #endif -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + #define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \ - BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \ + BOOST_PP_CAT(m_p, n) (BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ //! + +#else + +#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (static_cast( BOOST_PP_CAT(p, n) )) \ +//! + +#endif + #else #define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \ BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ @@ -70,10 +87,23 @@ BOOST_PP_CAT(++m_p, n) \ //! -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES + +#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ +//! + +#else + #define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ //! + +#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #else #define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ @@ -81,18 +111,28 @@ #endif #define BOOST_CONTAINERS_PP_PARAM_FORWARD(z, n, data) \ -boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ +BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ //! +#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + #define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \ -boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ +::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \ //! +#else + +#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \ +BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ +//! + +#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + #define BOOST_CONTAINERS_PP_MEMBER_IT_FORWARD(z, n, data) \ BOOST_PP_CAT(*m_p, n) \ //! -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #else #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING diff --git a/3party/boost/boost/interprocess/containers/container/detail/stored_ref.hpp b/3party/boost/boost/interprocess/containers/container/detail/stored_ref.hpp new file mode 100644 index 0000000000..965b73880c --- /dev/null +++ b/3party/boost/boost/interprocess/containers/container/detail/stored_ref.hpp @@ -0,0 +1,92 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2009. 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/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINERS_DETAIL_STORED_REF_HPP +#define BOOST_CONTAINERS_DETAIL_STORED_REF_HPP + +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#ifndef BOOST_NO_RVALUE_REFERENCES + +namespace boost{ +namespace container{ +namespace containers_detail{ + +template +struct stored_ref +{ + + static T && forward(T &t) + #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + { return t; } + #else + { return BOOST_CONTAINER_MOVE_NAMESPACE::move(t); } + #endif +}; + +template +struct stored_ref +{ + static const T && forward(const T &t) + #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + { return t; } + #else + { return static_cast(t); } + #endif +}; + +template +struct stored_ref +{ + static T && forward(T &t) + #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + { return t; } + #else + { return BOOST_CONTAINER_MOVE_NAMESPACE::move(t); } + #endif +}; + +template +struct stored_ref +{ + static const T && forward(const T &t) + #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + { return t; } + #else + { return static_cast(t); } + #endif +}; + +template +struct stored_ref +{ + static const T & forward(const T &t) + { return t; } +}; + +template +struct stored_ref +{ + static T & forward(T &t) + { return t; } +}; + +} //namespace containers_detail{ +} //namespace container{ +} //namespace boost{ + +#else +#error "This header can be included only for compiler with rvalue references" +#endif //BOOST_NO_RVALUE_REFERENCES + +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP + +#endif //BOOST_CONTAINERS_DETAIL_STORED_REF_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/transform_iterator.hpp b/3party/boost/boost/interprocess/containers/container/detail/transform_iterator.hpp index 96b22a26db..96ea1459cd 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/transform_iterator.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/transform_iterator.hpp @@ -18,9 +18,9 @@ # pragma once #endif -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP #include namespace boost { @@ -47,7 +47,7 @@ struct operator_arrow_proxy : m_value(px) {} - T* operator->() const { return &m_value; } + T* operator->() const { return const_cast(&m_value); } // This function is needed for MWCW and BCC, which won't call operator-> // again automatically per 13.3.1.2 para 8 // operator T*() const { return &m_value; } @@ -171,6 +171,6 @@ make_transform_iterator(Iterator it, UnaryFunc fun) } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_TRANSFORM_ITERATORS_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/tree.hpp b/3party/boost/boost/interprocess/containers/container/detail/tree.hpp index 01779682ef..bf0d1f4210 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/tree.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/tree.hpp @@ -7,58 +7,27 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_tree file. Modified by Ion Gaztanaga 2005. -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ + #ifndef BOOST_CONTAINERS_TREE_HPP #define BOOST_CONTAINERS_TREE_HPP -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include #include #include #include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif #include //std::pair @@ -153,7 +122,7 @@ struct rbtree_node template rbtree_node(Args &&...args) - : m_data(boost::interprocess::forward(args)...) + : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...) {} #endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -195,12 +164,12 @@ struct rbtree_node public: template - static void construct(node_type *ptr, BOOST_INTERPROCESS_FWD_REF(Convertible) convertible) - { new(ptr) node_type(boost::interprocess::forward(convertible)); } + static void construct(node_type *ptr, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible) + { new(ptr) node_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(convertible)); } }; }//namespace containers_detail { -#if !defined(BOOST_HAS_RVALUE_REFS) +#if defined(BOOST_NO_RVALUE_REFERENCES) template struct has_own_construct_from_it < boost::container::containers_detail::rbtree_node > @@ -298,7 +267,7 @@ class rbtree AllocHolder &m_holder; Icont &m_icont; }; - BOOST_COPYABLE_AND_MOVABLE(rbtree) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(rbtree) public: @@ -468,14 +437,14 @@ class rbtree (x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc())); } - rbtree(BOOST_INTERPROCESS_RV_REF(rbtree) x) + rbtree(BOOST_MOVE_MACRO_RV_REF(rbtree) x) : AllocHolder(x, x.key_comp()) { this->swap(x); } ~rbtree() {} //AllocHolder clears the tree - rbtree& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(rbtree) x) + rbtree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(rbtree) x) { if (this != &x) { //Transfer all the nodes to a temporary tree @@ -500,7 +469,7 @@ class rbtree return *this; } - rbtree& operator=(BOOST_INTERPROCESS_RV_REF(rbtree) mx) + rbtree& operator=(BOOST_MOVE_MACRO_RV_REF(rbtree) mx) { this->clear(); this->swap(mx); return *this; } public: @@ -620,9 +589,9 @@ class rbtree template iterator insert_unique_commit - (BOOST_INTERPROCESS_FWD_REF(MovableConvertible) mv, insert_commit_data &data) + (BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv, insert_commit_data &data) { - NodePtr tmp = AllocHolder::create_node(boost::interprocess::forward(mv)); + NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(mv)); iiterator it(this->icont().insert_unique_commit(*tmp, data)); return iterator(it); } @@ -639,7 +608,7 @@ class rbtree } template - std::pair insert_unique(BOOST_INTERPROCESS_FWD_REF(MovableConvertible) mv) + std::pair insert_unique(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv) { insert_commit_data data; std::pair ret = @@ -647,7 +616,7 @@ class rbtree if(!ret.second) return ret; return std::pair - (this->insert_unique_commit(boost::interprocess::forward(mv), data), true); + (this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward(mv), data), true); } private: @@ -683,23 +652,23 @@ class rbtree template iterator emplace_unique(Args&&... args) - { return this->emplace_unique_impl(AllocHolder::create_node(boost::interprocess::forward(args)...)); } + { return this->emplace_unique_impl(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } template iterator emplace_hint_unique(const_iterator hint, Args&&... args) - { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(boost::interprocess::forward(args)...)); } + { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } template iterator emplace_equal(Args&&... args) { - NodePtr p(AllocHolder::create_node(boost::interprocess::forward(args)...)); + NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); return iterator(this->icont().insert_equal(this->icont().end(), *p)); } template iterator emplace_hint_equal(const_iterator hint, Args&&... args) { - NodePtr p(AllocHolder::create_node(boost::interprocess::forward(args)...)); + NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); return iterator(this->icont().insert_equal(hint.get(), *p)); } @@ -768,14 +737,14 @@ class rbtree } template - iterator insert_unique(const_iterator hint, BOOST_INTERPROCESS_FWD_REF(MovableConvertible) mv) + iterator insert_unique(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv) { insert_commit_data data; std::pair ret = this->insert_unique_check(hint, KeyOfValue()(mv), data); if(!ret.second) return ret.first; - return this->insert_unique_commit(boost::interprocess::forward(mv), data); + return this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward(mv), data); } template @@ -801,9 +770,9 @@ class rbtree } template - iterator insert_equal(BOOST_INTERPROCESS_FWD_REF(MovableConvertible) mv) + iterator insert_equal(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv) { - NodePtr p(AllocHolder::create_node(boost::interprocess::forward(mv))); + NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(mv))); return iterator(this->icont().insert_equal(this->icont().end(), *p)); } @@ -814,9 +783,9 @@ class rbtree } template - iterator insert_equal(const_iterator hint, BOOST_INTERPROCESS_FWD_REF(MovableConvertible) mv) + iterator insert_equal(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv) { - NodePtr p(AllocHolder::create_node(boost::interprocess::forward(mv))); + NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(mv))); return iterator(this->icont().insert_equal(hint.get(), *p)); } @@ -1061,6 +1030,6 @@ struct has_trivial_destructor_after_move */ } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //BOOST_CONTAINERS_TREE_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/type_traits.hpp b/3party/boost/boost/interprocess/containers/container/detail/type_traits.hpp index abbb78feae..d2a93c63d1 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/type_traits.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/type_traits.hpp @@ -19,7 +19,7 @@ # pragma once #endif -#include +#include "config_begin.hpp" namespace boost { namespace container { @@ -162,5 +162,5 @@ struct is_same #endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/utilities.hpp b/3party/boost/boost/interprocess/containers/container/detail/utilities.hpp index 9b70bbdef2..6bd5ab51e0 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/utilities.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/utilities.hpp @@ -11,13 +11,15 @@ #ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP #define BOOST_CONTAINERS_DETAIL_UTILITIES_HPP -#include +#include "config_begin.hpp" #include #include #include -#include -#include -#include +#include +#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP #include namespace boost { @@ -96,12 +98,43 @@ struct ct_rounded_size enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo }; }; +template +struct __rw_is_enum +{ +struct _C_no { }; +struct _C_yes { int _C_dummy [2]; }; + +struct _C_indirect { +// prevent classes with user-defined conversions from matching + +// use double to prevent float->int gcc conversion warnings +_C_indirect (double); +}; + +// nested struct gets rid of bogus gcc errors +struct _C_nest { +// supply first argument to prevent HP aCC warnings +static _C_no _C_is (int, ...); +static _C_yes _C_is (int, _C_indirect); + +static _TypeT _C_make_T (); +}; + +enum { +_C_val = sizeof (_C_yes) +== sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ())) +&& !::boost::is_fundamental<_TypeT>::value +}; + +}; + template struct move_const_ref_type : if_c - < ::boost::is_fundamental::value || ::boost::is_pointer::value + < ::boost::is_fundamental::value || ::boost::is_pointer::value || + ::boost::is_member_pointer::value || ::boost::is_enum::value ,const T & - ,BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(T) + ,BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(T) > {}; @@ -110,6 +143,6 @@ struct move_const_ref_type } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_UTILITIES_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/value_init.hpp b/3party/boost/boost/interprocess/containers/container/detail/value_init.hpp index 560c4965d6..e16db2c9b9 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/value_init.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/value_init.hpp @@ -17,8 +17,8 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP namespace boost { namespace container { @@ -38,6 +38,6 @@ struct value_init } //namespace container { } //namespace boost { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_VALUE_INIT_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/variadic_templates_tools.hpp b/3party/boost/boost/interprocess/containers/container/detail/variadic_templates_tools.hpp index a5cb89c35f..eb17470af4 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/variadic_templates_tools.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/variadic_templates_tools.hpp @@ -15,9 +15,9 @@ # pragma once #endif -#include -#include -#include +#include "config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP #include //std::size_t namespace boost { @@ -148,6 +148,6 @@ struct build_number_seq<0, index_tuple > }}} //namespace boost { namespace container { namespace containers_detail { -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP diff --git a/3party/boost/boost/interprocess/containers/container/detail/version_type.hpp b/3party/boost/boost/interprocess/containers/container/detail/version_type.hpp index f31e6000c7..8b23f4133a 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/version_type.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/version_type.hpp @@ -16,8 +16,10 @@ #ifndef BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP #define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP -#include -#include +#include "config_begin.hpp" + +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP namespace boost{ diff --git a/3party/boost/boost/interprocess/containers/container/detail/workaround.hpp b/3party/boost/boost/interprocess/containers/container/detail/workaround.hpp index 837e583670..d16b590e1f 100644 --- a/3party/boost/boost/interprocess/containers/container/detail/workaround.hpp +++ b/3party/boost/boost/interprocess/containers/container/detail/workaround.hpp @@ -11,14 +11,14 @@ #ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP #define BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP -#include +#include "config_begin.hpp" -#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)\ - && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ + && !defined(BOOST_MOVE_MACRO_DISABLE_VARIADIC_TMPL) #define BOOST_CONTAINERS_PERFECT_FORWARDING #endif -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //#ifndef BOOST_CONTAINERS_DETAIL_WORKAROUND_HPP diff --git a/3party/boost/boost/interprocess/containers/container/flat_map.hpp b/3party/boost/boost/interprocess/containers/container/flat_map.hpp index ba7fabfa89..c40a827eef 100644 --- a/3party/boost/boost/interprocess/containers/container/flat_map.hpp +++ b/3party/boost/boost/interprocess/containers/container/flat_map.hpp @@ -15,18 +15,18 @@ # pragma once #endif -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include #include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { @@ -76,7 +76,7 @@ class flat_map { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(flat_map) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_map) //This is the tree that we should store if pair was movable typedef containers_detail::flat_tree, @@ -121,23 +121,32 @@ class flat_map public: // typedefs: - typedef typename tree_t::key_type key_type; - typedef typename tree_t::value_type value_type; - typedef typename tree_t::pointer pointer; - typedef typename tree_t::const_pointer const_pointer; - typedef typename tree_t::reference reference; - typedef typename tree_t::const_reference const_reference; - typedef typename tree_t::value_compare value_compare; - typedef T mapped_type; - typedef typename tree_t::key_compare key_compare; - typedef typename tree_t::iterator iterator; - typedef typename tree_t::const_iterator const_iterator; - typedef typename tree_t::reverse_iterator reverse_iterator; - typedef typename tree_t::const_reverse_iterator const_reverse_iterator; - typedef typename tree_t::size_type size_type; - typedef typename tree_t::difference_type difference_type; - typedef typename tree_t::allocator_type allocator_type; - typedef typename tree_t::stored_allocator_type stored_allocator_type; + typedef typename impl_tree_t::key_type key_type; + typedef T mapped_type; + typedef typename std::pair value_type; + typedef typename Alloc::pointer pointer; + typedef typename Alloc::const_pointer const_pointer; + typedef typename Alloc::reference reference; + typedef typename Alloc::const_reference const_reference; + typedef containers_detail::flat_tree_value_compare + < Pred + , containers_detail::select1st< std::pair > + , std::pair > value_compare; + typedef Pred key_compare; + typedef typename containers_detail:: + get_flat_tree_iterators::iterator iterator; + typedef typename containers_detail:: + get_flat_tree_iterators::const_iterator const_iterator; + typedef typename containers_detail:: + get_flat_tree_iterators + ::reverse_iterator reverse_iterator; + typedef typename containers_detail:: + get_flat_tree_iterators + ::const_reverse_iterator const_reverse_iterator; + typedef typename impl_tree_t::size_type size_type; + typedef typename impl_tree_t::difference_type difference_type; + typedef Alloc allocator_type; + typedef Alloc stored_allocator_type; //! Effects: Constructs an empty flat_map using the specified //! comparison object and allocator. @@ -183,14 +192,14 @@ class flat_map //! Complexity: Construct. //! //! Postcondition: x is emptied. - flat_map(BOOST_INTERPROCESS_RV_REF(flat_map) x) - : m_flat_tree(boost::interprocess::move(x.m_flat_tree)) + flat_map(BOOST_MOVE_MACRO_RV_REF(flat_map) x) + : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - flat_map& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(flat_map) x) + flat_map& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_map) x) { m_flat_tree = x.m_flat_tree; return *this; } //! Effects: Move constructs a flat_map. @@ -199,8 +208,8 @@ class flat_map //! Complexity: Construct. //! //! Postcondition: x is emptied. - flat_map& operator=(BOOST_INTERPROCESS_RV_REF(flat_map) mx) - { m_flat_tree = boost::interprocess::move(mx.m_flat_tree); return *this; } + flat_map& operator=(BOOST_MOVE_MACRO_RV_REF(flat_map) mx) + { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -376,13 +385,13 @@ class flat_map //! Returns: A reference to the mapped_type corresponding to x in *this. //! //! Complexity: Logarithmic. - T &operator[](BOOST_INTERPROCESS_RV_REF(key_type) mk) + T &operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk) { key_type &k = mk; iterator i = lower_bound(k); // i->first is greater than or equivalent to k. if (i == end() || key_comp()(k, (*i).first)) - i = insert(i, value_type(boost::interprocess::move(k), boost::interprocess::move(T()))); + i = insert(i, value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T()))); return (*i).second; } @@ -445,9 +454,9 @@ class flat_map //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - std::pair insert(BOOST_INTERPROCESS_RV_REF(value_type) x) + std::pair insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) { return force >( - m_flat_tree.insert_unique(boost::interprocess::move(force(x)))); } + m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(force(x)))); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -460,10 +469,10 @@ class flat_map //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - std::pair insert(BOOST_INTERPROCESS_RV_REF(impl_value_type) x) + std::pair insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x) { return force > - (m_flat_tree.insert_unique(boost::interprocess::move(x))); + (m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Effects: Inserts a copy of x in the container if and only if there is @@ -490,9 +499,9 @@ class flat_map //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(value_type) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x) { return force_copy( - m_flat_tree.insert_unique(force(position), boost::interprocess::move(force(x)))); } + m_flat_tree.insert_unique(force(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(force(x)))); } //! Effects: Inserts an element move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -503,10 +512,10 @@ class flat_map //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(impl_value_type) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x) { return force_copy( - m_flat_tree.insert_unique(force(position), boost::interprocess::move(x))); + m_flat_tree.insert_unique(force(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Requires: i, j are not iterators into *this. @@ -538,7 +547,7 @@ class flat_map //! Note: If an element it's inserted it might invalidate elements. template iterator emplace(Args&&... args) - { return force_copy(m_flat_tree.emplace_unique(boost::interprocess::forward(args)...)); } + { return force_copy(m_flat_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container if and only if there is @@ -554,7 +563,7 @@ class flat_map //! Note: If an element it's inserted it might invalidate elements. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return force_copy(m_flat_tree.emplace_hint_unique(force(hint), boost::interprocess::forward(args)...)); } + { return force_copy(m_flat_tree.emplace_hint_unique(force(hint), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -809,7 +818,7 @@ class flat_multimap { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(flat_multimap) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multimap) typedef containers_detail::flat_tree, containers_detail::select1st< std::pair >, @@ -851,23 +860,32 @@ class flat_multimap public: // typedefs: - typedef typename tree_t::key_type key_type; - typedef typename tree_t::value_type value_type; - typedef typename tree_t::pointer pointer; - typedef typename tree_t::const_pointer const_pointer; - typedef typename tree_t::reference reference; - typedef typename tree_t::const_reference const_reference; - typedef typename tree_t::value_compare value_compare; - typedef T mapped_type; - typedef typename tree_t::key_compare key_compare; - typedef typename tree_t::iterator iterator; - typedef typename tree_t::const_iterator const_iterator; - typedef typename tree_t::reverse_iterator reverse_iterator; - typedef typename tree_t::const_reverse_iterator const_reverse_iterator; - typedef typename tree_t::size_type size_type; - typedef typename tree_t::difference_type difference_type; - typedef typename tree_t::allocator_type allocator_type; - typedef typename tree_t::stored_allocator_type stored_allocator_type; + typedef typename impl_tree_t::key_type key_type; + typedef T mapped_type; + typedef typename std::pair value_type; + typedef typename Alloc::pointer pointer; + typedef typename Alloc::const_pointer const_pointer; + typedef typename Alloc::reference reference; + typedef typename Alloc::const_reference const_reference; + typedef containers_detail::flat_tree_value_compare + < Pred + , containers_detail::select1st< std::pair > + , std::pair > value_compare; + typedef Pred key_compare; + typedef typename containers_detail:: + get_flat_tree_iterators::iterator iterator; + typedef typename containers_detail:: + get_flat_tree_iterators::const_iterator const_iterator; + typedef typename containers_detail:: + get_flat_tree_iterators + ::reverse_iterator reverse_iterator; + typedef typename containers_detail:: + get_flat_tree_iterators + ::const_reverse_iterator const_reverse_iterator; + typedef typename impl_tree_t::size_type size_type; + typedef typename impl_tree_t::difference_type difference_type; + typedef Alloc allocator_type; + typedef Alloc stored_allocator_type; //! Effects: Constructs an empty flat_multimap using the specified comparison //! object and allocator. @@ -914,21 +932,21 @@ class flat_multimap //! Complexity: Construct. //! //! Postcondition: x is emptied. - flat_multimap(BOOST_INTERPROCESS_RV_REF(flat_multimap) x) - : m_flat_tree(boost::interprocess::move(x.m_flat_tree)) + flat_multimap(BOOST_MOVE_MACRO_RV_REF(flat_multimap) x) + : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree)) { } //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - flat_multimap& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(flat_multimap) x) + flat_multimap& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multimap) x) { m_flat_tree = x.m_flat_tree; return *this; } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - flat_multimap& operator=(BOOST_INTERPROCESS_RV_REF(flat_multimap) mx) - { m_flat_tree = boost::interprocess::move(mx.m_flat_tree); return *this; } + flat_multimap& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multimap) mx) + { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -1075,8 +1093,8 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return force_copy(m_flat_tree.insert_equal(boost::interprocess::move(x))); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return force_copy(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Effects: Inserts a new value move-constructed from x and returns //! the iterator pointing to the newly inserted element. @@ -1085,8 +1103,8 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(BOOST_INTERPROCESS_RV_REF(impl_value_type) x) - { return force_copy(m_flat_tree.insert_equal(boost::interprocess::move(x))); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x) + { return force_copy(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1113,11 +1131,11 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(value_type) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x) { return force_copy (m_flat_tree.insert_equal(force(position) - , boost::interprocess::move(x))); + , BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Effects: Inserts a value move constructed from x in the container. @@ -1131,10 +1149,10 @@ class flat_multimap //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(impl_value_type) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x) { return force_copy( - m_flat_tree.insert_equal(force(position), boost::interprocess::move(x))); + m_flat_tree.insert_equal(force(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Requires: i, j are not iterators into *this. @@ -1161,7 +1179,7 @@ class flat_multimap //! Note: If an element it's inserted it might invalidate elements. template iterator emplace(Args&&... args) - { return force_copy(m_flat_tree.emplace_equal(boost::interprocess::forward(args)...)); } + { return force_copy(m_flat_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container. @@ -1179,7 +1197,7 @@ class flat_multimap iterator emplace_hint(const_iterator hint, Args&&... args) { return force_copy(m_flat_tree.emplace_hint_equal - (force(hint), boost::interprocess::forward(args)...)); + (force(hint), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...)); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -1406,6 +1424,6 @@ struct has_trivial_destructor_after_move< boost::container::flat_multimap +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif /* BOOST_CONTAINERS_FLAT_MAP_HPP */ diff --git a/3party/boost/boost/interprocess/containers/container/flat_set.hpp b/3party/boost/boost/interprocess/containers/container/flat_set.hpp index 4557273a41..7ebf4e0d40 100644 --- a/3party/boost/boost/interprocess/containers/container/flat_set.hpp +++ b/3party/boost/boost/interprocess/containers/container/flat_set.hpp @@ -15,16 +15,16 @@ # pragma once #endif -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { @@ -65,7 +65,7 @@ class flat_set { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(flat_set) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_set) typedef containers_detail::flat_tree, Pred, Alloc> tree_t; tree_t m_flat_tree; // flat tree representing flat_set typedef typename containers_detail:: @@ -139,21 +139,21 @@ class flat_set //! Complexity: Construct. //! //! Postcondition: x is emptied. - flat_set(BOOST_INTERPROCESS_RV_REF(flat_set) mx) - : m_flat_tree(boost::interprocess::move(mx.m_flat_tree)) + flat_set(BOOST_MOVE_MACRO_RV_REF(flat_set) mx) + : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - flat_set& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(flat_set) x) + flat_set& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_set) x) { m_flat_tree = x.m_flat_tree; return *this; } //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - flat_set& operator=(BOOST_INTERPROCESS_RV_REF(flat_set) mx) - { m_flat_tree = boost::interprocess::move(mx.m_flat_tree); return *this; } + flat_set& operator=(BOOST_MOVE_MACRO_RV_REF(flat_set) mx) + { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -331,12 +331,12 @@ class flat_set std::pair insert(insert_const_ref_type x) { return priv_insert(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) std::pair insert(T &x) { return this->insert(const_cast(x)); } template - std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(u); } #endif @@ -351,8 +351,8 @@ class flat_set //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - std::pair insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_flat_tree.insert_unique(boost::interprocess::move(x)); } + std::pair insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container if and only if there is //! no element in the container with key equivalent to the key of x. @@ -368,12 +368,12 @@ class flat_set iterator insert(const_iterator p, insert_const_ref_type x) { return priv_insert(p, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(position, u); } #endif @@ -386,8 +386,8 @@ class flat_set //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_flat_tree.insert_unique(position, boost::interprocess::move(x)); } + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_flat_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -418,7 +418,7 @@ class flat_set //! Note: If an element it's inserted it might invalidate elements. template iterator emplace(Args&&... args) - { return m_flat_tree.emplace_unique(boost::interprocess::forward(args)...); } + { return m_flat_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container if and only if there is @@ -434,7 +434,7 @@ class flat_set //! Note: If an element it's inserted it might invalidate elements. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_flat_tree.emplace_hint_unique(hint, boost::interprocess::forward(args)...); } + { return m_flat_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -685,7 +685,7 @@ class flat_multiset { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(flat_multiset) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multiset) typedef containers_detail::flat_tree, Pred, Alloc> tree_t; tree_t m_flat_tree; // flat tree representing flat_multiset typedef typename containers_detail:: @@ -740,15 +740,15 @@ class flat_multiset flat_multiset(const flat_multiset& x) : m_flat_tree(x.m_flat_tree) {} - flat_multiset(BOOST_INTERPROCESS_RV_REF(flat_multiset) x) - : m_flat_tree(boost::interprocess::move(x.m_flat_tree)) + flat_multiset(BOOST_MOVE_MACRO_RV_REF(flat_multiset) x) + : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree)) {} - flat_multiset& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(flat_multiset) x) + flat_multiset& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multiset) x) { m_flat_tree = x.m_flat_tree; return *this; } - flat_multiset& operator=(BOOST_INTERPROCESS_RV_REF(flat_multiset) mx) - { m_flat_tree = boost::interprocess::move(mx.m_flat_tree); return *this; } + flat_multiset& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multiset) mx) + { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -922,12 +922,12 @@ class flat_multiset iterator insert(insert_const_ref_type x) { return priv_insert(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(T &x) { return this->insert(const_cast(x)); } template - iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(u); } #endif @@ -938,8 +938,8 @@ class flat_multiset //! to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_flat_tree.insert_equal(boost::interprocess::move(x)); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -954,12 +954,12 @@ class flat_multiset iterator insert(const_iterator p, insert_const_ref_type x) { return priv_insert(p, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(position, u); } #endif @@ -973,8 +973,8 @@ class flat_multiset //! right before p) plus insertion linear to the elements with bigger keys than x. //! //! Note: If an element it's inserted it might invalidate elements. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_flat_tree.insert_equal(position, boost::interprocess::move(x)); } + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_flat_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -1000,7 +1000,7 @@ class flat_multiset //! Note: If an element it's inserted it might invalidate elements. template iterator emplace(Args&&... args) - { return m_flat_tree.emplace_equal(boost::interprocess::forward(args)...); } + { return m_flat_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container. @@ -1015,7 +1015,7 @@ class flat_multiset //! Note: If an element it's inserted it might invalidate elements. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_flat_tree.emplace_hint_equal(hint, boost::interprocess::forward(args)...); } + { return m_flat_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -1240,6 +1240,6 @@ namespace container { }} -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif /* BOOST_CONTAINERS_FLAT_SET_HPP */ diff --git a/3party/boost/boost/interprocess/containers/container/list.hpp b/3party/boost/boost/interprocess/containers/container/list.hpp index a6b395c727..1159ef15e8 100644 --- a/3party/boost/boost/interprocess/containers/container/list.hpp +++ b/3party/boost/boost/interprocess/containers/container/list.hpp @@ -6,39 +6,6 @@ // // See http://www.boost.org/libs/container for documentation. // -////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_list.h file. Modified by Ion Gaztanaga 2004 -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ #ifndef BOOST_CONTAINERS_LIST_HPP_ #define BOOST_CONTAINERS_LIST_HPP_ @@ -47,23 +14,23 @@ # pragma once #endif -#include -#include -#include -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP #include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP #include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #else //Preprocessor library to emulate perfect forwarding -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif #include @@ -105,7 +72,7 @@ struct list_node template list_node(Args &&...args) - : m_data(boost::interprocess::forward(args)...) + : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...) {} #else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -231,7 +198,7 @@ class list /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(list) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(list) typedef difference_type list_difference_type; typedef pointer list_pointer; typedef const_pointer list_const_pointer; @@ -390,8 +357,8 @@ class list //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - list(BOOST_INTERPROCESS_RV_REF(list) x) - : AllocHolder(boost::interprocess::move(static_cast(x))) + list(BOOST_MOVE_MACRO_RV_REF(list) x) + : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast(x))) {} //! Effects: Constructs a list that will use a copy of allocator a @@ -572,11 +539,11 @@ class list void push_front(insert_const_ref_type x) { this->insert(this->cbegin(), x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_front(T &x) { push_front(const_cast(x)); } template - void push_front(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_front(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { this->insert(this->cbegin(), u); } #endif @@ -586,8 +553,8 @@ class list //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. - void push_front(BOOST_INTERPROCESS_RV_REF(T) x) - { this->insert(this->cbegin(), boost::interprocess::move(x)); } + void push_front(BOOST_MOVE_MACRO_RV_REF(T) x) + { this->insert(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Removes the last element from the list. //! @@ -597,11 +564,11 @@ class list void push_back (insert_const_ref_type x) { this->insert(this->cend(), x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_back(T &x) { push_back(const_cast(x)); } template - void push_back(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_back(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { this->insert(this->cend(), u); } #endif @@ -611,8 +578,8 @@ class list //! Throws: Nothing. //! //! Complexity: Amortized constant time. - void push_back (BOOST_INTERPROCESS_RV_REF(T) x) - { this->insert(this->cend(), boost::interprocess::move(x)); } + void push_back (BOOST_MOVE_MACRO_RV_REF(T) x) + { this->insert(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Removes the first element from the list. //! @@ -749,7 +716,7 @@ class list //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - ThisType& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(ThisType) x) + ThisType& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(ThisType) x) { if (this != &x) { this->assign(x.begin(), x.end()); @@ -765,7 +732,7 @@ class list //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - ThisType& operator=(BOOST_INTERPROCESS_RV_REF(ThisType) mx) + ThisType& operator=(BOOST_MOVE_MACRO_RV_REF(ThisType) mx) { this->clear(); this->swap(mx); @@ -808,11 +775,11 @@ class list iterator insert(const_iterator position, insert_const_ref_type x) { return this->priv_insert(position, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert(position, u); } #endif @@ -823,9 +790,9 @@ class list //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. - iterator insert(const_iterator p, BOOST_INTERPROCESS_RV_REF(T) x) + iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(T) x) { - NodePtr tmp = AllocHolder::create_node(boost::interprocess::move(x)); + NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); return iterator(this->icont().insert(p.get(), *tmp)); } @@ -841,7 +808,7 @@ class list template void emplace_back(Args&&... args) { - this->emplace(this->cend(), boost::interprocess::forward(args)...); + this->emplace(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with @@ -854,7 +821,7 @@ class list template void emplace_front(Args&&... args) { - this->emplace(this->cbegin(), boost::interprocess::forward(args)...); + this->emplace(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with @@ -868,7 +835,7 @@ class list iterator emplace(const_iterator p, Args&&... args) { typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator()); - new ((void*)containers_detail::get_pointer(d.get())) Node(boost::interprocess::forward(args)...); + new ((void*)containers_detail::get_pointer(d.get())) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); NodePtr node = d.get(); d.release(); return iterator(this->icont().insert(p.get(), *node)); @@ -1399,6 +1366,6 @@ namespace container { }} -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // BOOST_CONTAINERS_LIST_HPP_ diff --git a/3party/boost/boost/interprocess/containers/container/map.hpp b/3party/boost/boost/interprocess/containers/container/map.hpp index 7d3ee3eae3..4e6f9384fa 100644 --- a/3party/boost/boost/interprocess/containers/container/map.hpp +++ b/3party/boost/boost/interprocess/containers/container/map.hpp @@ -47,21 +47,21 @@ # pragma once #endif -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP #include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { @@ -99,7 +99,7 @@ class map { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(map) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(map) typedef containers_detail::rbtree, containers_detail::select1st< std::pair >, @@ -193,21 +193,21 @@ class map //! Complexity: Construct. //! //! Postcondition: x is emptied. - map(BOOST_INTERPROCESS_RV_REF(map) x) - : m_tree(boost::interprocess::move(x.m_tree)) + map(BOOST_MOVE_MACRO_RV_REF(map) x) + : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - map& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(map) x) + map& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(map) x) { m_tree = x.m_tree; return *this; } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - map& operator=(BOOST_INTERPROCESS_RV_REF(map) x) - { m_tree = boost::interprocess::move(x.m_tree); return *this; } + map& operator=(BOOST_MOVE_MACRO_RV_REF(map) x) + { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -341,27 +341,27 @@ class map // i->first is greater than or equivalent to k. if (i == end() || key_comp()(k, (*i).first)){ containers_detail::value_init v; - value_type val(k, boost::interprocess::move(v.m_t)); - i = insert(i, boost::interprocess::move(val)); + value_type val(k, BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t)); + i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return (*i).second; } //! Effects: If there is no key equivalent to x in the map, inserts - //! value_type(boost::interprocess::move(x), T()) into the map (the key is move-constructed) + //! value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(x), T()) into the map (the key is move-constructed) //! //! Returns: A reference to the mapped_type corresponding to x in *this. //! //! Complexity: Logarithmic. - T& operator[](BOOST_INTERPROCESS_RV_REF(key_type) mk) + T& operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk) { key_type &k = mk; //we can optimize this iterator i = lower_bound(k); // i->first is greater than or equivalent to k. if (i == end() || key_comp()(k, (*i).first)){ - value_type val(boost::interprocess::move(k), boost::interprocess::move(T())); - i = insert(i, boost::interprocess::move(val)); + value_type val(BOOST_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T())); + i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val)); } return (*i).second; } @@ -429,8 +429,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_INTERPROCESS_RV_REF(nonconst_value_type) x) - { return m_tree.insert_unique(boost::interprocess::move(x)); } + std::pair insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x) + { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -440,8 +440,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_INTERPROCESS_RV_REF(nonconst_impl_value_type) x) - { return m_tree.insert_unique(boost::interprocess::move(x)); } + std::pair insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x) + { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -451,8 +451,8 @@ class map //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_unique(boost::interprocess::move(x)); } + std::pair insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container if and only if there is //! no element in the container with key equivalent to the key of x. @@ -475,8 +475,8 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(iterator position, BOOST_INTERPROCESS_RV_REF(nonconst_value_type) x) - { return m_tree.insert_unique(position, boost::interprocess::move(x)); } + iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x) + { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Move constructs a new value from x if and only if there is //! no element in the container with key equivalent to the key of x. @@ -487,8 +487,8 @@ class map //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(iterator position, BOOST_INTERPROCESS_RV_REF(nonconst_impl_value_type) x) - { return m_tree.insert_unique(position, boost::interprocess::move(x)); } + iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x) + { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -505,8 +505,8 @@ class map //! Returns: An iterator pointing to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - iterator insert(iterator position, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_unique(position, boost::interprocess::move(x)); } + iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -532,7 +532,7 @@ class map //! is inserted right before p. template iterator emplace(Args&&... args) - { return m_tree.emplace_unique(boost::interprocess::forward(args)...); } + { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container if and only if there is @@ -546,7 +546,7 @@ class map //! is inserted right before p. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_tree.emplace_hint_unique(hint, boost::interprocess::forward(args)...); } + { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -752,7 +752,7 @@ class multimap { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(multimap) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multimap) typedef containers_detail::rbtree, containers_detail::select1st< std::pair >, @@ -847,21 +847,21 @@ class multimap //! Complexity: Construct. //! //! Postcondition: x is emptied. - multimap(BOOST_INTERPROCESS_RV_REF(multimap) x) - : m_tree(boost::interprocess::move(x.m_tree)) + multimap(BOOST_MOVE_MACRO_RV_REF(multimap) x) + : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - multimap& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(multimap) x) + multimap& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multimap) x) { m_tree = x.m_tree; return *this; } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - multimap& operator=(BOOST_INTERPROCESS_RV_REF(multimap) x) - { m_tree = boost::interprocess::move(x.m_tree); return *this; } + multimap& operator=(BOOST_MOVE_MACRO_RV_REF(multimap) x) + { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -1009,15 +1009,15 @@ class multimap //! the iterator pointing to the newly inserted element. //! //! Complexity: Logarithmic. - iterator insert(BOOST_INTERPROCESS_RV_REF(nonconst_value_type) x) - { return m_tree.insert_equal(boost::interprocess::move(x)); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x) + { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a new value move-constructed from x and returns //! the iterator pointing to the newly inserted element. //! //! Complexity: Logarithmic. - iterator insert(BOOST_INTERPROCESS_RV_REF(nonconst_impl_value_type) x) - { return m_tree.insert_equal(boost::interprocess::move(x)); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x) + { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1049,8 +1049,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(iterator position, BOOST_INTERPROCESS_RV_REF(nonconst_value_type) x) - { return m_tree.insert_equal(position, boost::interprocess::move(x)); } + iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x) + { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a new value move constructed from x in the container. //! p is a hint pointing to where the insert should start to search. @@ -1060,8 +1060,8 @@ class multimap //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(iterator position, BOOST_INTERPROCESS_RV_REF(nonconst_impl_value_type) x) - { return m_tree.insert_equal(position, boost::interprocess::move(x)); } + iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x) + { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -1085,7 +1085,7 @@ class multimap //! is inserted right before p. template iterator emplace(Args&&... args) - { return m_tree.emplace_equal(boost::interprocess::forward(args)...); } + { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container. @@ -1098,7 +1098,7 @@ class multimap //! is inserted right before p. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_tree.emplace_hint_equal(hint, boost::interprocess::forward(args)...); } + { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -1280,7 +1280,7 @@ namespace container { }} -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif /* BOOST_CONTAINERS_MAP_HPP */ diff --git a/3party/boost/boost/interprocess/containers/container/set.hpp b/3party/boost/boost/interprocess/containers/container/set.hpp index 8d632e6247..35a466b9f4 100644 --- a/3party/boost/boost/interprocess/containers/container/set.hpp +++ b/3party/boost/boost/interprocess/containers/container/set.hpp @@ -7,38 +7,6 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_set/stl_multiset files. Modified by Ion Gaztanaga 2004. -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ #ifndef BOOST_CONTAINERS_SET_HPP #define BOOST_CONTAINERS_SET_HPP @@ -47,20 +15,20 @@ # pragma once #endif -#include -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #ifndef BOOST_CONTAINERS_PERFECT_FORWARDING -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -94,7 +62,7 @@ class set { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(set) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(set) typedef containers_detail::rbtree, Pred, Alloc> tree_t; tree_t m_tree; // red-black tree representing set @@ -168,21 +136,21 @@ class set //! Complexity: Construct. //! //! Postcondition: x is emptied. - set(BOOST_INTERPROCESS_RV_REF(set) x) - : m_tree(boost::interprocess::move(x.m_tree)) + set(BOOST_MOVE_MACRO_RV_REF(set) x) + : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - set& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(set) x) + set& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(set) x) { m_tree = x.m_tree; return *this; } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - set& operator=(BOOST_INTERPROCESS_RV_REF(set) x) - { m_tree = boost::interprocess::move(x.m_tree); return *this; } + set& operator=(BOOST_MOVE_MACRO_RV_REF(set) x) + { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -357,12 +325,12 @@ class set std::pair insert(insert_const_ref_type x) { return priv_insert(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) std::pair insert(T &x) { return this->insert(const_cast(x)); } template - std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + std::pair insert(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(u); } #endif @@ -374,8 +342,8 @@ class set //! points to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - std::pair insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_unique(boost::interprocess::move(x)); } + std::pair insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container if and only if there is //! no element in the container with key equivalent to the key of x. @@ -389,12 +357,12 @@ class set iterator insert(const_iterator p, insert_const_ref_type x) { return priv_insert(p, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(position, u); } #endif @@ -404,8 +372,8 @@ class set //! Returns: An iterator pointing to the element with key equivalent to the key of x. //! //! Complexity: Logarithmic. - iterator insert(const_iterator p, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_unique(p, boost::interprocess::move(x)); } + iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_unique(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -431,7 +399,7 @@ class set //! Complexity: Logarithmic. template iterator emplace(Args&&... args) - { return m_tree.emplace_unique(boost::interprocess::forward(args)...); } + { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... if and only if there is @@ -444,7 +412,7 @@ class set //! Complexity: Logarithmic. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_tree.emplace_hint_unique(hint, boost::interprocess::forward(args)...); } + { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -652,7 +620,7 @@ class multiset { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(multiset) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multiset) typedef containers_detail::rbtree, Pred, Alloc> tree_t; tree_t m_tree; // red-black tree representing multiset @@ -727,21 +695,21 @@ class multiset //! Complexity: Construct. //! //! Postcondition: x is emptied. - multiset(BOOST_INTERPROCESS_RV_REF(multiset) x) - : m_tree(boost::interprocess::move(x.m_tree)) + multiset(BOOST_MOVE_MACRO_RV_REF(multiset) x) + : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree)) {} //! Effects: Makes *this a copy of x. //! //! Complexity: Linear in x.size(). - multiset& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(multiset) x) + multiset& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multiset) x) { m_tree = x.m_tree; return *this; } //! Effects: this->swap(x.get()). //! //! Complexity: Constant. - multiset& operator=(BOOST_INTERPROCESS_RV_REF(multiset) x) - { m_tree = boost::interprocess::move(x.m_tree); return *this; } + multiset& operator=(BOOST_MOVE_MACRO_RV_REF(multiset) x) + { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; } //! Effects: Returns the comparison object out //! of which a was constructed. @@ -912,12 +880,12 @@ class multiset iterator insert(insert_const_ref_type x) { return priv_insert(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(T &x) { return this->insert(const_cast(x)); } template - iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(u); } #endif @@ -928,8 +896,8 @@ class multiset //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_equal(boost::interprocess::move(x)); } + iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -942,12 +910,12 @@ class multiset iterator insert(const_iterator p, insert_const_ref_type x) { return priv_insert(p, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_insert(position, u); } #endif @@ -959,8 +927,8 @@ class multiset //! //! Complexity: Logarithmic in general, but amortized constant if t //! is inserted right before p. - iterator insert(const_iterator p, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return m_tree.insert_equal(p, boost::interprocess::move(x)); } + iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return m_tree.insert_equal(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: i, j are not iterators into *this. //! @@ -980,7 +948,7 @@ class multiset //! Complexity: Logarithmic. template iterator emplace(Args&&... args) - { return m_tree.emplace_equal(boost::interprocess::forward(args)...); } + { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... @@ -992,7 +960,7 @@ class multiset //! is inserted right before p. template iterator emplace_hint(const_iterator hint, Args&&... args) - { return m_tree.emplace_hint_equal(hint, boost::interprocess::forward(args)...); } + { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -1181,7 +1149,7 @@ namespace container { }} -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif /* BOOST_CONTAINERS_SET_HPP */ diff --git a/3party/boost/boost/interprocess/containers/container/slist.hpp b/3party/boost/boost/interprocess/containers/container/slist.hpp index 22fcdf472e..622ec9d501 100644 --- a/3party/boost/boost/interprocess/containers/container/slist.hpp +++ b/3party/boost/boost/interprocess/containers/container/slist.hpp @@ -7,38 +7,6 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_slist.h file. Modified by Ion Gaztanaga 2004-2009 -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ #ifndef BOOST_CONTAINERS_SLIST_HPP #define BOOST_CONTAINERS_SLIST_HPP @@ -47,24 +15,24 @@ # pragma once #endif -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include -#include +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP #include #include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP #include #if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //Preprocessor library to emulate perfect forwarding #else -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP #endif #include @@ -105,7 +73,7 @@ struct slist_node template slist_node(Args &&...args) - : m_data(boost::interprocess::forward(args)...) + : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...) {} #else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING @@ -254,7 +222,7 @@ class slist /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(slist) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(slist) typedef difference_type list_difference_type; typedef pointer list_pointer; typedef const_pointer list_const_pointer; @@ -404,8 +372,8 @@ class slist //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - slist(BOOST_INTERPROCESS_RV_REF(slist) x) - : AllocHolder(boost::interprocess::move((AllocHolder&)x)) + slist(BOOST_MOVE_MACRO_RV_REF(slist) x) + : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move((AllocHolder&)x)) {} //! Effects: Makes *this contain the same elements as x. @@ -416,7 +384,7 @@ class slist //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - slist& operator= (BOOST_INTERPROCESS_COPY_ASSIGN_REF(slist) x) + slist& operator= (BOOST_MOVE_MACRO_COPY_ASSIGN_REF(slist) x) { if (&x != this){ this->assign(x.begin(), x.end()); @@ -432,7 +400,7 @@ class slist //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - slist& operator= (BOOST_INTERPROCESS_RV_REF(slist) mx) + slist& operator= (BOOST_MOVE_MACRO_RV_REF(slist) mx) { if (&mx != this){ this->clear(); @@ -631,11 +599,11 @@ class slist void push_front(insert_const_ref_type x) { return priv_push_front(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_front(T &x) { push_front(const_cast(x)); } template - void push_front(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_front(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_push_front(u); } #endif @@ -645,8 +613,8 @@ class slist //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. - void push_front(BOOST_INTERPROCESS_RV_REF(T) x) - { this->icont().push_front(*this->create_node(boost::interprocess::move(x))); } + void push_front(BOOST_MOVE_MACRO_RV_REF(T) x) + { this->icont().push_front(*this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); } //! Effects: Removes the first element from the list. //! @@ -692,12 +660,12 @@ class slist iterator insert_after(const_iterator prev_pos, insert_const_ref_type x) { return this->priv_insert_after(prev_pos, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert_after(const_iterator position, T &x) { return this->insert_after(position, const_cast(x)); } template - iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert_after(position, u); } #endif @@ -714,8 +682,8 @@ class slist //! //! Note: Does not affect the validity of iterators and references of //! previous values. - iterator insert_after(const_iterator prev_pos, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(boost::interprocess::move(x)))); } + iterator insert_after(const_iterator prev_pos, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)))); } //! Requires: prev_pos must be a valid iterator of *this. //! @@ -760,12 +728,12 @@ class slist iterator insert(const_iterator position, insert_const_ref_type x) { return this->priv_insert(position, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert(position, u); } #endif @@ -776,8 +744,8 @@ class slist //! Throws: If memory allocation throws. //! //! Complexity: Linear to the elements before p. - iterator insert(const_iterator p, BOOST_INTERPROCESS_RV_REF(value_type) x) - { return this->insert_after(previous(p), boost::interprocess::move(x)); } + iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x) + { return this->insert_after(previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } //! Requires: p must be a valid iterator of *this. //! @@ -813,7 +781,7 @@ class slist //! Complexity: Amortized constant time. template void emplace_front(Args&&... args) - { this->emplace_after(this->cbefore_begin(), boost::interprocess::forward(args)...); } + { this->emplace_after(this->cbefore_begin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... before p @@ -824,7 +792,7 @@ class slist //! Complexity: Linear to the elements before p template iterator emplace(const_iterator p, Args&&... args) - { return this->emplace_after(this->previous(p), boost::interprocess::forward(args)...); } + { return this->emplace_after(this->previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... after prev @@ -837,7 +805,7 @@ class slist iterator emplace_after(const_iterator prev, Args&&... args) { typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator()); - new ((void*)containers_detail::get_pointer(d.get())) Node(boost::interprocess::forward(args)...); + new ((void*)containers_detail::get_pointer(d.get())) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); NodePtr node = d.get(); d.release(); return iterator(this->icont().insert_after(prev.get(), *node)); @@ -1370,7 +1338,7 @@ class slist template void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, containers_detail::true_) - { this->priv_create_and_insert_nodes(prev, n, x); } + { this->priv_create_and_insert_nodes(prev, (std::size_t)n, x); } void priv_fill_assign(size_type n, const T& val) { @@ -1412,7 +1380,7 @@ class slist template void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, containers_detail::true_) - { this->priv_create_and_insert_nodes(prev_pos, n, x); } + { this->priv_create_and_insert_nodes(prev_pos, (std::size_t)n, x); } template void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, containers_detail::false_) @@ -1559,6 +1527,6 @@ class insert_iterator > ///@endcond -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif /* BOOST_CONTAINERS_SLIST_HPP */ diff --git a/3party/boost/boost/interprocess/containers/container/stable_vector.hpp b/3party/boost/boost/interprocess/containers/container/stable_vector.hpp index 8394fbe99b..dd8ae47323 100644 --- a/3party/boost/boost/interprocess/containers/container/stable_vector.hpp +++ b/3party/boost/boost/interprocess/containers/container/stable_vector.hpp @@ -22,18 +22,18 @@ # pragma once #endif -#include -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include #include #include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP #include #include @@ -46,7 +46,7 @@ #define STABLE_VECTOR_USE_CONTAINERS_VECTOR #if defined (STABLE_VECTOR_USE_CONTAINERS_VECTOR) -#include +#include INCLUDE_BOOST_CONTAINER_VECTOR_HPP #else #include #endif //STABLE_VECTOR_USE_CONTAINERS_VECTOR @@ -140,7 +140,7 @@ struct node_type template node_type(Args &&...args) - : value(boost::interprocess::forward(args)...) + : value(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...) {} #else //BOOST_CONTAINERS_PERFECT_FORWARDING @@ -454,7 +454,7 @@ class stable_vector ///@cond private: - BOOST_COPYABLE_AND_MOVABLE(stable_vector) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(stable_vector) static const size_type ExtraPointers = 3; typedef typename stable_vector_detail:: select_multiallocation_chain @@ -508,7 +508,7 @@ class stable_vector cod.release(); } - stable_vector(BOOST_INTERPROCESS_RV_REF(stable_vector) x) + stable_vector(BOOST_MOVE_MACRO_RV_REF(stable_vector) x) : internal_data(x.get_al()),impl(x.get_al()) { this->swap(x); } @@ -518,7 +518,7 @@ class stable_vector clear_pool(); } - stable_vector& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(stable_vector) x) + stable_vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(stable_vector) x) { STABLE_VECTOR_CHECK_INVARIANT; if (this != &x) { @@ -527,7 +527,7 @@ class stable_vector return *this; } - stable_vector& operator=(BOOST_INTERPROCESS_RV_REF(stable_vector) x) + stable_vector& operator=(BOOST_MOVE_MACRO_RV_REF(stable_vector) x) { if (&x != this){ this->swap(x); @@ -672,16 +672,16 @@ class stable_vector void push_back(insert_const_ref_type x) { return priv_push_back(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_back(T &x) { push_back(const_cast(x)); } template - void push_back(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_back(const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return priv_push_back(u); } #endif - void push_back(BOOST_INTERPROCESS_RV_REF(T) t) - { this->insert(end(), boost::interprocess::move(t)); } + void push_back(BOOST_MOVE_MACRO_RV_REF(T) t) + { this->insert(end(), BOOST_CONTAINER_MOVE_NAMESPACE::move(t)); } void pop_back() { this->erase(this->end()-1); } @@ -689,18 +689,18 @@ class stable_vector iterator insert(const_iterator position, insert_const_ref_type x) { return this->priv_insert(position, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert(position, u); } #endif - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(T) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x) { typedef repeat_iterator repeat_it; - typedef boost::interprocess::move_iterator repeat_move_it; + typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator repeat_move_it; //Just call more general insert(pos, size, value) and return iterator size_type pos_n = position - cbegin(); this->insert(position @@ -736,7 +736,7 @@ class stable_vector { typedef emplace_functor EmplaceFunctor; typedef emplace_iterator EmplaceIterator; - EmplaceFunctor &&ef = EmplaceFunctor(boost::interprocess::forward(args)...); + EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); } @@ -756,7 +756,7 @@ class stable_vector size_type pos_n = position - cbegin(); typedef emplace_functor EmplaceFunctor; typedef emplace_iterator EmplaceIterator; - EmplaceFunctor &&ef = EmplaceFunctor(boost::interprocess::forward(args)...); + EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); this->insert(position, EmplaceIterator(ef), EmplaceIterator()); return iterator(this->begin() + pos_n); } @@ -870,7 +870,7 @@ class stable_vector void_ptr &p2 = impl.back(); multiallocation_chain holder; holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size); - get_al().deallocate_individual(boost::interprocess::move(holder)); + get_al().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder)); p1 = p2 = 0; this->internal_data.pool_size = 0; } @@ -900,7 +900,7 @@ class stable_vector void_ptr &p2 = impl.back(); multiallocation_chain holder; holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size); - BOOST_STATIC_ASSERT((::boost::interprocess::is_movable::value == true)); + BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value == true)); multiallocation_chain m (get_al().allocate_individual(n)); holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n); this->internal_data.pool_size += n; @@ -1169,7 +1169,7 @@ class stable_vector } catch(...){ get_al().deallocate_one(p); - get_al().deallocate_many(boost::interprocess::move(mem)); + get_al().deallocate_many(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem)); impl.erase(it+i, it+n); this->align_nodes(it+i,get_last_align()); throw; @@ -1324,6 +1324,6 @@ void swap(stable_vector& x,stable_vector& y) }} -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif //BOOST_CONTAINER_STABLE_VECTOR_HPP diff --git a/3party/boost/boost/interprocess/containers/container/string.hpp b/3party/boost/boost/interprocess/containers/container/string.hpp index 40bc5690b8..53055d0a49 100644 --- a/3party/boost/boost/interprocess/containers/container/string.hpp +++ b/3party/boost/boost/interprocess/containers/container/string.hpp @@ -7,38 +7,22 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's string file. Modified by Ion Gaztanaga 2004-2009 -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 1994 -// Hewlett-Packard Company -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. Hewlett-Packard Company makes no -// representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. #ifndef BOOST_CONTAINERS_STRING_HPP #define BOOST_CONTAINERS_STRING_HPP -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include #include @@ -55,7 +39,7 @@ #include #include #include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP #include #include @@ -83,7 +67,7 @@ template class basic_string_base { basic_string_base(); - BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(basic_string_base) + BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_string_base) public: typedef A allocator_type; @@ -104,7 +88,7 @@ class basic_string_base this->allocate_initial_block(n); } - basic_string_base(BOOST_INTERPROCESS_RV_REF(basic_string_base) b) + basic_string_base(BOOST_MOVE_MACRO_RV_REF(basic_string_base) b) : members_(b.members_) { init(); @@ -280,7 +264,7 @@ class basic_string_base (void)limit_size; (void)reuse; if(!(command & allocate_new)) - return std::pair(pointer(0), 0); + return std::pair(pointer(0), false); received_size = preferred_size; return std::make_pair(this->alloc().allocate(received_size), false); } @@ -445,7 +429,7 @@ class basic_string { /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(basic_string) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(basic_string) typedef containers_detail::basic_string_base base_t; static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars; @@ -551,8 +535,8 @@ class basic_string //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - basic_string(BOOST_INTERPROCESS_RV_REF(basic_string) s) - : base_t(boost::interprocess::move((base_t&)s)) + basic_string(BOOST_MOVE_MACRO_RV_REF(basic_string) s) + : base_t(BOOST_CONTAINER_MOVE_NAMESPACE::move((base_t&)s)) {} //! Effects: Constructs a basic_string taking the allocator as parameter, @@ -618,7 +602,7 @@ class basic_string //! Postcondition: x == *this. //! //! Complexity: Linear to the elements x contains. - basic_string& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(basic_string) s) + basic_string& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(basic_string) s) { if (&s != this) this->assign(s.begin(), s.end()); @@ -630,7 +614,7 @@ class basic_string //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - basic_string& operator=(BOOST_INTERPROCESS_RV_REF(basic_string) ms) + basic_string& operator=(BOOST_MOVE_MACRO_RV_REF(basic_string) ms) { basic_string &s = ms; if (&s != this){ @@ -947,7 +931,7 @@ class basic_string { return this->operator=(s); } //! Effects: Moves the resources from ms *this. - basic_string& assign(BOOST_INTERPROCESS_RV_REF(basic_string) ms) + basic_string& assign(BOOST_MOVE_MACRO_RV_REF(basic_string) ms) { return this->operator=(ms);} //! Effects: Assigns the range [pos, pos + n) from s to *this. @@ -1916,19 +1900,19 @@ operator+(const basic_string& x, } template inline -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) operator+( - BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx + BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx , const basic_string& y) { mx += y; - return boost::interprocess::move(mx); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx); } template inline -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) operator+(const basic_string& x, - BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) + BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) { typedef typename basic_string::size_type size_type; return my.replace(size_type(0), size_type(0), x); @@ -1949,12 +1933,12 @@ operator+(const CharT* s, const basic_string& y) } template inline -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) operator+(const CharT* s, - BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) + BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) { typedef typename basic_string::size_type size_type; - return boost::interprocess::move(my.get().replace(size_type(0), size_type(0), s)); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(my.get().replace(size_type(0), size_type(0), s)); } template @@ -1971,9 +1955,9 @@ operator+(CharT c, const basic_string& y) } template inline -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) operator+(CharT c, - BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) + BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my) { typedef typename basic_string::size_type size_type; return my.replace(size_type(0), size_type(0), &c, &c + 1); @@ -1994,12 +1978,12 @@ operator+(const basic_string& x, const CharT* s) } template -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) -operator+(BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +operator+(BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx , const CharT* s) { mx += s; - return boost::interprocess::move(mx); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx); } template @@ -2016,12 +2000,12 @@ operator+(const basic_string& x, const CharT c) } template -BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) -operator+( BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx +BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) +operator+( BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx , const CharT c) { mx += c; - return boost::interprocess::move(mx); + return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx); } // Operator== and operator!= @@ -2273,7 +2257,6 @@ getline(std::istream& is, basic_string& s,CharT delim) std::basic_streambuf* buf = is.rdbuf(); s.clear(); - int c1; while (nread < s.max_size()) { int c1 = buf->sbumpc(); if (Traits::eq_int_type(c1, Traits::eof())) { @@ -2327,6 +2310,6 @@ struct has_trivial_destructor_after_move /// @endcond -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // BOOST_CONTAINERS_STRING_HPP diff --git a/3party/boost/boost/interprocess/containers/container/vector.hpp b/3party/boost/boost/interprocess/containers/container/vector.hpp index 6f4d446c03..71399a26f5 100644 --- a/3party/boost/boost/interprocess/containers/container/vector.hpp +++ b/3party/boost/boost/interprocess/containers/container/vector.hpp @@ -7,34 +7,6 @@ // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// This file comes from SGI's stl_vector.h file. Modified by Ion Gaztanaga. -// Renaming, isolating and porting to generic algorithms. Pointer typedef -// set to allocator::pointer to allow placing it in shared memory. -// -/////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 1994 -// Hewlett-Packard Company -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. Hewlett-Packard Company makes no -// representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. -// -// -// Copyright (c) 1996 -// Silicon Graphics Computer Systems, Inc. -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. Silicon Graphics makes no -// representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. #ifndef BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP #define BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP @@ -43,9 +15,9 @@ # pragma once #endif -#include -#include -#include +#include "detail/config_begin.hpp" +#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP #include #include @@ -59,17 +31,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ITERATORS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP +#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP +#include INCLUDE_BOOST_CONTAINER_MOVE_HPP #include -#include -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP +#include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP namespace boost { namespace container { @@ -316,7 +288,7 @@ struct vector_alloc_holder (void)limit_size; (void)reuse; if(!(command & allocate_new)) - return std::pair(pointer(0), 0); + return std::pair(pointer(0), false); received_size = preferred_size; return std::make_pair(this->alloc().allocate(received_size), false); } @@ -439,7 +411,7 @@ class vector : private containers_detail::vector_alloc_holder /// @cond private: - BOOST_COPYABLE_AND_MOVABLE(vector) + BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(vector) typedef containers_detail::advanced_insert_aux_int advanced_insert_aux_int_t; typedef containers_detail::vector_value_traits value_traits; @@ -449,7 +421,7 @@ class vector : private containers_detail::vector_alloc_holder typedef constant_iterator cvalue_iterator; typedef repeat_iterator repeat_it; - typedef boost::interprocess::move_iterator repeat_move_it; + typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator repeat_move_it; /// @endcond public: @@ -499,7 +471,7 @@ class vector : private containers_detail::vector_alloc_holder //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - vector(BOOST_INTERPROCESS_RV_REF(vector) mx) + vector(BOOST_MOVE_MACRO_RV_REF(vector) mx) : base_t(static_cast(mx).alloc()) { this->swap(mx); } @@ -808,8 +780,8 @@ class vector : private containers_detail::vector_alloc_holder else{ //We will reuse insert code, so create a dummy input iterator T *dummy_it(containers_detail::get_pointer(this->members_.m_start)); - containers_detail::advanced_insert_aux_proxy, T*> - proxy(::boost::interprocess::make_move_iterator(dummy_it), ::boost::interprocess::make_move_iterator(dummy_it)); + containers_detail::advanced_insert_aux_proxy, T*> + proxy(::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it), ::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it)); //Backwards (and possibly forward) expansion if(ret.second){ #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS @@ -846,7 +818,7 @@ class vector : private containers_detail::vector_alloc_holder //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - vector& operator=(BOOST_INTERPROCESS_COPY_ASSIGN_REF(vector) x) + vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(vector) x) { if (&x != this){ this->assign(x.members_.m_start, x.members_.m_start + x.members_.m_size); @@ -862,7 +834,7 @@ class vector : private containers_detail::vector_alloc_holder //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Linear. - vector& operator=(BOOST_INTERPROCESS_RV_REF(vector) x) + vector& operator=(BOOST_MOVE_MACRO_RV_REF(vector) x) { if (&x != this){ this->swap(x); @@ -903,11 +875,14 @@ class vector : private containers_detail::vector_alloc_holder void push_back(insert_const_ref_type x) { return priv_push_back(x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) void push_back(T &x) { push_back(const_cast(x)); } template - void push_back(const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + void push_back(const U &u, typename containers_detail::enable_if_c + ::value && + !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value + >::type* =0) { return priv_push_back(u); } #endif @@ -917,15 +892,15 @@ class vector : private containers_detail::vector_alloc_holder //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. - void push_back(BOOST_INTERPROCESS_RV_REF(T) x) + void push_back(BOOST_MOVE_MACRO_RV_REF(T) x) { if (this->members_.m_size < this->members_.m_capacity){ //There is more memory, just construct a new object at the end - new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(boost::interprocess::move(x)); + new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); ++this->members_.m_size; } else{ - this->insert(this->cend(), boost::interprocess::move(x)); + this->insert(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); } } @@ -943,12 +918,12 @@ class vector : private containers_detail::vector_alloc_holder T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size; if (this->members_.m_size < this->members_.m_capacity){ //There is more memory, just construct a new object at the end - new((void*)(back_pos))value_type(boost::interprocess::forward(args)...); + new((void*)(back_pos))value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); ++this->members_.m_size; } else{ typedef containers_detail::advanced_insert_aux_emplace type; - type &&proxy = type(boost::interprocess::forward(args)...); + type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); priv_range_insert(back_pos, 1, proxy); } } @@ -968,7 +943,7 @@ class vector : private containers_detail::vector_alloc_holder //Just call more general insert(pos, size, value) and return iterator size_type pos_n = position - cbegin(); typedef containers_detail::advanced_insert_aux_emplace type; - type &&proxy = type(boost::interprocess::forward(args)...); + type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward(args)...); priv_range_insert(position.get_ptr(), 1, proxy); return iterator(this->members_.m_start + pos_n); } @@ -1062,11 +1037,11 @@ class vector : private containers_detail::vector_alloc_holder iterator insert(const_iterator position, insert_const_ref_type x) { return this->priv_insert(position, x); } - #if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast(x)); } template - iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::boost::interprocess::is_movable::value >::type* =0) + iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable::value >::type* =0) { return this->priv_insert(position, u); } #endif @@ -1078,7 +1053,7 @@ class vector : private containers_detail::vector_alloc_holder //! //! Complexity: If position is end(), amortized constant time //! Linear time otherwise. - iterator insert(const_iterator position, BOOST_INTERPROCESS_RV_REF(T) x) + iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x) { //Just call more general insert(pos, size, value) and return iterator size_type pos_n = position - cbegin(); @@ -1137,7 +1112,7 @@ class vector : private containers_detail::vector_alloc_holder { T *pos = containers_detail::get_pointer(position.get_ptr()); T *beg = containers_detail::get_pointer(this->members_.m_start); - boost::interprocess::move(pos + 1, beg + this->members_.m_size, pos); + BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + 1, beg + this->members_.m_size, pos); --this->members_.m_size; //Destroy last element base_t::destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size); @@ -1153,7 +1128,7 @@ class vector : private containers_detail::vector_alloc_holder { if (first != last){ // worth doing, copy down over hole T* end_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size; - T* ptr = containers_detail::get_pointer(boost::interprocess::move + T* ptr = containers_detail::get_pointer(BOOST_CONTAINER_MOVE_NAMESPACE::move (containers_detail::get_pointer(last.get_ptr()) ,end_pos ,containers_detail::get_pointer(first.get_ptr()) @@ -1360,10 +1335,10 @@ class vector : private containers_detail::vector_alloc_holder if (elems_after > n){ //New elements can be just copied. //Move to uninitialized memory last objects - ::boost::interprocess::uninitialized_move(old_finish - n, old_finish, old_finish); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_finish - n, old_finish, old_finish); this->members_.m_size += n; //Copy previous to last objects to the initialized end - boost::interprocess::move_backward(pos, old_finish - n, old_finish); + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, old_finish - n, old_finish); //Insert new objects in the pos interf.copy_all_to(pos); } @@ -1373,7 +1348,7 @@ class vector : private containers_detail::vector_alloc_holder interf.uninitialized_copy_some_and_update(old_finish, elems_after, false); this->members_.m_size += n - elems_after; //Copy old [pos, end()) elements to the uninitialized memory - ::boost::interprocess::uninitialized_move + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move ( pos, old_finish, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size); this->members_.m_size += elems_after; //Copy first new elements in pos @@ -1395,7 +1370,7 @@ class vector : private containers_detail::vector_alloc_holder //the start of the new buffer T *old_buffer = containers_detail::get_pointer(this->members_.m_start); if(old_buffer){ - new_finish = ::boost::interprocess::uninitialized_move + new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move (containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish); constructed_values_destroyer.increment_size(new_finish - old_finish); } @@ -1406,7 +1381,7 @@ class vector : private containers_detail::vector_alloc_holder //Initialize from the rest of the old buffer, //starting from previous point if(old_buffer){ - new_finish = ::boost::interprocess::uninitialized_move + new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move (pos, old_buffer + this->members_.m_size, new_finish); //Destroy and deallocate old elements //If there is allocated memory, destroy and deallocate @@ -1447,7 +1422,7 @@ class vector : private containers_detail::vector_alloc_holder //Check if s_before is big enough to hold the beginning of old data + new data if(difference_type(s_before) >= difference_type(elemsbefore + n)){ //Copy first old values before pos, after that the new objects - ::boost::interprocess::uninitialized_move(old_start, pos, new_start); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start); this->members_.m_size = elemsbefore; interf.uninitialized_copy_all_to(new_start + elemsbefore); this->members_.m_size += n; @@ -1465,7 +1440,7 @@ class vector : private containers_detail::vector_alloc_holder //|___________|__________|_________|________________________| // //Now initialize the rest of memory with the last old values - ::boost::interprocess::uninitialized_move + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move (pos, old_finish, new_start + elemsbefore + n); //All new elements correctly constructed, avoid new element destruction this->members_.m_size = old_size + n; @@ -1492,13 +1467,13 @@ class vector : private containers_detail::vector_alloc_holder size_type raw_gap = s_before - (elemsbefore + n); //Now initialize the rest of s_before memory with the //first of elements after new values - ::boost::interprocess::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n); //Update size since we have a contiguous buffer this->members_.m_size = old_size + s_before; //All new elements correctly constructed, avoid old element destruction old_values_destroyer.release(); //Now copy remaining last objects in the old buffer begin - T *to_destroy = boost::interprocess::move(pos + raw_gap, old_finish, old_start); + T *to_destroy = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + raw_gap, old_finish, old_start); //Now destroy redundant elements except if they were moved and //they have trivial destructor after move size_type n_destroy = old_finish - to_destroy; @@ -1557,13 +1532,13 @@ class vector : private containers_detail::vector_alloc_holder // //Copy the first part of old_begin to raw_mem T *start_n = old_start + difference_type(s_before); - ::boost::interprocess::uninitialized_move(old_start, start_n, new_start); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, start_n, new_start); //The buffer is all constructed until old_end, //release destroyer and update size old_values_destroyer.release(); this->members_.m_size = old_size + s_before; //Now copy the second part of old_begin overwriting himself - T* next = boost::interprocess::move(start_n, pos, old_start); + T* next = BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start); if(do_after){ //Now copy the new_beg elements interf.copy_some_and_update(next, s_before, true); @@ -1573,7 +1548,7 @@ class vector : private containers_detail::vector_alloc_holder interf.copy_all_to(next); T* move_start = next + n; //Now displace old_end elements - T* move_end = boost::interprocess::move(pos, old_finish, move_start); + T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start); //Destroy remaining moved elements from old_end except if //they have trivial destructor after being moved difference_type n_destroy = s_before - n; @@ -1609,7 +1584,7 @@ class vector : private containers_detail::vector_alloc_holder //|___________|_____|_________|__________________________| // //First copy whole old_begin and part of new to raw_mem - ::boost::interprocess::uninitialized_move(old_start, pos, new_start); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start); this->members_.m_size = elemsbefore; const size_type mid_n = difference_type(s_before) - elemsbefore; @@ -1628,7 +1603,7 @@ class vector : private containers_detail::vector_alloc_holder interf.copy_all_to(old_start); T* move_start = old_start + (n-mid_n); //Displace old_end - T* move_end = boost::interprocess::move(pos, old_finish, move_start); + T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start); //Destroy remaining moved elements from old_end except if they //have trivial destructor after being moved difference_type n_destroy = s_before - n; @@ -1679,10 +1654,10 @@ class vector : private containers_detail::vector_alloc_holder // //First copy the part of old_end raw_mem T* finish_n = old_finish - difference_type(n_after); - ::boost::interprocess::uninitialized_move(finish_n, old_finish, old_finish); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, old_finish, old_finish); this->members_.m_size += n_after; //Displace the rest of old_end to the new position - boost::interprocess::move_backward(pos, finish_n, old_finish); + BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish); //Now overwrite with new_end //The new_end part is [first + (n - n_after), last) interf.copy_all_to(pos); @@ -1705,7 +1680,7 @@ class vector : private containers_detail::vector_alloc_holder //The new_end part is [first + (n - n_after), last) interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false); this->members_.m_size += mid_last_dist; - ::boost::interprocess::uninitialized_move(pos, old_finish, old_finish + mid_last_dist); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, old_finish + mid_last_dist); this->members_.m_size += n_after - mid_last_dist; //Now copy the part of new_end over constructed elements interf.copy_all_to(pos); @@ -1718,7 +1693,7 @@ class vector : private containers_detail::vector_alloc_holder void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag) { for(;first != last; ++first){ - this->insert(pos, boost::interprocess::move(value_type(*first))); + this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first))); } } @@ -1789,14 +1764,14 @@ class vector : private containers_detail::vector_alloc_holder T *end = std::copy(first, mid, start); //Initialize the remaining new elements in the uninitialized memory // iG std::uninitialized_copy(mid, last, end); - ::boost::interprocess::uninitialized_copy_or_move(mid, last, end); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last, end); this->members_.m_size = n; } } else if(!ret.second){ typename value_traits::UCopiedArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap); // iG std::uninitialized_copy(first, last, containers_detail::get_pointer(ret.first)); - ::boost::interprocess::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first)); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first)); scoped_alloc.release(); //Destroy and deallocate old buffer if(this->members_.m_start != 0){ @@ -1826,7 +1801,7 @@ class vector : private containers_detail::vector_alloc_holder FwdIt mid = first; std::advance(mid, first_count); // iG std::uninitialized_copy(first, mid, containers_detail::get_pointer(ret.first)); - ::boost::interprocess::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first)); + ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first)); if(old_offset > n){ //All old elements will be destroyed by "old_values_destroyer" @@ -1864,7 +1839,7 @@ class vector : private containers_detail::vector_alloc_holder template void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_) - { this->assign((size_type) n, (T) val); } + { this->assign((size_type) n, (value_type)val); } template void priv_assign_dispatch(InIt first, InIt last, containers_detail::false_) @@ -1955,7 +1930,7 @@ struct has_trivial_destructor_after_move > /// @endcond -#include +#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP #endif // #ifndef BOOST_CONTAINERS_CONTAINERS_VECTOR_HPP diff --git a/3party/boost/boost/interprocess/creation_tags.hpp b/3party/boost/boost/interprocess/creation_tags.hpp index dc9a7caf48..fe483f62fd 100644 --- a/3party/boost/boost/interprocess/creation_tags.hpp +++ b/3party/boost/boost/interprocess/creation_tags.hpp @@ -29,6 +29,10 @@ struct open_only_t {}; //!be only opened for reading struct open_read_only_t {}; +//!Tag to indicate that the resource must +//!be only opened privately for reading +struct open_read_private_t {}; + //!Tag to indicate that the resource must //!be only opened for reading struct open_copy_on_write_t {}; diff --git a/3party/boost/boost/interprocess/detail/atomic.hpp b/3party/boost/boost/interprocess/detail/atomic.hpp index 30c28288f0..71b7a55f03 100644 --- a/3party/boost/boost/interprocess/detail/atomic.hpp +++ b/3party/boost/boost/interprocess/detail/atomic.hpp @@ -22,7 +22,7 @@ namespace boost{ namespace interprocess{ namespace detail{ -//! Atomically increment an apr_uint32_t by 1 +//! Atomically increment an boost::uint32_t by 1 //! "mem": pointer to the object //! Returns the old value pointed to by mem inline boost::uint32_t atomic_inc32(volatile boost::uint32_t *mem); @@ -564,7 +564,7 @@ namespace interprocess{ namespace detail{ inline bool atomic_add_unless32 - (volatile boost::uint32_t *mem, boost::uint32_t value, volatile boost::uint32_t unless_this) + (volatile boost::uint32_t *mem, boost::uint32_t value, boost::uint32_t unless_this) { boost::uint32_t old, c(atomic_read32(mem)); while(c != unless_this && (old = atomic_cas32(mem, c + value, c)) != c){ diff --git a/3party/boost/boost/interprocess/detail/file_wrapper.hpp b/3party/boost/boost/interprocess/detail/file_wrapper.hpp index e5c4c40d2e..1196bb0827 100644 --- a/3party/boost/boost/interprocess/detail/file_wrapper.hpp +++ b/3party/boost/boost/interprocess/detail/file_wrapper.hpp @@ -35,19 +35,19 @@ class file_wrapper //!Creates a file object with name "name" and mode "mode", with the access mode "mode" //!If the file previously exists, throws an error. - file_wrapper(create_only_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoCreate, name, mode); } + file_wrapper(create_only_t, const char *name, mode_t mode, const permissions &perm = permissions()) + { this->priv_open_or_create(detail::DoCreate, name, mode, perm); } //!Tries to create a file with name "name" and mode "mode", with the //!access mode "mode". If the file previously exists, it tries to open it with mode "mode". //!Otherwise throws an error. - file_wrapper(open_or_create_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode); } + file_wrapper(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) + { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode, perm); } //!Tries to open a file with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. file_wrapper(open_only_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoOpen, name, mode); } + { this->priv_open_or_create(detail::DoOpen, name, mode, permissions()); } //!Moves the ownership of "moved"'s file to *this. //!After the call, "moved" does not represent any file. @@ -100,7 +100,7 @@ class file_wrapper //!Closes a previously opened file mapping. Never throws. void priv_close(); //!Closes a previously opened file mapping. Never throws. - bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode); + bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm); file_handle_t m_handle; mode_t m_mode; @@ -136,7 +136,8 @@ inline mode_t file_wrapper::get_mode() const inline bool file_wrapper::priv_open_or_create (detail::create_enum_t type, const char *filename, - mode_t mode) + mode_t mode, + const permissions &perm = permissions()) { m_filename = filename; @@ -151,10 +152,10 @@ inline bool file_wrapper::priv_open_or_create m_handle = open_existing_file(filename, mode); break; case detail::DoCreate: - m_handle = create_new_file(filename, mode); + m_handle = create_new_file(filename, mode, perm); break; case detail::DoOpenOrCreate: - m_handle = create_or_open_file(filename, mode); + m_handle = create_or_open_file(filename, mode, perm); break; default: { diff --git a/3party/boost/boost/interprocess/detail/intermodule_singleton.hpp b/3party/boost/boost/interprocess/detail/intermodule_singleton.hpp index 4fef540040..ec879a688e 100644 --- a/3party/boost/boost/interprocess/detail/intermodule_singleton.hpp +++ b/3party/boost/boost/interprocess/detail/intermodule_singleton.hpp @@ -1,10 +1,3 @@ -/* Copyright 2006-2009 Joaquin M Lopez Munoz. - * 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/flyweight for library home page. - */ ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2009-2009. Distributed under the Boost @@ -15,7 +8,6 @@ // ////////////////////////////////////////////////////////////////////////////// - #ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_HPP #define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_HPP @@ -24,136 +16,1013 @@ #endif #include +#include + #include +#ifdef BOOST_INTERPROCESS_WINDOWS +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#if defined (BOOST_INTERPROCESS_WINDOWS) +#include +#include + +#include +#else +#include +#include +#include +#endif namespace boost{ namespace interprocess{ namespace detail{ -const char *get_singleton_unique_name() -{ return "unique_name"; +namespace file_locking_helpers { -template -struct atomic_functor +inline void get_pid_creation_time_str(std::string &s) { - atomic_functor(managed_shared_memory &seg) - : seg_(seg) - {} + std::stringstream stream; + stream << get_current_process_id() << '_'; + stream.precision(6); + stream << std::fixed << get_current_process_creation_time(); + s = stream.str(); +} - inline void operator()() - { - referenced_instance**pptr = seg.find_or_construct(unique_instance)(); - detail::atomic_cas32( +inline void create_tmp_subdir_and_get_pid_based_filepath(const char *subdir_name, const char *file_prefix, OS_process_id_t pid, std::string &s, bool creation_time = false) +{ + //Let's create a lock file for each process gmem that will mark if + //the process is alive or not + create_tmp_and_clean_old(s); + s += "/"; + s += subdir_name; + if(!open_or_create_directory(s.c_str())){ + throw interprocess_exception(error_info(system_error_code())); + } + s += "/"; + s += file_prefix; + if(creation_time){ + std::string sstamp; + get_pid_creation_time_str(sstamp); + s += sstamp; + } + else{ + pid_str_t pid_str; + get_pid_str(pid_str, pid); + s += pid_str; + } +} + +inline bool check_if_filename_complies_with_pid + (const char *filename, const char *prefix, OS_process_id_t pid, std::string &file_suffix, bool creation_time = false) +{ + //Check if filename complies with lock file name pattern + std::string fname(filename); + std::string fprefix(prefix); + if(fname.size() <= fprefix.size()){ + return false; + } + fname.resize(fprefix.size()); + if(fname != fprefix){ + return false; } - managed_shared_memory &seg_; + //If not our lock file, delete it if we can lock it + fname = filename; + fname.erase(0, fprefix.size()); + pid_str_t pid_str; + get_pid_str(pid_str, pid); + file_suffix = pid_str; + if(creation_time){ + std::size_t p = fname.find('_'); + if (p == std::string::npos){ + return false; + } + std::string save_suffix(fname); + fname.erase(p); + fname.swap(file_suffix); + bool ret = (file_suffix == fname); + file_suffix.swap(save_suffix); + return ret; + } + else{ + fname.swap(file_suffix); + return (file_suffix == fname); + } +} + +} //file_locking_helpers + +namespace intermodule_singleton_helpers { + +const int GMemMarkToBeRemoved = -1; +const int GMemNotPresent = -2; + +inline const char *get_lock_file_subdir_name() +{ return "gmem"; } + +inline const char *get_lock_file_base_name() +{ return "lck"; } + +inline void create_and_get_singleton_lock_file_path(std::string &s) +{ + file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath + (get_lock_file_subdir_name(), get_lock_file_base_name(), get_current_process_id(), s, true); +} + +inline const char *get_shm_base_name() +{ return "bip.gmem.shm."; } + +inline void get_shm_name(std::string &shm_name) +{ + file_locking_helpers::get_pid_creation_time_str(shm_name); + shm_name.insert(0, get_shm_base_name()); +} + +inline std::size_t get_shm_size() +{ return 65536; } + +template +struct managed_sh_dependant +{ + static void apply_gmem_erase_logic(const char *filepath, const char *filename); + + static bool remove_old_gmem() + { + std::string refcstrRootDirectory; + tmp_folder(refcstrRootDirectory); + refcstrRootDirectory += "/"; + refcstrRootDirectory += get_lock_file_subdir_name(); + return for_each_file_in_dir(refcstrRootDirectory.c_str(), apply_gmem_erase_logic); + } }; -template -struct intermodule_singleton_instantiator +#if (defined BOOST_INTERPROCESS_WINDOWS) + +template<> +struct managed_sh_dependant { - intermodule_singleton_instantiator() - : ppref(0), pc(0) - { - - bool done = false; - try{ - managed_shared_memory seg(interprocess::create_only, get_singleton_unique_name(), 16384); - //Register cleanup??? We can't because the address of a local function might be the - //address of a dll, and that dll can be UNLOADED!!! + static void apply_gmem_erase_logic(const char *, const char *){} + + static bool remove_old_gmem() + { return true; } +}; + + +struct locking_file_serial_id +{ + int fd; + unsigned long dwVolumeSerialNumber; + unsigned long nFileIndexHigh; + unsigned long nFileIndexLow; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno == EDEADLK){ + ret = _locking(fd, _LK_LOCK, 1/*lock_file_contents_length()*/); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + return 0 == _locking(fd, _LK_NBLCK , 1); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + file_handle_t handle = create_or_open_file(name, read_write, p); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; } - catch(interprocess_exception &ex){ - if(ex.get_error_code() != already_exists_error){ - managed_shared_memory seg(open_only, "unique_name", 16384); - seg.find_or_construct(unique_instance)(); + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + struct _stat s; + if(0 == _stat(name, &s)){ + return fd; + } + else{ + _close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + file_handle_t handle = open_existing_file(name, read_write); + int fd = _open_osfhandle((intptr_t)handle, _O_TEXT); + if(fd < 0){ + close_file(handle); + return fd; + } + if(!try_lock_locking_file(fd)){ + _close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ _close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct _stat s; + return EBADF != _fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + if(_isatty(fd)) + return false; + struct _stat s; + if(0 != _fstat(fd, &s)) + return false; + return 0 != (s.st_mode & _S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct _stat s; + if(0 != _fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + id.fd = fd; + id.dwVolumeSerialNumber = info.dwVolumeSerialNumber; + id.nFileIndexHigh = info.nFileIndexHigh; + id.nFileIndexLow = info.nFileIndexLow; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + winapi::interprocess_by_handle_file_information info; + if(!winapi::get_file_information_by_handle((void*)_get_osfhandle(fd), &info)) + return false; + + return id.dwVolumeSerialNumber == info.dwVolumeSerialNumber && + id.nFileIndexHigh == info.nFileIndexHigh && + id.nFileIndexLow == info.nFileIndexLow; +} + +#else //UNIX + +struct locking_file_serial_id +{ + int fd; + dev_t st_dev; + ino_t st_ino; + //This reference count counts the number of modules attached + //to the shared memory and lock file. This serves to unlink + //the locking file and shared memory when all modules are + //done with the global memory (shared memory) + volatile boost::uint32_t modules_attached_to_gmem_count; +}; + +inline bool lock_locking_file(int fd) +{ + int ret = 0; + while(ret != 0 && errno != EINTR){ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + ret = fcntl (fd, F_SETLKW, &lock); + } + return 0 == ret; +} + +inline bool try_lock_locking_file(int fd) +{ + struct flock lock; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + return 0 == fcntl (fd, F_SETLK, &lock); +} + +inline int open_or_create_and_lock_file(const char *name) +{ + permissions p; + p.set_unrestricted(); + while(1){ + int fd = create_or_open_file(name, read_write, p); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + struct stat s; + if(0 == stat(name, &s)){ + return fd; + } + else{ + close(fd); + } + } +} + +inline int try_open_and_lock_file(const char *name) +{ + int fd = open_existing_file(name, read_write); + if(fd < 0){ + return fd; + } + if(!try_lock_locking_file(fd)){ + close(fd); + return -1; + } + return fd; +} + +inline void close_lock_file(int fd) +{ close(fd); } + +inline bool is_valid_fd(int fd) +{ + struct stat s; + return EBADF != fstat(fd, &s); +} + +inline bool is_normal_file(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + return 0 != (s.st_mode & S_IFREG); +} + +inline std::size_t get_size(int fd) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return 0u; + return (std::size_t)s.st_size; +} + +inline bool fill_file_serial_id(int fd, locking_file_serial_id &id) +{ + struct stat s; + if(0 != fstat(fd, &s)) + return false; + id.fd = fd; + id.st_dev = s.st_dev; + id.st_ino = s.st_ino; + id.modules_attached_to_gmem_count = 1; //Initialize attached count + return true; +} + +inline bool compare_file_serial(int fd, const locking_file_serial_id &id) +{ + struct stat info; + if(0 != fstat(fd, &info)) + return false; + + return id.st_dev == info.st_dev && + id.st_ino == info.st_ino; +} + +#endif + +template +struct gmem_erase_func +{ + gmem_erase_func(const char *shm_name, const char *singleton_lock_file_path, ManagedShMem & shm) + :shm_name_(shm_name), singleton_lock_file_path_(singleton_lock_file_path), shm_(shm) + {} + + void operator()() + { + locking_file_serial_id *pserial_id = shm_.template find("lock_file_fd").first; + if(pserial_id){ + pserial_id->fd = GMemMarkToBeRemoved; + } + delete_file(singleton_lock_file_path_); + shared_memory_object::remove(shm_name_); + } + + const char * const shm_name_; + const char * const singleton_lock_file_path_; + ManagedShMem & shm_; +}; + +//This function applies shared memory erasure logic based on the passed lock file. +template +void managed_sh_dependant:: + apply_gmem_erase_logic(const char *filepath, const char *filename) +{ + int fd = GMemMarkToBeRemoved; + try{ + std::string str; + //If the filename is current process lock file, then avoid it + if(file_locking_helpers::check_if_filename_complies_with_pid + (filename, get_lock_file_base_name(), get_current_process_id(), str, true)){ + return; + } + //Open and lock the other process' lock file + fd = try_open_and_lock_file(filepath); + if(fd < 0){ + return; + } + //If done, then the process is dead so take global shared memory name + //(the name is based on the lock file name) and try to apply erasure logic + str.insert(0, get_shm_base_name()); + try{ + ManagedShMem shm(open_only, str.c_str()); + gmem_erase_func func(str.c_str(), filepath, shm); + shm.try_atomic_func(func); + } + catch(interprocess_exception &e){ + //If shared memory is not found erase the lock file + if(e.get_error_code() == not_found_error){ + delete_file(filepath); } + } + } + catch(...){ + + } + if(fd >= 0){ + close_lock_file(fd); + } +} + +} //namespace intermodule_singleton_helpers { + + + +namespace intermodule_singleton_helpers { + +//The lock file logic creates uses a unique instance to a file +template +struct lock_file_logic +{ + lock_file_logic(ManagedShMem &shm) + : mshm(shm) + { shm.atomic_func(*this); } + + void operator()(void) + { + retry_with_new_shm = false; + + //First find the file locking descriptor id + locking_file_serial_id *pserial_id = + mshm.template find("lock_file_fd").first; + + int fd; + //If not found schedule a creation + if(!pserial_id){ + fd = GMemNotPresent; + } + //Else get it + else{ + fd = pserial_id->fd; + } + //If we need to create a new one, do it + if(fd == GMemNotPresent){ + std::string lck_str; + //Create a unique current pid based lock file path + create_and_get_singleton_lock_file_path(lck_str); + //Open or create and lock file + int fd = intermodule_singleton_helpers::open_or_create_and_lock_file(lck_str.c_str()); + //If failed, write a bad file descriptor to notify other modules that + //something was wrong and unlink shared memory. Mark the function object + //to tell caller to retry with another shared memory + if(fd < 0){ + this->register_lock_file(GMemMarkToBeRemoved); + std::string s; + get_shm_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_shm = true; + } + //If successful, register the file descriptor else{ + this->register_lock_file(fd); + } + } + //If the fd was invalid (maybe a previous try failed) notify caller that + //should retry creation logic, since this shm might have been already + //unlinked since the shm was removed + else if (fd == GMemMarkToBeRemoved){ + retry_with_new_shm = true; + } + //If the stored fd is not valid (a open fd, a normal file with the + //expected size, or does not have the same file id number, + //then it's an old shm from an old process with the same pid. + //If that's the case, mark it as invalid + else if(!is_valid_fd(fd) || + !is_normal_file(fd) || + 0 != get_size(fd) || + !compare_file_serial(fd, *pserial_id)){ + pserial_id->fd = GMemMarkToBeRemoved; + std::string s; + get_shm_name(s); + shared_memory_object::remove(s.c_str()); + retry_with_new_shm = true; + } + else{ + //If the lock file is ok, increment reference count of + //attached modules to shared memory + atomic_inc32(&pserial_id->modules_attached_to_gmem_count); + } + } + + private: + locking_file_serial_id * register_lock_file(int fd) + { + locking_file_serial_id *pinfo = mshm.template construct("lock_file_fd")(); + fill_file_serial_id(fd, *pinfo); + return pinfo; + } + + public: + ManagedShMem &mshm; + bool retry_with_new_shm; +}; + +#if defined (BOOST_INTERPROCESS_WINDOWS) + +template<> +struct lock_file_logic +{ + lock_file_logic(managed_windows_shared_memory &) + : retry_with_new_shm(false) + {} + + void operator()(void){} + const bool retry_with_new_shm; +}; + +#endif + +} //namespace intermodule_singleton_helpers { + +//This class contains common code for all singleton types, so that we instantiate this +//code just once per module. This class also holds a reference counted shared memory +//to be used by all instances + +template +class intermodule_singleton_common +{ + public: + typedef void*(singleton_constructor_t)(ManagedShMem &); + typedef void (singleton_destructor_t)(void *, ManagedShMem &); + + static const ::boost::uint32_t Uninitialized = 0u; + static const ::boost::uint32_t Initializing = 1u; + static const ::boost::uint32_t Initialized = 2u; + static const ::boost::uint32_t Broken = 3u; + + static void finalize_singleton_logic(void *ptr, singleton_destructor_t destructor) + { + if(ptr) + destructor(ptr, get_shm()); + //If this is the last singleton of this module + //apply shm destruction. + //Note: singletons are destroyed when the module is unloaded + //so no threads should be executing or holding references + //to this module + if(1 == atomic_dec32(&this_module_singleton_count)){ + destroy_shm(); + } + } + + static void initialize_singleton_logic + (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t ini_func); + + private: + static ManagedShMem &get_shm() + { + return *static_cast(static_cast(&shm_mem)); + } + + enum { MemSize = ((sizeof(ManagedShMem)-1)/sizeof(max_align))+1u }; + + static void initialize_shm(); + static void destroy_shm(); + //Static data, zero-initalized without any dependencies + //this_module_singleton_count is the number of singletons used by this module + static volatile boost::uint32_t this_module_singleton_count; + //this_module_shm_initialized is the state of this module's shm class object + static volatile boost::uint32_t this_module_shm_initialized; + static max_align shm_mem[MemSize]; +}; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_singleton_count; + +template +volatile boost::uint32_t intermodule_singleton_common::this_module_shm_initialized; + +template +max_align intermodule_singleton_common::shm_mem[intermodule_singleton_common::MemSize]; + +template +void intermodule_singleton_common::initialize_shm() +{ + //Obtain unique shm name and size + std::string s; + intermodule_singleton_helpers::get_shm_name(s); + const char *ShmName = s.c_str(); + const std::size_t ShmSize = intermodule_singleton_helpers::get_shm_size();; + while(1){ + //Try to pass shm state to initializing + ::boost::uint32_t tmp = atomic_cas32(&this_module_shm_initialized, Initializing, Uninitialized); + if(tmp >= Initialized){ + break; + } + //If some other thread is doing the work wait + else if(tmp == Initializing){ + thread_yield(); + } + else{ //(tmp == Uninitialized) + //If not initialized try it again? + try{ + //Remove old shared memory from the system + intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); + //in-place construction of the shared memory class + ::new (&get_shm())ManagedShMem(open_or_create, ShmName, ShmSize); + //Use shared memory internal lock to initialize the lock file + //that will mark this gmem as "in use". + intermodule_singleton_helpers::lock_file_logic f(get_shm()); + //If function failed (maybe a competing process has erased the shared + //memory between creation and file locking), retry with a new instance. + if(f.retry_with_new_shm){ + get_shm().~ManagedShMem(); + atomic_write32(&this_module_shm_initialized, Uninitialized); + } + else{ + //Locking succeeded, so this shared memory module-instance is ready + atomic_write32(&this_module_shm_initialized, Initialized); + break; + } + } + catch(...){ + // throw; } } + } +} +template +struct unlink_shmlogic +{ + unlink_shmlogic(ManagedShMem &mshm) + : mshm_(mshm) + { mshm.atomic_func(*this); } + void operator()() { - ppref=seg.find_or_construct(unique_instance)(); - if(*ppref){ - /* As in some OSes Boost.Interprocess memory segments can outlive - * their associated processes, there is a possibility that we - * retrieve a dangling pointer (coming from a previous aborted run, - * for instance). Try to protect against this by checking that - * the contents of the pointed object are consistent. - */ - if(std::strcmp(segment_name,(*ppref)->segment_name)!=0){ - *ppref=0; /* dangling pointer! */ + intermodule_singleton_helpers::locking_file_serial_id *pserial_id = + mshm_.template find + ("lock_file_fd").first; + BOOST_ASSERT(0 != pserial_id); + if(1 == atomic_dec32(&pserial_id->modules_attached_to_gmem_count)){ + int fd = pserial_id->fd; + if(fd > 0){ + pserial_id->fd = intermodule_singleton_helpers::GMemMarkToBeRemoved; + std::string s; + intermodule_singleton_helpers::create_and_get_singleton_lock_file_path(s); + delete_file(s.c_str()); + intermodule_singleton_helpers::close_lock_file(fd); + intermodule_singleton_helpers::get_shm_name(s); + shared_memory_object::remove(s.c_str()); } - else ++((*ppref)->ref); } } - if(!*ppref){ - std::auto_ptr apc( - new referenced_instance(segment_name)); - interprocess::scoped_lock lock(mutex); - ppref=seg.find_or_construct( - typeid(C).name())((referenced_instance*)0); - if(!*ppref)*ppref=apc.release(); - ++((*ppref)->ref); - } - pc=&(*ppref)->c; - } - - ~intermodule_singleton_instantiator() - { - /* As in construction time, actual deletion is performed outside the - * lock to avoid leaving the lock dangling in case of crash. - */ - - referenced_instance* pref=0; - { - interprocess::scoped_lock lock(mutex); - if(--((*ppref)->ref)==0){ - pref=*ppref; - *ppref=0; - } - } - if(pref)delete pref; - } + ManagedShMem &mshm_; }; -template -struct intermodule_singleton +#if defined (BOOST_INTERPROCESS_WINDOWS) + +template<> +struct unlink_shmlogic { - static C& get() - { - static intermodule_singleton_instantiator instance; - return instance.get(); - } + unlink_shmlogic(managed_windows_shared_memory &) + {} + void operator()(){} +}; -private: +#endif - C& get()const{return *pc;} - - private: - interprocess::managed_shared_memory seg; - struct referenced_instance - { - referenced_instance(const char* segment_name_):ref(0) + +template +void intermodule_singleton_common::destroy_shm() +{ + if(!atomic_read32(&this_module_singleton_count)){ + //This module is being unloaded, so destroy + //the shared memory object of this module + //and unlink the shared memory if it's the last + unlink_shmlogic f(get_shm()); + (get_shm()).~ManagedShMem(); + atomic_write32(&this_module_shm_initialized, Uninitialized); + //Do some cleanup for other processes old gmem instances + intermodule_singleton_helpers::managed_sh_dependant::remove_old_gmem(); + } +} + +//Initialize this_module_singleton_ptr, creates the shared memory if needed and also creates an unique +//opaque type in shared memory through a singleton_constructor_t function call, +//initializing the passed pointer to that unique instance. +// +//We have two concurrency types here. a)the shared memory/singleton creation must +//be safe between threads of this process but in different modules/dlls. b) +//the pointer to the singleton is per-module, so we have to protect this +//initization between threads of the same module. +// +//All static variables declared here are shared between inside a module +//so atomic operations will synchronize only threads of the same module. +template +void intermodule_singleton_common::initialize_singleton_logic + (void *&ptr, volatile boost::uint32_t &this_module_singleton_initialized, singleton_constructor_t constructor) +{ + //If current module is not initialized enter to lock free logic + if(atomic_read32(&this_module_singleton_initialized) != Initialized){ + //Now a single thread of the module will succeed in this CAS. + //trying to pass from Uninitialized to Initializing + ::boost::uint32_t previous_module_singleton_initialized = atomic_cas32 + (&this_module_singleton_initialized, Initializing, Uninitialized); + //If the thread succeeded the CAS (winner) it will compete with other + //winner threads from other modules to create the shared memory + if(previous_module_singleton_initialized == Uninitialized){ + try{ + //Now initialize shm, this function solves concurrency issues + //between threads of several modules + initialize_shm(); + //Increment the module reference count that reflects how many + //singletons this module holds, so that we can safely destroy + //module shared memory object when no singleton is left + atomic_inc32(&this_module_singleton_count); + //Now try to create the singleton in shared memory. + //This function solves concurrency issues + //between threads of several modules + void *tmp = constructor(get_shm()); + //Insert a barrier before assigning the pointer to + //make sure this assignment comes after the initialization + atomic_write32(&this_module_singleton_initialized, Initializing); + //Assign the singleton address to the module-local pointer + ptr = tmp; + //Memory barrier inserted, all previous operations should complete + //before this one. Now marked as initialized + atomic_inc32(&this_module_singleton_initialized); + } + catch(...){ + //Mark singleton failed to initialize + atomic_write32(&this_module_singleton_initialized, Broken); + throw; + } + } + //If previous state was initializing, this means that another winner thread is + //trying to initialize the singleton. Just wait until completes its work. + else if(previous_module_singleton_initialized == Initializing){ + while(1){ + previous_module_singleton_initialized = atomic_read32(&this_module_singleton_initialized); + if(previous_module_singleton_initialized >= Initialized){ + //Already initialized, or exception thrown by initializer thread + break; + } + else if(previous_module_singleton_initialized == Initializing){ + detail::thread_yield(); + } + else{ + //This can't be happening! + BOOST_ASSERT(0); + } + } + } + else if(previous_module_singleton_initialized == Initialized){ + //Nothing to do here, the singleton is ready + } + //If previous state was greater than initialized, then memory is broken + //trying to initialize the singleton. + else{//(previous_module_singleton_initialized > Initialized) + throw interprocess_exception("boost::interprocess::intermodule_singleton initialization failed"); + } + } + BOOST_ASSERT(ptr != 0); +} + +//Now this class is a singleton, initializing the singleton in +//the first get() function call if LazyInit is false. If true +//then the singleton will be initialized when loading the module. +template +class intermodule_singleton_impl +{ + public: + static C& get() //Let's make inlining easy + { + if(!this_module_singleton_ptr){ + if(lifetime.dummy_function()) //This forces lifetime instantiation, for reference counted destruction + intermodule_singleton_common::initialize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); + } + return *static_cast(this_module_singleton_ptr); + } + + private: + + struct ref_count_ptr + { + ref_count_ptr(C *p, boost::uint32_t count) + : ptr(p), singleton_ref_count(count) + {} + C *ptr; + //This reference count serves to count the number of attached + //modules to this singleton + volatile boost::uint32_t singleton_ref_count; + }; + + //These statics will be zero-initialized without any constructor call dependency + //this_module_singleton_ptr will be a module-local pointer to the singleton + static void* this_module_singleton_ptr; + //this_module_singleton_count will be used to synchronize threads of the same module + //for access to a singleton instance, and to flag the state of the + //singleton. + static volatile boost::uint32_t this_module_singleton_initialized; + + //This class destructor will trigger singleton destruction + struct lifetime_type_lazy + { + bool dummy_function() + { return m_dummy == 0; } + + ~lifetime_type_lazy() { - std::strcpy(segment_name,segment_name_); + intermodule_singleton_common::finalize_singleton_logic + (this_module_singleton_ptr, singleton_destructor); } + //Dummy volatile so that the compiler can't resolve its value at compile-time + //and can't avoid lifetime_type instantiation if dummy_function() is called. + static volatile int m_dummy; + }; - ~referenced_instance(){segment_name[0]='\0';} + struct lifetime_type_static + : public lifetime_type_lazy + { + lifetime_type_static() + { + intermodule_singleton_common::initialize_singleton_logic + (this_module_singleton_ptr, this_module_singleton_initialized, singleton_constructor); + } + }; - char segment_name[128]; /* used to detect dangling pointers */ - mutable long ref; - C c; - }** ppref; - C* pc; - }; + typedef typename if_c + ::type lifetime_type; + + static lifetime_type lifetime; + + //A functor to be executed inside shared memory lock that just + //searches for the singleton in shm and if not present creates a new one. + //If singleton constructor throws, the exception is propagated + struct init_atomic_func + { + init_atomic_func(ManagedShMem &m) + : mshm(m) + {} + + void operator()() + { + ref_count_ptr *rcount = mshm.template find(unique_instance).first; + if(!rcount){ + C *p = new C(); + try{ + rcount = mshm.template construct(unique_instance)(p, 0u); + } + catch(...){ + delete p; + throw; + } + } + atomic_inc32(&rcount->singleton_ref_count); + ret_ptr = rcount->ptr; + } + ManagedShMem &mshm; + void *ret_ptr; + }; + + //A functor to be executed inside shared memory lock that just + //deletes the singleton in shm if the attached count reaches to zero + struct fini_atomic_func + { + fini_atomic_func(ManagedShMem &m) + : mshm(m) + {} + + void operator()() + { + ref_count_ptr *rcount = mshm.template find(unique_instance).first; + //The object must exist + BOOST_ASSERT(rcount); + //Check if last reference + if(atomic_dec32(&rcount->singleton_ref_count) == 1){ + //If last, destroy the object + BOOST_ASSERT(rcount->ptr != 0); + delete rcount->ptr; + //Now destroy shm entry + bool destroyed = mshm.template destroy(unique_instance); + (void)destroyed; BOOST_ASSERT(destroyed == true); + } + } + ManagedShMem &mshm; + void *ret_ptr; + }; + + //A wrapper to execute init_atomic_func + static void *singleton_constructor(ManagedShMem &mshm) + { + init_atomic_func f(mshm); + mshm.atomic_func(f); + return f.ret_ptr; + } + + //A wrapper to execute fini_atomic_func + static void singleton_destructor(void *p, ManagedShMem &mshm) + { (void)p; + fini_atomic_func f(mshm); + mshm.atomic_func(f); + } }; -template -inline void atomic_functor::operator()() -{ - referenced_instance *pptr = seg.find_or_construct(unique_instance)(); -}; +template +volatile int intermodule_singleton_impl::lifetime_type_lazy::m_dummy; + +//These will be zero-initialized by the loader +template +void *intermodule_singleton_impl::this_module_singleton_ptr; + +template +volatile boost::uint32_t intermodule_singleton_impl::this_module_singleton_initialized; + +template +typename intermodule_singleton_impl::lifetime_type + intermodule_singleton_impl::lifetime; + +template +class portable_intermodule_singleton + : public intermodule_singleton_impl +{}; + +#ifdef BOOST_INTERPROCESS_WINDOWS + +template +class windows_intermodule_singleton + : public intermodule_singleton_impl +{}; + +#endif + +//Now this class is a singleton, initializing the singleton in +//the first get() function call if LazyInit is false. If true +//then the singleton will be initialized when loading the module. +template +class intermodule_singleton + #ifdef BOOST_INTERPROCESS_WINDOWS + : public windows_intermodule_singleton +// : public portable_intermodule_singleton + #else + : public portable_intermodule_singleton + #endif +{}; } //namespace detail{ diff --git a/3party/boost/boost/interprocess/detail/intersegment_ptr.hpp b/3party/boost/boost/interprocess/detail/intersegment_ptr.hpp index c70c6815a4..9151844aac 100644 --- a/3party/boost/boost/interprocess/detail/intersegment_ptr.hpp +++ b/3party/boost/boost/interprocess/detail/intersegment_ptr.hpp @@ -35,7 +35,7 @@ #include //BOOST_STATIC_ASSERT #include //CHAR_BIT #include -#include //assert +#include //BOOST_ASSERT #include //!\file @@ -133,7 +133,7 @@ struct intersegment_base void relative_set_begin_from_base(void *addr) { - assert(addr < static_cast(this)); + BOOST_ASSERT(addr < static_cast(this)); std::size_t off = reinterpret_cast(this) - reinterpret_cast(addr); members.relative.beg = off >> align_bits; } @@ -144,7 +144,7 @@ struct intersegment_base { std::size_t pow = members.relative.pow; std::size_t size = (std::size_t(1u) << pow); - assert(pow >= frc_size_bits); + BOOST_ASSERT(pow >= frc_size_bits); size |= members.relative.frc << (pow - frc_size_bits); return size; } @@ -157,7 +157,7 @@ struct intersegment_base pow = detail::floor_log2(orig_size); std::size_t low_size = (std::size_t(1) << pow); std::size_t diff = orig_size - low_size; - assert(pow >= frc_size_bits); + BOOST_ASSERT(pow >= frc_size_bits); std::size_t rounded = detail::get_rounded_size_po2 (diff, (1u << (pow - frc_size_bits))); if(rounded == low_size){ @@ -168,7 +168,7 @@ struct intersegment_base else{ frc = rounded >> (pow - frc_size_bits); } - assert(((frc << (pow - frc_size_bits)) & (align-1))==0); + BOOST_ASSERT(((frc << (pow - frc_size_bits)) & (align-1))==0); return low_size + rounded; } @@ -177,7 +177,7 @@ struct intersegment_base void set_mode(std::size_t mode) { - assert(mode < is_max_mode); + BOOST_ASSERT(mode < is_max_mode); members.direct.ctrl = mode; } @@ -328,7 +328,7 @@ struct flat_map_intersegment std::size_t pow, frc; std::size_t s = calculate_size(this_info.size, pow, frc); (void)s; - assert(this_info.size == s); + BOOST_ASSERT(this_info.size == s); this->members.relative.pow = pow; this->members.relative.frc = frc; } @@ -397,14 +397,14 @@ struct flat_map_intersegment void pop_back() { - assert(!m_segments.empty()); + BOOST_ASSERT(!m_segments.empty()); m_segments.erase(--m_segments.end()); } void *address_of(std::size_t segment_id) { - assert(segment_id < (std::size_t)m_segments.size()); + BOOST_ASSERT(segment_id < (std::size_t)m_segments.size()); return m_segments[segment_id].addr; } @@ -451,7 +451,7 @@ struct flat_map_intersegment ~mappings_t() { //Check that all mappings have been erased - assert(m_ptr_to_segment_info.empty()); + BOOST_ASSERT(m_ptr_to_segment_info.empty()); } }; @@ -517,7 +517,7 @@ struct flat_map_intersegment info.id = group_id->get_size(); it_b_t ret = s_map.m_ptr_to_segment_info.insert(value_type(ptr, info)); - assert(ret.second); + BOOST_ASSERT(ret.second); value_eraser v_eraser(s_map.m_ptr_to_segment_info, ret.first); group_id->push_back(ptr, size); @@ -537,7 +537,7 @@ struct flat_map_intersegment group_id->pop_back(); std::size_t erased = s_map.m_ptr_to_segment_info.erase(addr); (void)erased; - assert(erased); + BOOST_ASSERT(erased); return true; } } @@ -550,7 +550,7 @@ struct flat_map_intersegment typedef typename segment_groups_t::iterator iterator; std::pair ret = s_groups.insert(segment_group_t(*services)); - assert(ret.second); + BOOST_ASSERT(ret.second); return &*ret.first; } } diff --git a/3party/boost/boost/interprocess/detail/managed_memory_impl.hpp b/3party/boost/boost/interprocess/detail/managed_memory_impl.hpp index 5088a0a45b..e29fe5030b 100644 --- a/3party/boost/boost/interprocess/detail/managed_memory_impl.hpp +++ b/3party/boost/boost/interprocess/detail/managed_memory_impl.hpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include //!\file //!Describes a named shared memory allocation user class. @@ -519,7 +519,16 @@ class basic_managed_memory_impl //!function call. If the functor throws, this function throws. template void atomic_func(Func &f) - { mp_header->atomic_func(f); } + { mp_header->atomic_func(f); } + + //!Tries to call a functor guaranteeing that no new construction, search or + //!destruction will be executed by any process while executing the object + //!function call. If the atomic function can't be immediatelly executed + //!because the internal mutex is already locked, returns false. + //!If the functor throws, this function throws. + template + bool try_atomic_func(Func &f) + { return mp_header->try_atomic_func(f); } //!Destroys a named memory object or array. //! @@ -673,7 +682,7 @@ class basic_managed_memory_impl template typename allocator::type get_allocator() - { return mp_header->BOOST_NESTED_TEMPLATE get_allocator(); } + { return mp_header->template get_allocator(); } //!This is the default deleter to delete types T //!from this managed segment. @@ -688,7 +697,7 @@ class basic_managed_memory_impl template typename deleter::type get_deleter() - { return mp_header->BOOST_NESTED_TEMPLATE get_deleter(); } + { return mp_header->template get_deleter(); } /// @cond //!Tries to find a previous named allocation address. Returns a memory diff --git a/3party/boost/boost/interprocess/detail/managed_multi_shared_memory.hpp b/3party/boost/boost/interprocess/detail/managed_multi_shared_memory.hpp index 3439140099..b03ca618cf 100644 --- a/3party/boost/boost/interprocess/detail/managed_multi_shared_memory.hpp +++ b/3party/boost/boost/interprocess/detail/managed_multi_shared_memory.hpp @@ -27,11 +27,13 @@ #include //list #include //mapped_region #include +#include #include //managed_open_or_create_impl #include #include #include #include +#include //!\file //!Describes a named shared memory object allocation user class. @@ -40,6 +42,11 @@ namespace boost { namespace interprocess { +//TODO: We must somehow obtain the permissions of the first segment +//to apply them to subsequent segments +//-Use GetSecurityInfo? +//-Change everything to use only a shared memory object expanded via truncate()? + //!A basic shared memory named object creation class. Initializes the //!shared memory segment. Inherits all basic functionality from //!basic_managed_memory_impl @@ -113,7 +120,7 @@ class basic_managed_multi_shared_memory alloc_size = (m_min_segment_size > alloc_size) ? m_min_segment_size : alloc_size; if(mp_frontend->priv_new_segment(create_open_func::DoCreate, - alloc_size, 0)){ + alloc_size, 0, permissions())){ shmem_list_t::value_type &m_impl = *mp_frontend->m_shmem_list.rbegin(); return result_type(m_impl.get_real_address(), m_impl.get_real_size()-1); } @@ -190,7 +197,7 @@ class basic_managed_multi_shared_memory } if(mapped){ bool ret = void_pointer::erase_last_mapping(group); - assert(ret);(void)ret; + BOOST_ASSERT(ret);(void)ret; } return false; } @@ -233,24 +240,26 @@ class basic_managed_multi_shared_memory basic_managed_multi_shared_memory(create_only_t, const char *name, - std::size_t size) + std::size_t size, + const permissions &perm = permissions()) : m_group_services(get_this_pointer()) { - priv_open_or_create(create_open_func::DoCreate,name, size); + priv_open_or_create(create_open_func::DoCreate,name, size, perm); } basic_managed_multi_shared_memory(open_or_create_t, const char *name, - std::size_t size) + std::size_t size, + const permissions &perm = permissions()) : m_group_services(get_this_pointer()) { - priv_open_or_create(create_open_func::DoOpenOrCreate, name, size); + priv_open_or_create(create_open_func::DoOpenOrCreate, name, size, perm); } basic_managed_multi_shared_memory(open_only_t, const char *name) : m_group_services(get_this_pointer()) { - priv_open_or_create(create_open_func::DoOpen, name, 0); + priv_open_or_create(create_open_func::DoOpen, name, 0, permissions()); } ~basic_managed_multi_shared_memory() @@ -259,7 +268,8 @@ class basic_managed_multi_shared_memory private: bool priv_open_or_create(typename create_open_func::type_t type, const char *name, - std::size_t size) + std::size_t size, + const permissions &perm) { if(!m_shmem_list.empty()) return false; @@ -273,7 +283,7 @@ class basic_managed_multi_shared_memory m_group_services.set_min_segment_size(size); if(group){ - if(this->priv_new_segment(type, size, 0)){ + if(this->priv_new_segment(type, size, 0, perm)){ return true; } } @@ -289,7 +299,8 @@ class basic_managed_multi_shared_memory bool priv_new_segment(typename create_open_func::type_t type, std::size_t size, - const void *addr) + const void *addr, + const permissions &perm) { BOOST_TRY{ //Get the number of groups of this multi_segment group @@ -314,7 +325,7 @@ class basic_managed_multi_shared_memory switch(type){ case create_open_func::DoCreate: { - managed_impl shm(create_only, name, size, read_write, addr, func); + managed_impl shm(create_only, name, size, read_write, addr, func, perm); mshm = boost::interprocess::move(shm); } break; @@ -328,7 +339,7 @@ class basic_managed_multi_shared_memory case create_open_func::DoOpenOrCreate: { - managed_impl shm(open_or_create, name, size, read_write, addr, func); + managed_impl shm(open_or_create, name, size, read_write, addr, func, perm); mshm = boost::interprocess::move(shm); } break; @@ -362,7 +373,7 @@ class basic_managed_multi_shared_memory //(*itbeg)->close_with_func(close_func(this)); //Delete group. All mappings are erased too. ret = void_pointer::delete_group(group); - assert(ret); + BOOST_ASSERT(ret); m_shmem_list.clear(); } } diff --git a/3party/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp b/3party/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp index d2ff931c48..b3e885a648 100644 --- a/3party/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp +++ b/3party/boost/boost/interprocess/detail/managed_open_or_create_impl.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include namespace boost { @@ -60,8 +61,9 @@ class managed_open_or_create_impl managed_open_or_create_impl(create_only_t, const char *name, std::size_t size, - mode_t mode = read_write, - const void *addr = 0) + mode_t mode, + const void *addr, + const permissions &perm) { m_name = name; priv_open_or_create @@ -69,13 +71,14 @@ class managed_open_or_create_impl , size , mode , addr + , perm , null_mapped_region_function()); } managed_open_or_create_impl(open_only_t, const char *name, - mode_t mode = read_write, - const void *addr = 0) + mode_t mode, + const void *addr) { m_name = name; priv_open_or_create @@ -83,6 +86,7 @@ class managed_open_or_create_impl , 0 , mode , addr + , permissions() , null_mapped_region_function()); } @@ -90,8 +94,9 @@ class managed_open_or_create_impl managed_open_or_create_impl(open_or_create_t, const char *name, std::size_t size, - mode_t mode = read_write, - const void *addr = 0) + mode_t mode, + const void *addr, + const permissions &perm) { m_name = name; priv_open_or_create @@ -99,6 +104,7 @@ class managed_open_or_create_impl , size , mode , addr + , perm , null_mapped_region_function()); } @@ -108,7 +114,8 @@ class managed_open_or_create_impl std::size_t size, mode_t mode, const void *addr, - const ConstructFunc &construct_func) + const ConstructFunc &construct_func, + const permissions &perm) { m_name = name; priv_open_or_create @@ -116,6 +123,7 @@ class managed_open_or_create_impl , size , mode , addr + , perm , construct_func); } @@ -132,6 +140,7 @@ class managed_open_or_create_impl , 0 , mode , addr + , permissions() , construct_func); } @@ -141,7 +150,8 @@ class managed_open_or_create_impl std::size_t size, mode_t mode, const void *addr, - const ConstructFunc &construct_func) + const ConstructFunc &construct_func, + const permissions &perm) { m_name = name; priv_open_or_create @@ -149,6 +159,7 @@ class managed_open_or_create_impl , size , mode , addr + , perm , construct_func); } @@ -206,16 +217,16 @@ class managed_open_or_create_impl //These are templatized to allow explicit instantiations template - static void create_device(DeviceAbstraction &dev, const char *name, std::size_t size, detail::false_) + static void create_device(DeviceAbstraction &dev, const char *name, std::size_t size, const permissions &perm, detail::false_) { - DeviceAbstraction tmp(create_only, name, read_write, size); + DeviceAbstraction tmp(create_only, name, read_write, size, perm); tmp.swap(dev); } template - static void create_device(DeviceAbstraction &dev, const char *name, std::size_t, detail::true_) + static void create_device(DeviceAbstraction &dev, const char *name, std::size_t, const permissions &perm, detail::true_) { - DeviceAbstraction tmp(create_only, name, read_write); + DeviceAbstraction tmp(create_only, name, read_write, perm); tmp.swap(dev); } @@ -223,6 +234,7 @@ class managed_open_or_create_impl void priv_open_or_create (detail::create_enum_t type, std::size_t size, mode_t mode, const void *addr, + const permissions &perm, ConstructFunc construct_func) { typedef detail::bool_ file_like_t; @@ -255,7 +267,7 @@ class managed_open_or_create_impl cow = true; } else if(type == detail::DoCreate){ - create_device(dev, m_name.c_str(), size, file_like_t()); + create_device(dev, m_name.c_str(), size, perm, file_like_t()); created = true; } else if(type == detail::DoOpenOrCreate){ @@ -266,7 +278,7 @@ class managed_open_or_create_impl bool completed = false; while(!completed){ try{ - create_device(dev, m_name.c_str(), size, file_like_t()); + create_device(dev, m_name.c_str(), size, perm, file_like_t()); created = true; completed = true; } diff --git a/3party/boost/boost/interprocess/detail/move.hpp b/3party/boost/boost/interprocess/detail/move.hpp index 31d108f228..d41f78d71e 100644 --- a/3party/boost/boost/interprocess/detail/move.hpp +++ b/3party/boost/boost/interprocess/detail/move.hpp @@ -1,6 +1,7 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009. +// (C) Copyright David Abrahams, Vicente Botet 2009. +// (C) Copyright Ion Gaztanaga 2009-2010. // 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) @@ -8,19 +9,11 @@ // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// -// -// Parts of this file come from Adobe's Move library: -// -// Copyright 2005-2007 Adobe Systems Incorporated -// Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt -// or a copy at http://stlab.adobe.com/licenses.html) -// -////////////////////////////////////////////////////////////////////////////// //! \file -#ifndef BOOST_MOVE_HPP -#define BOOST_MOVE_HPP +#ifndef BOOST_MOVE_DETAIL_MOVE_HPP +#define BOOST_MOVE_DETAIL_MOVE_HPP #include #include //copy, copy_backward @@ -32,10 +25,51 @@ #include #include +//! Defining or undefining this macro will change Boost.Move behaviour +//! for copyable and movable classes when assigning from non-const rvalues: +//! \code +//! copyable_and_movable produce(){ return copyable_and_movable(); } +//! \endcode +//! If the macro is NOT defined: +//! \code +//! copyable_and_movable cm; +//! cm = copyable_and_movable(); //object is COPIED (missed optimization) +//! \endcode +//! If the macro IS defined: +//! \code +//! copyable_and_movable cm; +//! cm = copyable_and_movable(); //object is MOVED +//! \endcode +//! However, the second option has also some downsides. See documentation for more details. +#define BOOST_MOVE_OPTIMIZED_EMULATION + /// @cond +//Define to easily port between Boost.Move and internal Boost.Interprocess move emulation +// +// This configuration is temporary. Boost.Interprocess emulation uses +// different macros to avoid any redefinition of a top-levl Boost macro. +// It will disappear once the library is accepted and +// Boost.Interprocess is updated to the standard interface. +// +#define BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE + +#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE + +#define INTERPROCESS_NAMESPACE_BEGIN namespace interprocess { +#define INTERPROCESS_NAMESPACE_END }// namespace interprocess { +#define BOOST_MOVE_NAMESPACE boost::interprocess + +#else //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE + +#define INTERPROCESS_NAMESPACE_BEGIN +#define INTERPROCESS_NAMESPACE_END +#define BOOST_MOVE_NAMESPACE boost + +#endif //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE + namespace boost { -namespace interprocess { +INTERPROCESS_NAMESPACE_BEGIN namespace move_detail { template @@ -56,18 +90,43 @@ class is_convertible enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; }; -} //namespace interprocess { } //namespace move_detail { +INTERPROCESS_NAMESPACE_END } //namespace boost { /// @endcond -#if !defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) +#if !defined(BOOST_NO_RVALUE_REFERENCES) -//#define BOOST_MOVE_ASSIGN_FROM_NON_CONST_RVALUE +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) + +#define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + +#else + +#if defined(_MSC_VER) && (_MSC_VER == 1600) +#define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG +#endif + +#endif + +#endif + + +#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + +#include +#include +#include + +#ifdef __GNUC__ +# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__)) +#else +# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS +#endif namespace boost { -namespace interprocess { +INTERPROCESS_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////// // @@ -81,7 +140,7 @@ class rv : public T ~rv(); rv(rv const&); void operator=(rv const&); -}; +} BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; ////////////////////////////////////////////////////////////////////////////// // @@ -111,20 +170,22 @@ struct is_rv< rv > // ////////////////////////////////////////////////////////////////////////////// template -class is_movable +struct is_movable : public ::boost::mpl::bool_&>::value> { }; template -class is_movable< rv > +struct is_movable< rv > : public ::boost::mpl::bool_ { }; template -struct has_nothrow_move : is_movable -{}; +struct has_nothrow_move + : public ::boost::mpl::bool_ +{ +}; ////////////////////////////////////////////////////////////////////////////// // @@ -149,6 +210,42 @@ typename enable_if, rv&>::type move(rv& x) return x; } + +#define BOOST_RV_REF(TYPE)\ + ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + +#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + +#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + + +#define BOOST_FWD_REF(TYPE)\ + const TYPE & \ +// + +#define BOOST_CATCH_CONST_RLVALUE(TYPE)\ + const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + +#ifdef BOOST_MOVE_OPTIMIZED_EMULATION + +#define BOOST_COPY_ASSIGN_REF(TYPE)\ + const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + +#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + +#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \ +// + ////////////////////////////////////////////////////////////////////////////// // // forward() @@ -156,83 +253,108 @@ typename enable_if, rv&>::type move(rv& x) ////////////////////////////////////////////////////////////////////////////// template -typename enable_if< ::boost::interprocess::move_detail::is_rv, T &>::type +typename enable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv, T &>::type forward(const typename move_detail::identity::type &x) { return const_cast(x); } template -typename disable_if< ::boost::interprocess::move_detail::is_rv, const T &>::type +typename disable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv, const T &>::type forward(const typename move_detail::identity::type &x) { return x; } -#define BOOST_INTERPROCESS_RV_REF(TYPE)\ - ::boost::interprocess::rv< TYPE >& \ -// +#else //BOOST_MOVE_OPTIMIZED_EMULATION -#define BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ - ::boost::interprocess::rv< TYPE >& \ -// - -#define BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ - ::boost::interprocess::rv< TYPE >& \ -// - -#ifdef BOOST_MOVE_ASSIGN_FROM_NON_CONST_RVALUE - -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE)\ - const ::boost::interprocess::rv< TYPE >& \ -// - -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ - const ::boost::interprocess::rv< TYPE >& \ -// - -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ - const ::boost::interprocess::rv< TYPE >& \ -// - -#else //BOOST_MOVE_ASSIGN_FROM_NON_CONST_RVALUE - -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE)\ +#define BOOST_COPY_ASSIGN_REF(TYPE)\ const TYPE & \ // -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ +#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ const TYPE< ARG1, ARG2 >& \ // -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ +#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ const TYPE< ARG1, ARG2, ARG3 > & \ // +////////////////////////////////////////////////////////////////////////////// +// +// forward() +// +////////////////////////////////////////////////////////////////////////////// + +//Catches const lvalues for movable types +template +const T& + forward( BOOST_CATCH_CONST_RLVALUE(T) x + , typename ::boost::enable_if_c< ::BOOST_MOVE_NAMESPACE::is_movable::value >::type* = 0) +{ + return static_cast(x); +} + +//Catches const lvalues for non-movable types +template +const T& + forward( const T &x + , typename ::boost::enable_if_c< !::BOOST_MOVE_NAMESPACE::is_movable::value && + !::boost::move_detail::is_rv::value + >::type* = 0) +{ + return static_cast(x); +} + +//Catches forwarded ::boost::rv via BOOST_FWD_REFs +template +T & + forward( const T &t + , typename ::boost::enable_if_c< ::boost::move_detail::is_rv::value >::type* = 0) +{ + return const_cast(t); +} + +//Catches forwarded ::boost::rv +template +const T & + forward( const U &u + , typename ::boost::enable_if_c< ::boost::is_same< ::boost::rv, U >::value >::type * = 0) +{ + return static_cast(u); +} + +//Catches non-const lvalues +template +T& + forward( typename move_detail::identity::type &x + , typename ::boost::enable_if_c< !::boost::move_detail::is_rv::value >::type* = 0) +{ + return x; +} + +//Catches non-const rvalues +template +typename enable_if, ::boost::rv & >::type + forward(BOOST_RV_REF(T) x) +{ return x; } + #endif -#define BOOST_INTERPROCESS_FWD_REF(TYPE)\ - const TYPE & \ -// - -#define BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(TYPE)\ - const ::boost::interprocess::rv< TYPE >& \ -// - ////////////////////////////////////////////////////////////////////////////// // -// BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE +// BOOST_MOVABLE_BUT_NOT_COPYABLE // ////////////////////////////////////////////////////////////////////////////// -#define BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ +#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ private:\ TYPE(TYPE &);\ TYPE& operator=(TYPE &);\ public:\ - operator ::boost::interprocess::rv&() \ - { return *reinterpret_cast< ::boost::interprocess::rv* >(this); }\ - operator const ::boost::interprocess::rv&() const \ - { return *reinterpret_cast* >(this); }\ + operator ::BOOST_MOVE_NAMESPACE::rv&() \ + { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv* >(this); }\ + operator const ::BOOST_MOVE_NAMESPACE::rv&() const \ + { return *static_cast* >(this); }\ private:\ // @@ -242,48 +364,58 @@ typename disable_if< ::boost::interprocess::move_detail::is_rv, const T &>::t // ////////////////////////////////////////////////////////////////////////////// -#ifdef BOOST_MOVE_ASSIGN_FROM_NON_CONST_RVALUE +#ifdef BOOST_MOVE_OPTIMIZED_EMULATION #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ public:\ TYPE& operator=(TYPE &t)\ - { this->operator=(static_cast &>(const_cast(t))); return *this;}\ + { this->operator=(static_cast &>(const_cast(t))); return *this;}\ public:\ - operator ::boost::interprocess::rv&() \ - { return *reinterpret_cast< ::boost::interprocess::rv* >(this); }\ - operator const ::boost::interprocess::rv&() const \ - { return *reinterpret_cast* >(this); }\ + operator ::BOOST_MOVE_NAMESPACE::rv&() \ + { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv* >(this); }\ + operator const ::BOOST_MOVE_NAMESPACE::rv&() const \ + { return *static_cast* >(this); }\ private:\ // -#else //#ifdef BOOST_MOVE_ASSIGN_FROM_NON_CONST_RVALUE +#else //#ifdef BOOST_MOVE_OPTIMIZED_EMULATION #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ public:\ - operator ::boost::interprocess::rv&() \ - { return *reinterpret_cast< ::boost::interprocess::rv* >(this); }\ - operator const ::boost::interprocess::rv&() const \ - { return *reinterpret_cast* >(this); }\ + operator ::BOOST_MOVE_NAMESPACE::rv&() \ + { return *static_cast< ::BOOST_MOVE_NAMESPACE::rv* >(this); }\ + operator const ::BOOST_MOVE_NAMESPACE::rv&() const \ + { return *static_cast* >(this); }\ private:\ // #endif -} //namespace interprocess { +INTERPROCESS_NAMESPACE_END } //namespace boost -#else //BOOST_HAS_RVALUE_REFS +#else //BOOST_NO_RVALUE_REFERENCES #include namespace boost { -namespace interprocess { +INTERPROCESS_NAMESPACE_BEGIN /// @cond namespace move_detail { +template +struct is_lvalue_reference + : public ::boost::mpl::bool_ +{}; + +template +struct is_lvalue_reference + : public ::boost::mpl::bool_ +{}; + typedef char one; struct two {one _[2];}; @@ -308,19 +440,18 @@ struct internal_member_value_traits //! For compilers with rvalue references, this traits class returns true //! if BOOST_ENABLE_MOVE_EMULATION is activated. //! -//! For other compilers returns true if T is convertible to ::boost::interprocess::rv& +//! For other compilers returns true if T is convertible to ::boost::rv& template -class is_movable +struct is_movable : public ::boost::mpl::bool_::value> { }; -//! For compilers with rvalue references, this traits class returns true -//! if T && is convertible to T. -//! -//! For other compilers returns true if T has implemented move emulation. +//! By default this traits returns false. Classes with non-thworing move construction +//! and assignment should specialize this trait to obtain some performance improvements. template -struct has_nothrow_move : is_movable +struct has_nothrow_move + : public ::boost::mpl::bool_ {}; ////////////////////////////////////////////////////////////////////////////// @@ -332,15 +463,30 @@ struct has_nothrow_move : is_movable #if defined(BOOST_MOVE_DOXYGEN_INVOKED) //! This function provides a way to convert a reference into a rvalue reference -//! in compilers with rvalue reference. For other compilers converts T & into -//! ::boost::interprocess::rv & so that move emulation is activated. +//! in compilers with rvalue references. For other compilers converts T & into +//! ::boost::rv & so that move emulation is activated. template inline rvalue_reference move (input_reference); -#else -template inline -typename remove_reference::type&& move(T&& t) + +#else //BOOST_MOVE_DOXYGEN_INVOKED + +#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + +//Old move approach, lvalues could bind to rvalue references +template inline +typename remove_reference::type && move(T&& t) { return t; } -#endif + +#else //Old move + +template inline +typename remove_reference::type && move(T&& t) +{ return static_cast::type &&>(t); } + +#endif //Old move + +#endif //BOOST_MOVE_DOXYGEN_INVOKED + ////////////////////////////////////////////////////////////////////////////// // @@ -357,16 +503,38 @@ typename remove_reference::type&& move(T&& t) //! For compilers with rvalue references this function provides perfect forwarding. //! //! Otherwise: -//! * If input_reference binds to const ::boost::interprocess::rv & then it output_reference is +//! * If input_reference binds to const ::boost::rv & then it output_reference is //! ::boost::rev & //! //! * Else, input_reference is equal to output_reference is equal to input_reference. template inline output_reference forward(input_reference); + #else + +#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + +//Old move approach, lvalues could bind to rvalue references + template inline T&& forward (typename move_detail::identity::type&& t) { return t; } -#endif + +#else //Old move + +//Implementation #5 from N2951, thanks to Howard Hinnant + +template +inline T&& forward(U&& t + , typename enable_if_c< + move_detail::is_lvalue_reference::value ? move_detail::is_lvalue_reference::value : true>::type * = 0/* + , typename enable_if_c< + move_detail::is_convertible + ::type*, typename remove_reference::type*>::value>::type * = 0*/) +{ return static_cast(t); } + +#endif //Old move + +#endif //BOOST_MOVE_DOXYGEN_INVOKED ////////////////////////////////////////////////////////////////////////////// // @@ -386,7 +554,7 @@ T&& forward (typename move_detail::identity::type&& t) //! This macro marks a type as movable but not copyable, disabling copy construction //! and assignment. The user will need to write a move constructor/assignment as explained //! in the documentation to fully write a movable but not copyable class. -#define BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ +#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ public:\ typedef int boost_move_emulation_t;\ private:\ @@ -403,11 +571,11 @@ T&& forward (typename move_detail::identity::type&& t) /// @cond -#define BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ +#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ TYPE && \ // -#define BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ +#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ TYPE && \ // @@ -415,14 +583,14 @@ T&& forward (typename move_detail::identity::type&& t) //!This macro is used to achieve portable syntax in move //!constructors and assignments for classes marked as -//!BOOST_COPYABLE_AND_MOVABLE or BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE -#define BOOST_INTERPROCESS_RV_REF(TYPE)\ +//!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE +#define BOOST_RV_REF(TYPE)\ TYPE && \ // //!This macro is used to achieve portable syntax in copy //!assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE. -#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE)\ +#define BOOST_COPY_ASSIGN_REF(TYPE)\ const TYPE & \ // @@ -440,21 +608,25 @@ T&& forward (typename move_detail::identity::type&& t) //! This macro is used to implement portable perfect forwarding //! as explained in the documentation. -#define BOOST_INTERPROCESS_FWD_REF(TYPE)\ +#define BOOST_FWD_REF(TYPE)\ TYPE && \ // -#define BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(TYPE)\ +/// @cond + +#define BOOST_CATCH_CONST_RLVALUE(TYPE)\ const TYPE & \ // -} //namespace interprocess { +/// @endcond + +INTERPROCESS_NAMESPACE_END } //namespace boost { -#endif //BOOST_HAS_RVALUE_REFS +#endif //BOOST_NO_RVALUE_REFERENCES namespace boost { -namespace interprocess { +INTERPROCESS_NAMESPACE_BEGIN ////////////////////////////////////////////////////////////////////////////// // @@ -473,12 +645,12 @@ class move_iterator public: typedef It iterator_type; typedef typename std::iterator_traits::value_type value_type; - #if defined(BOOST_HAS_RVALUE_REFS) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + #if !defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED) typedef value_type && reference; #else typedef typename ::boost::mpl::if_ - < ::boost::interprocess::is_movable - , ::boost::interprocess::rv& + < ::BOOST_MOVE_NAMESPACE::is_movable + , ::BOOST_MOVE_NAMESPACE::rv& , value_type & >::type reference; #endif typedef It pointer; @@ -502,10 +674,10 @@ class move_iterator reference operator*() const { - #if defined(BOOST_HAS_RVALUE_REFS) + #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return *m_it; #else - return ::boost::interprocess::move(*m_it); + return ::BOOST_MOVE_NAMESPACE::move(*m_it); #endif } @@ -538,10 +710,10 @@ class move_iterator reference operator[](difference_type n) const { - #if defined(BOOST_HAS_RVALUE_REFS) + #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return m_it[n]; #else - return ::boost::interprocess::move(m_it[n]); + return ::BOOST_MOVE_NAMESPACE::move(m_it[n]); #endif } @@ -584,7 +756,7 @@ struct is_move_iterator }; template -struct is_move_iterator< ::boost::interprocess::move_iterator > +struct is_move_iterator< ::BOOST_MOVE_NAMESPACE::move_iterator > : public ::boost::mpl::bool_ { }; @@ -624,7 +796,7 @@ class back_move_insert_iterator explicit back_move_insert_iterator(C& x) : container_m(&x) { } back_move_insert_iterator& operator=(typename C::reference x) - { container_m->push_back(boost::interprocess::move(x)); return *this; } + { container_m->push_back(BOOST_MOVE_NAMESPACE::move(x)); return *this; } back_move_insert_iterator& operator*() { return *this; } back_move_insert_iterator& operator++() { return *this; } @@ -659,7 +831,7 @@ public: explicit front_move_insert_iterator(C& x) : container_m(&x) { } front_move_insert_iterator& operator=(typename C::reference x) - { container_m->push_front(boost::interprocess::move(x)); return *this; } + { container_m->push_front(BOOST_MOVE_NAMESPACE::move(x)); return *this; } front_move_insert_iterator& operator*() { return *this; } front_move_insert_iterator& operator++() { return *this; } @@ -695,7 +867,7 @@ class move_insert_iterator move_insert_iterator& operator=(typename C::reference x) { - pos_ = container_m->insert(pos_, ::boost::interprocess::move(x)); + pos_ = container_m->insert(pos_, ::BOOST_MOVE_NAMESPACE::move(x)); ++pos_; return *this; } @@ -722,7 +894,7 @@ inline move_insert_iterator move_inserter(C& x, typename C::iterator it) //! Effects: Moves elements in the range [first,last) into the range [result,result + (last - //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), -//! performs *(result + n) = ::boost::interprocess::move (*(first + n)). +//! performs *(result + n) = ::boost::move (*(first + n)). //! //! Effects: result + (last - first). //! @@ -734,7 +906,7 @@ template Effects: Moves elements in the range [first,last) into the range //! [result - (last-first),result) starting from last - 1 and proceeding to //! first. For each positive integer n <= (last - first), -//! performs *(result - n) = ::boost::interprocess::move(*(last - n)). +//! performs *(result - n) = ::boost::move(*(last - n)). //! //! Requires: result shall not be in the range [first,last). //! @@ -762,7 +934,7 @@ O move_backward(I f, I l, O result) { while (f != l) { --l; --result; - *result = ::boost::interprocess::move(*l); + *result = ::BOOST_MOVE_NAMESPACE::move(*l); } return result; } @@ -777,7 +949,7 @@ O move_backward(I f, I l, O result) //! \code //! for (; first != last; ++result, ++first) //! new (static_cast(&*result)) -//! typename iterator_traits::value_type(boost::interprocess::move(*first)); +//! typename iterator_traits::value_type(boost::move(*first)); //! \endcode //! //! Returns: result @@ -792,7 +964,7 @@ F uninitialized_move(I f, I l, F r { typedef typename std::iterator_traits::value_type input_value_type; while (f != l) { - ::new(static_cast(&*r)) input_value_type(boost::interprocess::move(*f)); + ::new(static_cast(&*r)) input_value_type(BOOST_MOVE_NAMESPACE::move(*f)); ++f; ++r; } return r; @@ -823,7 +995,7 @@ typename F> // F models ForwardIterator F uninitialized_move_move_iterator(I f, I l, F r, typename enable_if< is_movable >::type* = 0) { - return ::boost::interprocess::uninitialized_move(f, l, r); + return ::BOOST_MOVE_NAMESPACE::uninitialized_move(f, l, r); } template @@ -843,7 +1015,45 @@ typename F> // F models ForwardIterator F uninitialized_copy_or_move(I f, I l, F r, typename enable_if< move_detail::is_move_iterator >::type* = 0) { - return ::boost::interprocess::move_detail::uninitialized_move_move_iterator(f, l, r); + return ::BOOST_MOVE_NAMESPACE::move_detail::uninitialized_move_move_iterator(f, l, r); +} + +////////////////////////////////////////////////////////////////////////////// +// +// copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template + // F models ForwardIterator +F move_move_iterator(I f, I l, F r, + typename enable_if< is_movable >::type* = 0) +{ + return ::BOOST_MOVE_NAMESPACE::move(f, l, r); +} + +template + // F models ForwardIterator +F move_move_iterator(I f, I l, F r, + typename disable_if< is_movable >::type* = 0) +{ + return std::copy(f.base(), l.base(), r); +} + + +} //namespace move_detail { + +template + // F models ForwardIterator +F copy_or_move(I f, I l, F r, + typename enable_if< move_detail::is_move_iterator >::type* = 0) +{ + return ::BOOST_MOVE_NAMESPACE::move_detail::move_move_iterator(f, l, r); } /// @endcond @@ -872,19 +1082,28 @@ F uninitialized_copy_or_move(I f, I l, F r return std::uninitialized_copy(f, l, r); } -//! If this trait yields to true -//! (has_trivial_destructor_after_move_ctor <T>::value == true) -//! means that if T is used as argument of a move construction, -//! there is no need to call T's destructor. -//! This optimization tipically is used to improve containers' performance. +//! Effects: +//! \code +//! for (; first != last; ++result, ++first) +//! *result = *first; +//! \endcode //! -//! By default this trait is true if the type has trivial destructor, -//! every class should specialize this trait if it wants to improve performance -//! when inserted in containers. -template -struct has_trivial_destructor_after_move_ctor - : public ::boost::has_trivial_destructor -{}; +//! Returns: result +//! +//! Note: This function is provided because +//! std::uninitialized_copy from some STL implementations +//! is not compatible with move_iterator +template + // F models ForwardIterator +F copy_or_move(I f, I l, F r + /// @cond + ,typename disable_if< move_detail::is_move_iterator >::type* = 0 + /// @endcond + ) +{ + return std::copy(f, l, r); +} //! If this trait yields to true //! (has_trivial_destructor_after_move <T>::value == true) @@ -900,26 +1119,39 @@ struct has_trivial_destructor_after_move : public ::boost::has_trivial_destructor {}; -//! If this trait yields to true -//! (has_trivial_destructor_after_move_to_moved <T>::value == true) -//! means that if t1 of type T is being moved to an already moved value t2, -//! there is no need to call t1's destructor: -//!
-//! T t1, t2, t3(::boost::interprocess::move(t2));
-//! t2 = ::boost::interprocess::move(t1);
-//! //There is no need to call t1's destructor
-//! 
-//! This optimization is used to improve containers' performance. -//! -//! By default this trait is true if the type has trivial destructor, -//! every class should specialize this trait if it wants to improve performance -//! when inserted in containers. -template -struct has_trivial_destructor_after_move_to_moved - : public has_trivial_destructor_after_move -{}; +#ifndef BOOST_MOVE_DOXYGEN_INVOKED -} //namespace interprocess { +#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE + +#define BOOST_INTERPROCESS_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE) +#define BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE) +#define BOOST_INTERPROCESS_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE) +#define BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) +#define BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) +#define BOOST_INTERPROCESS_RV_REF(TYPE) BOOST_RV_REF(TYPE) +#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE) +#define BOOST_INTERPROCESS_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) +#define BOOST_INTERPROCESS_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) +#define BOOST_INTERPROCESS_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) +#define BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE) + +#endif + +#define BOOST_MOVE_MACRO_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE) +#define BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE) +#define BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE) +#define BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) +#define BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) +#define BOOST_MOVE_MACRO_RV_REF(TYPE) BOOST_RV_REF(TYPE) +#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE) +#define BOOST_MOVE_MACRO_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) +#define BOOST_MOVE_MACRO_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) +#define BOOST_MOVE_MACRO_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) +#define BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE) + +#endif //BOOST_MOVE_DOXYGEN_INVOKED + +INTERPROCESS_NAMESPACE_END } //namespace boost { -#endif //#ifndef BOOST_MOVE_HPP +#endif //#ifndef BOOST_MOVE_HPP diff --git a/3party/boost/boost/interprocess/detail/named_proxy.hpp b/3party/boost/boost/interprocess/detail/named_proxy.hpp index b8338f32bf..67534923d9 100644 --- a/3party/boost/boost/interprocess/detail/named_proxy.hpp +++ b/3party/boost/boost/interprocess/detail/named_proxy.hpp @@ -92,7 +92,7 @@ struct CtorNArg : public placement_destroy void do_increment(detail::false_, const index_tuple&) {} - tuple args_; + tuple args_; }; //!Describes a proxy class that implements named @@ -120,7 +120,8 @@ class named_proxy template T *operator()(Args &&...args) const { - CtorNArg &&ctor_obj = CtorNArg(boost::interprocess::forward(args)...); + CtorNArg &&ctor_obj = CtorNArg + (boost::interprocess::forward(args)...); return mp_mngr->template generic_construct(mp_name, m_num, m_find, m_dothrow, ctor_obj); } diff --git a/3party/boost/boost/interprocess/detail/os_file_functions.hpp b/3party/boost/boost/interprocess/detail/os_file_functions.hpp index a055d45683..3c1b99bc69 100644 --- a/3party/boost/boost/interprocess/detail/os_file_functions.hpp +++ b/3party/boost/boost/interprocess/detail/os_file_functions.hpp @@ -13,6 +13,9 @@ #include #include +#include +#include + #include #if (defined BOOST_INTERPROCESS_WINDOWS) @@ -52,6 +55,7 @@ typedef struct mapping_handle_impl_t{ typedef enum { read_only = winapi::generic_read , read_write = winapi::generic_read | winapi::generic_write , copy_on_write + , read_private , invalid_mode = 0xffff } mode_t; @@ -82,34 +86,36 @@ inline file_handle_t file_handle_from_mapping_handle(mapping_handle_t hnd) { return hnd.handle; } inline bool create_directory(const char *path) -{ return winapi::create_directory(path, 0); } +{ return winapi::create_directory(path); } inline const char *get_temporary_path() { return std::getenv("TMP"); } inline file_handle_t create_new_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, const permissions & perm, bool temporary = false) { unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file - (name, (unsigned int)mode, winapi::create_new, attr); + ( name, (unsigned int)mode, winapi::create_new, attr + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t create_or_open_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, const permissions & perm, bool temporary = false) { unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file - (name, (unsigned int)mode, winapi::open_always, attr); + ( name, (unsigned int)mode, winapi::open_always, attr + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } inline file_handle_t open_existing_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, bool temporary = false) { unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; return winapi::create_file - (name, (unsigned int)mode, winapi::open_existing, attr); + (name, (unsigned int)mode, winapi::open_existing, attr, 0); } inline bool delete_file(const char *name) @@ -121,7 +127,7 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size) if(!winapi::get_file_size(hnd, filesize)) return false; - if(size > filesize){ + if(size > (unsigned long long)filesize){ if(!winapi::set_file_pointer_ex(hnd, filesize, 0, winapi::file_begin)){ return false; } @@ -262,8 +268,7 @@ inline bool delete_subdirectories_recursive //if(::SetFileAttributes(strFilePath.c_str(), winapi::file_attribute_normal) == 0) //return winapi::get_last_error(); // Delete file - if(winapi::delete_file(strFilePath.c_str()) == 0) - return false; + winapi::delete_file(strFilePath.c_str()); } } //Go to the next file @@ -299,6 +304,44 @@ inline bool delete_subdirectories(const std::string &refcstrRootDirectory, const return delete_subdirectories_recursive(refcstrRootDirectory, dont_delete_this, 0u); } + +template +inline bool for_each_file_in_dir(const char *dir, Function f) +{ + void * hFile; // Handle to directory + winapi::win32_find_data_t FileInformation; // File information + + //Get base directory + std::string str(dir); + const std::size_t base_root_dir_len = str.size(); + + //Find all files and directories + str += "\\*.*"; + hFile = winapi::find_first_file(str.c_str(), &FileInformation); + if(hFile != winapi::invalid_handle_value){ + do{ //Now loop every file + str.erase(base_root_dir_len); + //If it's not "." or ".." skip it + if(FileInformation.cFileName[0] != '.'){ + str += "\\"; str += FileInformation.cFileName; + //If it's a file, apply erase logic + if(!(FileInformation.dwFileAttributes & winapi::file_attribute_directory)){ + f(str.c_str(), FileInformation.cFileName); + } + } + //Go to the next file + } while(winapi::find_next_file(hFile, &FileInformation) == 1); + + // Close handle and see if the loop has ended with an error + winapi::find_close(hFile); + if(winapi::get_last_error() != winapi::error_no_more_files){ + return false; + } + } + return true; +} + + #else //#if (defined BOOST_INTERPROCESS_WINDOWS) typedef int file_handle_t; @@ -313,6 +356,7 @@ typedef struct mapping_handle_impl_t typedef enum { read_only = O_RDONLY , read_write = O_RDWR , copy_on_write + , read_private , invalid_mode = 0xffff } mode_t; @@ -335,7 +379,7 @@ inline file_handle_t file_handle_from_mapping_handle(mapping_handle_t hnd) { return hnd.handle; } inline bool create_directory(const char *path) -{ return ::mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0; } +{ return ::mkdir(path, 0777) == 0 && ::chmod(path, 0777) == 0; } inline const char *get_temporary_path() { @@ -351,24 +395,32 @@ inline const char *get_temporary_path() } inline file_handle_t create_new_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, const permissions & perm, bool temporary = false) { (void)temporary; - return ::open(name, ((int)mode) | O_EXCL | O_CREAT, S_IRWXG | S_IRWXO | S_IRWXU); + int ret = ::open(name, ((int)mode) | O_EXCL | O_CREAT, perm.get_permissions()); + if(ret >= 0){ + ::fchmod(ret, perm.get_permissions()); + } + return ret; } inline file_handle_t create_or_open_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, const permissions & perm, bool temporary = false) { (void)temporary; - return ::open(name, ((int)mode) | O_CREAT, S_IRWXG | S_IRWXO | S_IRWXU); + int ret = ::open(name, ((int)mode) | O_CREAT, perm.get_permissions()); + if(ret >= 0){ + ::fchmod(ret, perm.get_permissions()); + } + return ret; } inline file_handle_t open_existing_file - (const char *name, mode_t mode = read_write, bool temporary = false) + (const char *name, mode_t mode, bool temporary = false) { (void)temporary; - return ::open(name, (int)mode, S_IRWXG | S_IRWXO | S_IRWXU); + return ::open(name, (int)mode, 0666); } inline bool delete_file(const char *name) @@ -388,7 +440,7 @@ inline bool get_file_size(file_handle_t hnd, offset_t &size) } inline bool set_file_pointer(file_handle_t hnd, offset_t off, file_pos_t pos) -{ return off == ::lseek(hnd, off, (int)pos); } +{ return ((off_t)(-1)) != ::lseek(hnd, off, (int)pos); } inline bool get_file_pointer(file_handle_t hnd, offset_t &off) { @@ -543,6 +595,48 @@ inline bool delete_subdirectories_recursive return std::remove(refcstrRootDirectory.c_str()) ? false : true; } +template +inline bool for_each_file_in_dir(const char *dir, Function f) +{ + std::string refcstrRootDirectory(dir); + + DIR *d = opendir(refcstrRootDirectory.c_str()); + if(!d) { + return false; + } + + struct dir_close + { + DIR *d_; + dir_close(DIR *d) : d_(d) {} + ~dir_close() { ::closedir(d_); } + } dc(d); (void)dc; + + struct ::dirent *de; + struct ::stat st; + std::string fn; + + while((de=::readdir(d))) { + if( de->d_name[0] == '.' && ( de->d_name[1] == '\0' + || (de->d_name[1] == '.' && de->d_name[2] == '\0' )) ){ + continue; + } + fn = refcstrRootDirectory; + fn += '/'; + fn += de->d_name; + + if(::stat(fn.c_str(), & st)) { + return false; + } + //If it's a file, apply erase logic + if(!S_ISDIR(st.st_mode)) { + f(fn.c_str(), de->d_name); + } + } + return true; +} + + //This function erases all the subdirectories of a directory except the one pointed by "dont_delete_this" inline bool delete_subdirectories(const std::string &refcstrRootDirectory, const char *dont_delete_this) { @@ -551,6 +645,19 @@ inline bool delete_subdirectories(const std::string &refcstrRootDirectory, const #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) +inline bool open_or_create_directory(const char *dir_name) +{ + //If fails, check that it's because it already exists + if(!create_directory(dir_name)){ + error_info info(system_error_code()); + if(info.get_error_code() != already_exists_error){ + return false; + } + } + return true; +} + + } //namespace detail{ } //namespace interprocess { } //namespace boost { diff --git a/3party/boost/boost/interprocess/detail/os_thread_functions.hpp b/3party/boost/boost/interprocess/detail/os_thread_functions.hpp index 63dde58908..5d8ebb0487 100644 --- a/3party/boost/boost/interprocess/detail/os_thread_functions.hpp +++ b/3party/boost/boost/interprocess/detail/os_thread_functions.hpp @@ -13,6 +13,8 @@ #include #include +#include +#include #if (defined BOOST_INTERPROCESS_WINDOWS) # include @@ -78,6 +80,20 @@ inline OS_systemwide_thread_id_t get_invalid_systemwide_thread_id() return get_invalid_thread_id(); } +inline long double get_current_process_creation_time() +{ + winapi::interprocess_filetime CreationTime, ExitTime, KernelTime, UserTime; + + get_process_times + ( winapi::get_current_process(), &CreationTime, &ExitTime, &KernelTime, &UserTime); + + typedef long double ldouble_t; + const ldouble_t resolution = (100.0l/1000000000.0l); + return CreationTime.dwHighDateTime*(ldouble_t(1u<<31u)*2.0l*resolution) + + CreationTime.dwLowDateTime*resolution; +} + + #else //#if (defined BOOST_INTERPROCESS_WINDOWS) typedef pthread_t OS_thread_id_t; @@ -160,8 +176,22 @@ inline OS_systemwide_thread_id_t get_invalid_systemwide_thread_id() return OS_systemwide_thread_id_t(get_invalid_process_id(), get_invalid_thread_id()); } +inline long double get_current_process_creation_time() +{ return 0.0L; } + #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) +typedef char pid_str_t[sizeof(OS_process_id_t)*3+1]; + +inline void get_pid_str(pid_str_t &pid_str, OS_process_id_t pid) +{ + bufferstream bstream(pid_str, sizeof(pid_str)); + bstream << pid << std::ends; +} + +inline void get_pid_str(pid_str_t &pid_str) +{ get_pid_str(pid_str, get_current_process_id()); } + } //namespace detail{ } //namespace interprocess { } //namespace boost { diff --git a/3party/boost/boost/interprocess/detail/posix_time_types_wrk.hpp b/3party/boost/boost/interprocess/detail/posix_time_types_wrk.hpp index 6aa0e1097f..ed46e4fa75 100644 --- a/3party/boost/boost/interprocess/detail/posix_time_types_wrk.hpp +++ b/3party/boost/boost/interprocess/detail/posix_time_types_wrk.hpp @@ -20,9 +20,8 @@ #endif //#ifndef WIN32_LEAN_AND_MEAN #endif //#ifdef _WIN32 -//#include -//#include #include +#include namespace boost { namespace interprocess { diff --git a/3party/boost/boost/interprocess/detail/preprocessor.hpp b/3party/boost/boost/interprocess/detail/preprocessor.hpp index 244d10ba10..22f9f77545 100644 --- a/3party/boost/boost/interprocess/detail/preprocessor.hpp +++ b/3party/boost/boost/interprocess/detail/preprocessor.hpp @@ -15,8 +15,7 @@ # pragma once #endif -#include -#include +#include "config_begin.hpp" #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING #error "This file is not needed when perfect forwarding is available" @@ -36,7 +35,7 @@ //This cast is ugly but it is necessary until "perfect forwarding" //is achieved in C++0x. Meanwhile, if we want to be able to //bind rvalues with non-const references, we have to be ugly -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ //! @@ -46,7 +45,7 @@ //! #endif -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES #define BOOST_INTERPROCESS_PARAM(U, u) \ U && u \ //! @@ -56,10 +55,22 @@ //! #endif -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + +#define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (BOOST_INTERPROCESS_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ +//! + +#else + #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \ BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \ //! + +#endif + #else #define BOOST_INTERPROCESS_AUX_PARAM_INIT(z, n, data) \ BOOST_PP_CAT(m_p, n) (const_cast(BOOST_PP_CAT(p, n))) \ @@ -70,10 +81,23 @@ BOOST_PP_CAT(++m_p, n) \ //! -#ifdef BOOST_HAS_RVALUE_REFS +#ifndef BOOST_NO_RVALUE_REFERENCES + +#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ +//! + +#else + #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ //! + +#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #else #define BOOST_INTERPROCESS_AUX_PARAM_DEFINE(z, n, data) \ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ @@ -81,13 +105,25 @@ #endif #define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \ -boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ +::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ //! +#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#include + #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ -boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ +::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \ //! +#else + +#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \ +::boost::interprocess::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \ +//! + +#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \ BOOST_PP_CAT(*m_p, n) \ //! diff --git a/3party/boost/boost/interprocess/detail/robust_emulation.hpp b/3party/boost/boost/interprocess/detail/robust_emulation.hpp new file mode 100644 index 0000000000..999a6cd872 --- /dev/null +++ b/3party/boost/boost/interprocess/detail/robust_emulation.hpp @@ -0,0 +1,439 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2010-2010. 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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_ROBUST_EMULATION_HPP +#define BOOST_INTERPROCESS_ROBUST_EMULATION_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost{ +namespace interprocess{ +namespace detail{ + +namespace robust_emulation_helpers { + +template +class mutex_traits +{ + public: + static void take_ownership(T &t) + { t.take_ownership(); } +}; + +inline void remove_if_can_lock_file(const char *file_path) +{ + file_handle_t fhnd = open_existing_file(file_path, read_write); + + if(fhnd != invalid_file()){ + bool acquired; + if(try_acquire_file_lock(fhnd, acquired) && acquired){ + delete_file(file_path); + } + close_file(fhnd); + } +} + +inline const char *robust_lock_subdir_path() +{ return "robust"; } + +inline const char *robust_lock_prefix() +{ return "lck"; } + +inline void robust_lock_path(std::string &s) +{ + tmp_folder(s); + s += "/"; + s += robust_lock_subdir_path(); +} + +inline void create_and_get_robust_lock_file_path(std::string &s, OS_process_id_t pid) +{ + file_locking_helpers::create_tmp_subdir_and_get_pid_based_filepath + (robust_lock_subdir_path(), robust_lock_prefix(), pid, s); +} + +//This class will be a intermodule_singleton. The constructor will create +//a lock file, the destructor will erase it. +// +//We should take in care that another process might be erasing unlocked +//files while creating this one, so there are some race conditions we must +//take in care to guarantee some robustness. +class robust_mutex_lock_file +{ + file_handle_t fd; + std::string fname; + public: + robust_mutex_lock_file() + { + permissions p; + p.set_unrestricted(); + //Remove old lock files of other processes + remove_old_robust_lock_files(); + //Create path and obtain lock file path for this process + create_and_get_robust_lock_file_path(fname, get_current_process_id()); + + //Now try to open or create the lock file + fd = create_or_open_file(fname.c_str(), read_write, p); + //If we can't open or create it, then something unrecoverable has happened + if(fd == invalid_file()){ + throw interprocess_exception(other_error, "Robust emulation robust_mutex_lock_file constructor failed: could not open or create file"); + } + + //Now we must take in care a race condition with another process + //calling "remove_old_robust_lock_files()". No other threads from this + //process will be creating the lock file because intermodule_singleton + //guarantees this. So let's loop acquiring the lock and checking if we + //can't exclusively create the file (if the file is erased by another process + //then this exclusive open would fail). If the file can't be exclusively created + //then we have correctly open/create and lock the file. If the file can + //be exclusively created, then close previous locked file and try again. + while(1){ + bool acquired; + if(!try_acquire_file_lock(fd, acquired) || !acquired ){ + throw interprocess_exception(other_error, "Robust emulation robust_mutex_lock_file constructor failed: try_acquire_file_lock"); + } + //Creating exclusively must fail with already_exists_error + //to make sure we've locked the file and no one has + //deleted it between creation and locking + file_handle_t fd2 = create_new_file(fname.c_str(), read_write, p); + if(fd2 != invalid_file()){ + close_file(fd); + fd = fd2; + continue; + } + //If exclusive creation fails with expected error go ahead + else if(error_info(system_error_code()).get_error_code() == already_exists_error){ //must already exist + //Leak descriptor to mantain the file locked until the process dies + break; + } + //If exclusive creation fails with unexpected error throw an unrecoverable error + else{ + close_file(fd); + throw interprocess_exception(other_error, "Robust emulation robust_mutex_lock_file constructor failed: create_file filed with unexpected error"); + } + } + } + + ~robust_mutex_lock_file() + { + //The destructor is guaranteed by intermodule_singleton to be + //executed serialized between all threads from current process, + //so we just need to close and unlink the file. + close_file(fd); + //If some other process deletes the file before us after + //closing it there should not be any problem. + delete_file(fname.c_str()); + } + + private: + //This functor is execute for all files in the lock file directory + class other_process_lock_remover + { + public: + void operator()(const char *filepath, const char *filename) + { + std::string pid_str; + //If the lock file is not our own lock file, then try to do the cleanup + if(!file_locking_helpers::check_if_filename_complies_with_pid + (filename, robust_lock_prefix(), get_current_process_id(), pid_str)){ + remove_if_can_lock_file(filepath); + } + } + }; + + bool remove_old_robust_lock_files() + { + std::string refcstrRootDirectory; + robust_lock_path(refcstrRootDirectory); + return for_each_file_in_dir(refcstrRootDirectory.c_str(), other_process_lock_remover()); + } +}; + +} //namespace robust_emulation_helpers { + +//This is the mutex class. Mutex should follow mutex concept +//with an additonal "take_ownership()" function to take ownership of the +//mutex when robust_emulation_mutex determines the previous owner was dead. +template +class robust_emulation_mutex +{ + public: + static const boost::uint32_t correct_state = 0; + static const boost::uint32_t fixing_state = 1; + static const boost::uint32_t broken_state = 2; + + typedef robust_emulation_helpers::mutex_traits mutex_traits_t; + + robust_emulation_mutex(); + void lock(); + bool try_lock(); + bool timed_lock(const boost::posix_time::ptime &abs_time); + void unlock(); + void consistent(); + bool previous_owner_dead(); + + private: + static const unsigned int spin_threshold = 100u; + bool lock_own_unique_file(); + bool robust_check(); + bool check_if_owner_dead_and_take_ownership_atomically(); + bool is_owner_dead(boost::uint32_t owner); + void owner_to_filename(boost::uint32_t owner, std::string &s); + //The real mutex + Mutex mtx; + //The pid of the owner + volatile boost::uint32_t owner; + //The state of the mutex (correct, fixing, broken) + volatile boost::uint32_t state; +}; + +template +inline robust_emulation_mutex::robust_emulation_mutex() + : mtx(), owner(get_invalid_process_id()), state(correct_state) +{} + +template +inline void robust_emulation_mutex::lock() +{ + //If the mutex is broken (recovery didn't call consistent()), + //then throw an exception + if(atomic_read32(&this->state) == broken_state){ + throw interprocess_exception(lock_error, "Broken id"); + } + + //This function provokes intermodule_singleton instantiation + if(!this->lock_own_unique_file()){ + throw interprocess_exception(lock_error, "Broken id"); + } + + //Now the logic. Try to lock, if successful mark the owner + //if it fails, start recovery logic + unsigned int spin_count = 0; + while(1){ + if (mtx.try_lock()){ + atomic_write32(&this->owner, get_current_process_id()); + break; + } + else{ + //Do the dead owner checking each spin_threshold lock tries + detail::thread_yield(); + ++spin_count; + if(spin_count > spin_threshold){ + //Check if owner dead and take ownership if possible + if(!this->robust_check()){ + spin_count = 0; + } + else{ + break; + } + } + } + } +} + +template +inline bool robust_emulation_mutex::try_lock() +{ + //Same as lock() but without spinning + if(atomic_read32(&this->state) == broken_state){ + throw interprocess_exception(lock_error, "Broken id"); + } + + if(!this->lock_own_unique_file()){ + throw interprocess_exception(lock_error, "Broken id"); + } + + if (mtx.try_lock()){ + atomic_write32(&this->owner, get_current_process_id()); + return true; + } + else{ + if(!this->robust_check()){ + return false; + } + else{ + return true; + } + } +} + +template +inline bool robust_emulation_mutex::timed_lock + (const boost::posix_time::ptime &abs_time) +{ + //Same as lock() but with an additional timeout + if(abs_time == boost::posix_time::pos_infin){ + this->lock(); + return true; + } + //Obtain current count and target time + boost::posix_time::ptime now = microsec_clock::universal_time(); + + if(now >= abs_time) + return this->try_lock(); + + do{ + if(this->try_lock()){ + break; + } + now = microsec_clock::universal_time(); + + if(now >= abs_time){ + return this->try_lock(); + } + // relinquish current time slice + detail::thread_yield(); + }while (true); + + return true; +} + +template +inline void robust_emulation_mutex::owner_to_filename(boost::uint32_t owner, std::string &s) +{ + robust_emulation_helpers::create_and_get_robust_lock_file_path(s, owner); +} + +template +inline bool robust_emulation_mutex::robust_check() +{ + //If the old owner was dead, and we've acquired ownership, mark + //the mutex as 'fixing'. This means that a "consistent()" is needed + //to avoid marking the mutex as "broken" when the mutex is unlocked. + if(!this->check_if_owner_dead_and_take_ownership_atomically()){ + return false; + } + atomic_write32(&this->state, fixing_state); + return true; +} + +template +inline bool robust_emulation_mutex::check_if_owner_dead_and_take_ownership_atomically() +{ + boost::uint32_t cur_owner = get_current_process_id(); + boost::uint32_t old_owner = atomic_read32(&this->owner), old_owner2; + //The cas loop guarantees that only one thread from this or another process + //will succeed taking ownership + do{ + //Check if owner is dead + if(!this->is_owner_dead(old_owner)){ + return false; + } + //If it's dead, try to mark this process as the owner in the owner field + old_owner2 = old_owner; + old_owner = atomic_cas32(&this->owner, cur_owner, old_owner); + }while(old_owner2 != old_owner); + //If success, we fix mutex internals to assure our ownership + mutex_traits_t::take_ownership(mtx); + return true; +} + +template +inline bool robust_emulation_mutex::is_owner_dead(boost::uint32_t owner) +{ + //If owner is an invalid id, then it's clear it's dead + if(owner == (boost::uint32_t)get_invalid_process_id()){ + return true; + } + + //Obtain the lock filename of the owner field + std::string file; + this->owner_to_filename(owner, file); + + //Now the logic is to open and lock it + file_handle_t fhnd = open_existing_file(file.c_str(), read_write); + + if(fhnd != invalid_file()){ + //If we can open the file, lock it. + bool acquired; + if(try_acquire_file_lock(fhnd, acquired) && acquired){ + //If locked, just delete the file + delete_file(file.c_str()); + close_file(fhnd); + return true; + } + //If not locked, the owner is suppossed to be still alive + close_file(fhnd); + } + else{ + //If the lock file does not exist then the owner is dead (a previous cleanup) + //function has deleted the file. If there is another reason, then this is + //an unrecoverable error + if(error_info(system_error_code()).get_error_code() == not_found_error){ + return true; + } + } + return false; +} + +template +inline void robust_emulation_mutex::consistent() +{ + //This function supposes the previous state was "fixing" + //and the current process holds the mutex + if(atomic_read32(&this->state) != fixing_state && + atomic_read32(&this->owner) != (boost::uint32_t)get_current_process_id()){ + throw interprocess_exception(lock_error, "Broken id"); + } + //If that's the case, just update mutex state + atomic_write32(&this->state, correct_state); +} + +template +inline bool robust_emulation_mutex::previous_owner_dead() +{ + //Notifies if a owner recovery has been performed in the last lock() + return atomic_read32(&this->state) == fixing_state; +}; + +template +inline void robust_emulation_mutex::unlock() +{ + //If in "fixing" state, unlock and mark the mutex as unrecoverable + //so next locks will fail and all threads will be notified that the + //data protected by the mutex was not recoverable. + if(atomic_read32(&this->state) == fixing_state){ + atomic_write32(&this->state, broken_state); + } + //Write an invalid owner to minimize pid reuse possibility + atomic_write32(&this->owner, get_invalid_process_id()); + mtx.unlock(); +} + +template +inline bool robust_emulation_mutex::lock_own_unique_file() +{ + //This function forces instantiation of the singleton + robust_emulation_helpers::robust_mutex_lock_file* dummy = + &detail::intermodule_singleton + ::get(); + return dummy != 0; +} + +} //namespace detail{ +} //namespace interprocess{ +} //namespace boost{ + +#include + +#endif diff --git a/3party/boost/boost/interprocess/detail/segment_manager_helper.hpp b/3party/boost/boost/interprocess/detail/segment_manager_helper.hpp index f66d49f0fb..f14c5defee 100644 --- a/3party/boost/boost/interprocess/detail/segment_manager_helper.hpp +++ b/3party/boost/boost/interprocess/detail/segment_manager_helper.hpp @@ -29,7 +29,7 @@ #include //char_traits #include //std::nothrow #include //std::pair -#include //assert +#include //BOOST_ASSERT #include //unary_function #ifndef BOOST_NO_EXCEPTIONS #include @@ -178,8 +178,8 @@ struct block_header get_rounded_size(sizeof(block_header), algn))); (void)sz; //Some sanity checks - assert(hdr->m_value_alignment == algn); - assert(hdr->m_value_bytes % sz == 0); + BOOST_ASSERT(hdr->m_value_alignment == algn); + BOOST_ASSERT(hdr->m_value_bytes % sz == 0); return hdr; } diff --git a/3party/boost/boost/interprocess/detail/tmp_dir_helpers.hpp b/3party/boost/boost/interprocess/detail/tmp_dir_helpers.hpp index 442e7d60c1..5a2bef2f77 100644 --- a/3party/boost/boost/interprocess/detail/tmp_dir_helpers.hpp +++ b/3party/boost/boost/interprocess/detail/tmp_dir_helpers.hpp @@ -37,10 +37,8 @@ namespace detail { #if defined (BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) inline void get_bootstamp(std::string &s, bool add = false) { - char bootstamp[winapi::BootstampLength*2+1]; - std::size_t bootstamp_length = winapi::BootstampLength*2; - winapi::get_boot_time_str(bootstamp, bootstamp_length); - bootstamp[winapi::BootstampLength*2] = 0; + std::string bootstamp; + winapi::get_last_bootup_time(bootstamp); if(add){ s += bootstamp; } @@ -102,26 +100,30 @@ inline void get_tmp_base_dir(std::string &tmp_name) tmp_name += "/boost_interprocess"; } +inline void tmp_folder(std::string &tmp_name) +{ + get_tmp_base_dir(tmp_name); + #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME + tmp_name += "/"; + get_bootstamp(tmp_name, true); + #endif +} inline void tmp_filename(const char *filename, std::string &tmp_name) { - get_tmp_base_dir(tmp_name); - //Remove final null. + tmp_folder(tmp_name); tmp_name += "/"; - #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - get_bootstamp(tmp_name, true); - tmp_name += '/'; - #endif tmp_name += filename; } -inline void create_tmp_dir_and_get_filename(const char *filename, std::string &tmp_name) +inline void create_tmp_and_clean_old(std::string &tmp_name) { //First get the temp directory - get_tmp_base_dir(tmp_name); + std::string root_tmp_name; + get_tmp_base_dir(root_tmp_name); //If fails, check that it's because already exists - if(!create_directory(tmp_name.c_str())){ + if(!create_directory(root_tmp_name.c_str())){ error_info info(system_error_code()); if(info.get_error_code() != already_exists_error){ throw interprocess_exception(info); @@ -129,13 +131,7 @@ inline void create_tmp_dir_and_get_filename(const char *filename, std::string &t } #ifdef BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME - //Create a new subdirectory with the bootstamp - std::string root_tmp_name = tmp_name; - tmp_name += '/'; - //Obtain bootstamp string - std::string bootstamp; - get_bootstamp(bootstamp); - tmp_name += bootstamp; + tmp_folder(tmp_name); //If fails, check that it's because already exists if(!create_directory(tmp_name.c_str())){ @@ -145,12 +141,18 @@ inline void create_tmp_dir_and_get_filename(const char *filename, std::string &t } } //Now erase all old directories created in the previous boot sessions - delete_subdirectories(root_tmp_name, bootstamp.c_str()); + std::string subdir = tmp_name; + subdir.erase(0, root_tmp_name.size()+1); + delete_subdirectories(root_tmp_name, subdir.c_str()); + #else + tmp_name = root_tmp_name; #endif +} - //Add filename - tmp_name += '/'; - tmp_name += filename; +inline void create_tmp_and_clean_old_and_get_filename(const char *filename, std::string &tmp_name) +{ + create_tmp_and_clean_old(tmp_name); + tmp_filename(filename, tmp_name); } inline void add_leading_slash(const char *name, std::string &new_name) diff --git a/3party/boost/boost/interprocess/detail/transform_iterator.hpp b/3party/boost/boost/interprocess/detail/transform_iterator.hpp index b6e11399df..5578742762 100644 --- a/3party/boost/boost/interprocess/detail/transform_iterator.hpp +++ b/3party/boost/boost/interprocess/detail/transform_iterator.hpp @@ -50,7 +50,7 @@ struct operator_arrow_proxy : m_value(px) {} - T* operator->() const { return &m_value; } + T* operator->() const { return const_cast(&m_value); } // This function is needed for MWCW and BCC, which won't call operator-> // again automatically per 13.3.1.2 para 8 // operator T*() const { return &m_value; } @@ -87,13 +87,25 @@ class transform_iterator return result; } + transform_iterator& operator--() + { decrement(); return *this; } + + transform_iterator operator--(int) + { + transform_iterator result (*this); + decrement(); + return result; + } + friend bool operator== (const transform_iterator& i, const transform_iterator& i2) { return i.equal(i2); } friend bool operator!= (const transform_iterator& i, const transform_iterator& i2) { return !(i == i2); } -/* + friend bool operator< (const transform_iterator& i, const transform_iterator& i2) + { return i < i2; } + friend bool operator> (const transform_iterator& i, const transform_iterator& i2) { return i2 < i; } @@ -102,7 +114,7 @@ class transform_iterator friend bool operator>= (const transform_iterator& i, const transform_iterator& i2) { return !(i < i2); } -*/ + friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2) { return i2.distance_to(i); } @@ -129,6 +141,9 @@ class transform_iterator typename UnaryFunction::result_type operator*() const { return dereference(); } + typename UnaryFunction::result_type operator[](typename Iterator::difference_type off) const + { return UnaryFunction::operator()(m_it[off]); } + operator_arrow_proxy operator->() const { return operator_arrow_proxy(dereference()); } diff --git a/3party/boost/boost/interprocess/detail/win32_api.hpp b/3party/boost/boost/interprocess/detail/win32_api.hpp index 29e1223a27..cdcb00ef1c 100644 --- a/3party/boost/boost/interprocess/detail/win32_api.hpp +++ b/3party/boost/boost/interprocess/detail/win32_api.hpp @@ -16,11 +16,14 @@ #include #include #include +#include #include #if (defined _MSC_VER) && (_MSC_VER >= 1200) # pragma once # pragma comment( lib, "advapi32.lib" ) +# pragma comment( lib, "oleaut32.lib" ) +# pragma comment( lib, "Ole32.lib" ) #endif #if (defined BOOST_INTERPROCESS_WINDOWS) @@ -30,6 +33,7 @@ # error "This file can only be included in Windows OS" #endif + //The structures used in Interprocess with the //same binary interface as windows ones namespace boost { @@ -154,16 +158,394 @@ static const unsigned long MaxPath = 260; static void * const hkey_local_machine = (void*)(unsigned long*)(long)(0x80000002); static unsigned long key_query_value = 0x0001; +//COM API +const long RPC_C_AUTHN_LEVEL_PKT_IG = 4; +const long RPC_C_IMP_LEVEL_IMPERSONATE_IG = 3; +const long EOAC_NONE_IG = 0; +const long CLSCTX_INPROC_SERVER_IG = 0x1; +const long CLSCTX_LOCAL_SERVER_IG = 0x4; +const long WBEM_FLAG_RETURN_IMMEDIATELY_IG = 0x10; +const long WBEM_INFINITE_IG = 0xffffffff; + } //namespace winapi { } //namespace interprocess { } //namespace boost { -#if !defined( BOOST_USE_WINDOWS_H ) namespace boost { namespace interprocess { namespace winapi { +struct GUID_IG +{ + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; +}; + +const GUID_IG CLSID_WbemAdministrativeLocator = + { 0xcb8555cc, 0x9128, 0x11d1, {0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0xfd, 0xff}}; + +const GUID_IG IID_IUnknown = { 0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}; + +struct wchar_variant +{ + unsigned long long dummy; + union value_t{ + wchar_t *pbstrVal; + unsigned long long dummy; + } value; +}; + + struct IUnknown_IG + { + public: + virtual long __stdcall QueryInterface( + /* [in] */ const GUID_IG &riid, + /* [iid_is][out] */ void **ppvObject) = 0; + + virtual unsigned long __stdcall AddRef( void) = 0; + + virtual unsigned long __stdcall Release( void) = 0; + }; + +struct IWbemClassObject_IG : public IUnknown_IG +{ + public: + virtual long __stdcall GetQualifierSet( + /* [out] */ void **ppQualSet) = 0; + + virtual long __stdcall Get( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [unique][in][out] */ wchar_variant *pVal, + /* [unique][in][out] */ long *pType, + /* [unique][in][out] */ long *plFlavor) = 0; + + virtual long __stdcall Put( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [in] */ wchar_variant *pVal, + /* [in] */ long Type) = 0; + + virtual long __stdcall Delete( + /* [string][in] */ const wchar_t * wszName) = 0; + + virtual long __stdcall GetNames( + /* [string][in] */ const wchar_t * wszQualifierName, + /* [in] */ long lFlags, + /* [in] */ wchar_variant *pQualifierVal, + /* [out] */ void * *pNames) = 0; + + virtual long __stdcall BeginEnumeration( + /* [in] */ long lEnumFlags) = 0; + + virtual long __stdcall Next( + /* [in] */ long lFlags, + /* [unique][in][out] */ wchar_t * *strName, + /* [unique][in][out] */ wchar_variant *pVal, + /* [unique][in][out] */ long *pType, + /* [unique][in][out] */ long *plFlavor) = 0; + + virtual long __stdcall EndEnumeration( void) = 0; + + virtual long __stdcall GetPropertyQualifierSet( + /* [string][in] */ const wchar_t * wszProperty, + /* [out] */ void **ppQualSet) = 0; + + virtual long __stdcall Clone( + /* [out] */ IWbemClassObject_IG **ppCopy) = 0; + + virtual long __stdcall GetObjectText( + /* [in] */ long lFlags, + /* [out] */ wchar_t * *pstrObjectText) = 0; + + virtual long __stdcall SpawnDerivedClass( + /* [in] */ long lFlags, + /* [out] */ IWbemClassObject_IG **ppNewClass) = 0; + + virtual long __stdcall SpawnInstance( + /* [in] */ long lFlags, + /* [out] */ IWbemClassObject_IG **ppNewInstance) = 0; + + virtual long __stdcall CompareTo( + /* [in] */ long lFlags, + /* [in] */ IWbemClassObject_IG *pCompareTo) = 0; + + virtual long __stdcall GetPropertyOrigin( + /* [string][in] */ const wchar_t * wszName, + /* [out] */ wchar_t * *pstrClassName) = 0; + + virtual long __stdcall InheritsFrom( + /* [in] */ const wchar_t * strAncestor) = 0; + + virtual long __stdcall GetMethod( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [out] */ IWbemClassObject_IG **ppInSignature, + /* [out] */ IWbemClassObject_IG **ppOutSignature) = 0; + + virtual long __stdcall PutMethod( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [in] */ IWbemClassObject_IG *pInSignature, + /* [in] */ IWbemClassObject_IG *pOutSignature) = 0; + + virtual long __stdcall DeleteMethod( + /* [string][in] */ const wchar_t * wszName) = 0; + + virtual long __stdcall BeginMethodEnumeration( + /* [in] */ long lEnumFlags) = 0; + + virtual long __stdcall NextMethod( + /* [in] */ long lFlags, + /* [unique][in][out] */ wchar_t * *pstrName, + /* [unique][in][out] */ IWbemClassObject_IG **ppInSignature, + /* [unique][in][out] */ IWbemClassObject_IG **ppOutSignature) = 0; + + virtual long __stdcall EndMethodEnumeration( void) = 0; + + virtual long __stdcall GetMethodQualifierSet( + /* [string][in] */ const wchar_t * wszMethod, + /* [out] */ void **ppQualSet) = 0; + + virtual long __stdcall GetMethodOrigin( + /* [string][in] */ const wchar_t * wszMethodName, + /* [out] */ wchar_t * *pstrClassName) = 0; + +}; + + +struct IWbemContext_IG : public IUnknown_IG +{ +public: + virtual long __stdcall Clone( + /* [out] */ IWbemContext_IG **ppNewCopy) = 0; + + virtual long __stdcall GetNames( + /* [in] */ long lFlags, + /* [out] */ void * *pNames) = 0; + + virtual long __stdcall BeginEnumeration( + /* [in] */ long lFlags) = 0; + + virtual long __stdcall Next( + /* [in] */ long lFlags, + /* [out] */ wchar_t * *pstrName, + /* [out] */ wchar_variant *pValue) = 0; + + virtual long __stdcall EndEnumeration( void) = 0; + + virtual long __stdcall SetValue( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [in] */ wchar_variant *pValue) = 0; + + virtual long __stdcall GetValue( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags, + /* [out] */ wchar_variant *pValue) = 0; + + virtual long __stdcall DeleteValue( + /* [string][in] */ const wchar_t * wszName, + /* [in] */ long lFlags) = 0; + + virtual long __stdcall DeleteAll( void) = 0; + +}; + + +struct IEnumWbemClassObject_IG : public IUnknown_IG +{ +public: + virtual long __stdcall Reset( void) = 0; + + virtual long __stdcall Next( + /* [in] */ long lTimeout, + /* [in] */ unsigned long uCount, + /* [length_is][size_is][out] */ IWbemClassObject_IG **apObjects, + /* [out] */ unsigned long *puReturned) = 0; + + virtual long __stdcall NextAsync( + /* [in] */ unsigned long uCount, + /* [in] */ void *pSink) = 0; + + virtual long __stdcall Clone( + /* [out] */ void **ppEnum) = 0; + + virtual long __stdcall Skip( + /* [in] */ long lTimeout, + /* [in] */ unsigned long nCount) = 0; + +}; + +struct IWbemServices_IG : public IUnknown_IG +{ +public: + virtual long __stdcall OpenNamespace( + /* [in] */ const wchar_t * strNamespace, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppWorkingNamespace, + /* [unique][in][out] */ void **ppResult) = 0; + + virtual long __stdcall CancelAsyncCall( + /* [in] */ void *pSink) = 0; + + virtual long __stdcall QueryObjectSink( + /* [in] */ long lFlags, + /* [out] */ void **ppResponseHandler) = 0; + + virtual long __stdcall GetObject( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppObject, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall GetObjectAsync( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall PutClass( + /* [in] */ IWbemClassObject_IG *pObject, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall PutClassAsync( + /* [in] */ IWbemClassObject_IG *pObject, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall DeleteClass( + /* [in] */ const wchar_t * strClass, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall DeleteClassAsync( + /* [in] */ const wchar_t * strClass, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall CreateClassEnum( + /* [in] */ const wchar_t * strSuperclass, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [out] */ void **ppEnum) = 0; + + virtual long __stdcall CreateClassEnumAsync( + /* [in] */ const wchar_t * strSuperclass, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall PutInstance( + /* [in] */ void *pInst, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall PutInstanceAsync( + /* [in] */ void *pInst, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall DeleteInstance( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall DeleteInstanceAsync( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall CreateInstanceEnum( + /* [in] */ const wchar_t * strFilter, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [out] */ void **ppEnum) = 0; + + virtual long __stdcall CreateInstanceEnumAsync( + /* [in] */ const wchar_t * strFilter, + /* [in] */ long lFlags, + /* [in] */ void *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall ExecQuery( + /* [in] */ const wchar_t * strQueryLanguage, + /* [in] */ const wchar_t * strQuery, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [out] */ IEnumWbemClassObject_IG **ppEnum) = 0; + + virtual long __stdcall ExecQueryAsync( + /* [in] */ const wchar_t * strQueryLanguage, + /* [in] */ const wchar_t * strQuery, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall ExecNotificationQuery( + /* [in] */ const wchar_t * strQueryLanguage, + /* [in] */ const wchar_t * strQuery, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [out] */ void **ppEnum) = 0; + + virtual long __stdcall ExecNotificationQueryAsync( + /* [in] */ const wchar_t * strQueryLanguage, + /* [in] */ const wchar_t * strQuery, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [in] */ void *pResponseHandler) = 0; + + virtual long __stdcall ExecMethod( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ const wchar_t * strMethodName, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [in] */ IWbemClassObject_IG *pInParams, + /* [unique][in][out] */ IWbemClassObject_IG **ppOutParams, + /* [unique][in][out] */ void **ppCallResult) = 0; + + virtual long __stdcall ExecMethodAsync( + /* [in] */ const wchar_t * strObjectPath, + /* [in] */ const wchar_t * strMethodName, + /* [in] */ long lFlags, + /* [in] */ IWbemContext_IG *pCtx, + /* [in] */ IWbemClassObject_IG *pInParams, + /* [in] */ void *pResponseHandler) = 0; + +}; + +struct IWbemLocator_IG : public IUnknown_IG +{ +public: + virtual long __stdcall ConnectServer( + /* [in] */ const wchar_t * strNetworkResource, + /* [in] */ const wchar_t * strUser, + /* [in] */ const wchar_t * strPassword, + /* [in] */ const wchar_t * strLocale, + /* [in] */ long lSecurityFlags, + /* [in] */ const wchar_t * strAuthority, + /* [in] */ void *pCtx, + /* [out] */ IWbemServices_IG **ppNamespace) = 0; + +}; + + + struct interprocess_overlapped { unsigned long *internal; @@ -349,6 +731,20 @@ union system_timeofday_information unsigned char Reserved1[SystemTimeOfDayInfoLength]; }; +struct interprocess_by_handle_file_information +{ + unsigned long dwFileAttributes; + interprocess_filetime ftCreationTime; + interprocess_filetime ftLastAccessTime; + interprocess_filetime ftLastWriteTime; + unsigned long dwVolumeSerialNumber; + unsigned long nFileSizeHigh; + unsigned long nFileSizeLow; + unsigned long nNumberOfLinks; + unsigned long nFileIndexHigh; + unsigned long nFileIndexLow; +}; + enum system_information_class { system_basic_information = 0, system_performance_information = 2, @@ -379,6 +775,10 @@ struct object_name_information_t //Some windows API declarations extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentProcessId(); extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(); +extern "C" __declspec(dllimport) int __stdcall GetProcessTimes + ( void *hProcess, interprocess_filetime* lpCreationTime + , interprocess_filetime *lpExitTime,interprocess_filetime *lpKernelTime + , interprocess_filetime *lpUserTime ); extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long); extern "C" __declspec(dllimport) unsigned long __stdcall GetLastError(); extern "C" __declspec(dllimport) void * __stdcall GetCurrentProcess(); @@ -409,6 +809,7 @@ extern "C" __declspec(dllimport) int __stdcall DeleteFileA (const char *); extern "C" __declspec(dllimport) int __stdcall MoveFileExA (const char *, const char *, unsigned long); extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::size_t); +extern "C" __declspec(dllimport) int __stdcall FlushFileBuffers (void *); extern "C" __declspec(dllimport) int __stdcall GetFileSizeEx (void *, __int64 *size); extern "C" __declspec(dllimport) unsigned long __stdcall FormatMessageA (unsigned long dwFlags, const void *lpSource, unsigned long dwMessageId, @@ -433,6 +834,28 @@ extern "C" __declspec(dllimport) void *__stdcall LoadLibraryA(const char *); extern "C" __declspec(dllimport) int __stdcall FreeLibrary(void *); extern "C" __declspec(dllimport) void *__stdcall GetProcAddress(void *, const char*); extern "C" __declspec(dllimport) void *__stdcall GetModuleHandleA(const char*); +extern "C" __declspec(dllimport) void *__stdcall GetFileInformationByHandle(void *, interprocess_by_handle_file_information*); + + +//COM API +extern "C" __declspec(dllimport) long __stdcall CoInitialize(void *pvReserved); +extern "C" __declspec(dllimport) long __stdcall CoInitializeSecurity( + void* pSecDesc, + long cAuthSvc, + void *asAuthSvc, + void *pReserved1, + unsigned long dwAuthnLevel, + unsigned long dwImpLevel, + void *pAuthList, + unsigned long dwCapabilities, + void *pReserved3 ); + +extern "C" __declspec(dllimport) long __stdcall VariantClear(wchar_variant * pvarg); +extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID_IG & rclsid, IUnknown_IG *pUnkOuter, + unsigned long dwClsContext, const GUID_IG & riid, void** ppv); +extern "C" __declspec(dllimport) void __stdcall CoUninitialize(void); + + //API function typedefs //Pointer to functions @@ -459,10 +882,6 @@ typedef long (__stdcall * RegCloseKey_t)(void *); } //namespace interprocess { } //namespace boost { -#else -# include -#endif //#if !defined( BOOST_USE_WINDOWS_H ) - namespace boost { namespace interprocess { namespace winapi { @@ -492,6 +911,12 @@ inline void sched_yield() inline unsigned long get_current_thread_id() { return GetCurrentThreadId(); } +inline bool get_process_times + ( void *hProcess, interprocess_filetime* lpCreationTime + , interprocess_filetime *lpExitTime, interprocess_filetime *lpKernelTime + , interprocess_filetime *lpUserTime ) +{ return 0 != GetProcessTimes(hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime); } + inline unsigned long get_current_process_id() { return GetCurrentProcessId(); } @@ -547,20 +972,33 @@ inline int release_semaphore(void *handle, long release_count, long *prev_count) inline void *open_semaphore(const char *name) { return OpenSemaphoreA(semaphore_all_access, 1, name); } -inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name) +class interprocess_all_access_security { interprocess_security_attributes sa; interprocess_security_descriptor sd; + bool initialized; - if(!InitializeSecurityDescriptor(&sd, security_descriptor_revision)) - return 0; - if(!SetSecurityDescriptorDacl(&sd, true, 0, false)) - return 0; - sa.lpSecurityDescriptor = &sd; - sa.nLength = sizeof(interprocess_security_attributes); - sa.bInheritHandle = false; - return CreateFileMappingA (handle, &sa, access, high_size, low_size, name); - //return CreateFileMappingA (handle, 0, access, high_size, low_size, name); + public: + interprocess_all_access_security() + : initialized(false) + { + if(!InitializeSecurityDescriptor(&sd, security_descriptor_revision)) + return; + if(!SetSecurityDescriptorDacl(&sd, true, 0, false)) + return; + sa.lpSecurityDescriptor = &sd; + sa.nLength = sizeof(interprocess_security_attributes); + sa.bInheritHandle = false; + initialized = false; + } + + interprocess_security_attributes *get_attributes() + { return &sa; } +}; + +inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name, interprocess_security_attributes *psec) +{ + return CreateFileMappingA (handle, psec, access, high_size, low_size, name); } inline void * open_file_mapping (unsigned long access, const char *name) @@ -569,12 +1007,12 @@ inline void * open_file_mapping (unsigned long access, const char *name) inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned long highoffset, unsigned long lowoffset, std::size_t numbytes, void *base_addr) { return MapViewOfFileEx(handle, file_access, highoffset, lowoffset, numbytes, base_addr); } -inline void *create_file(const char *name, unsigned long access, unsigned long creation_flags, unsigned long attributes = 0) +inline void *create_file(const char *name, unsigned long access, unsigned long creation_flags, unsigned long attributes, interprocess_security_attributes *psec) { for (unsigned int attempt(0); attempt < error_sharing_violation_tries; ++attempt){ void * const handle = CreateFileA(name, access, file_share_read | file_share_write | file_share_delete, - 0, creation_flags, attributes, 0); + psec, creation_flags, attributes, 0); bool const invalid(invalid_handle_value == handle); if (!invalid){ return handle; @@ -596,14 +1034,20 @@ inline bool move_file_ex(const char *source_filename, const char *destination_fi inline void get_system_info(system_info *info) { GetSystemInfo(info); } -inline int flush_view_of_file(void *base_addr, std::size_t numbytes) -{ return FlushViewOfFile(base_addr, numbytes); } +inline bool flush_view_of_file(void *base_addr, std::size_t numbytes) +{ return 0 != FlushViewOfFile(base_addr, numbytes); } + +inline bool flush_file_buffers(void *handle) +{ return 0 != FlushFileBuffers(handle); } inline bool get_file_size(void *handle, __int64 &size) { return 0 != GetFileSizeEx(handle, &size); } -inline bool create_directory(const char *name, interprocess_security_attributes* security) -{ return 0 != CreateDirectoryA(name, security); } +inline bool create_directory(const char *name) +{ + interprocess_all_access_security sec; + return 0 != CreateDirectoryA(name, sec.get_attributes()); +} inline bool remove_directory(const char *lpPathName) { return 0 != RemoveDirectoryA(lpPathName); } @@ -626,6 +1070,9 @@ inline bool unlock_file_ex(void *hnd, unsigned long reserved, unsigned long size inline bool write_file(void *hnd, const void *buffer, unsigned long bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* overlapped) { return 0 != WriteFile(hnd, buffer, bytes_to_write, bytes_written, overlapped); } +inline bool get_file_information_by_handle(void *hnd, interprocess_by_handle_file_information *info) +{ return 0 != GetFileInformationByHandle(hnd, info); } + inline long interlocked_increment(long volatile *addr) { return BOOST_INTERLOCKED_INCREMENT(addr); } @@ -709,7 +1156,7 @@ inline bool get_file_name_from_handle_function bool bSuccess = false; // Create a file mapping object. - void * hFileMap = create_file_mapping(hFile, page_readonly, 0, 1, 0); + void * hFileMap = create_file_mapping(hFile, page_readonly, 0, 1, 0, 0); if(hFileMap) { // Create a file mapping to get the file name. @@ -836,7 +1283,7 @@ inline bool unlink_file(const char *filename) //First step: Obtain a handle to the file using Win32 rules. This resolves relative paths void *fh = create_file(filename, generic_read | delete_access, open_existing, - file_flag_backup_semantics | file_flag_delete_on_close); + file_flag_backup_semantics | file_flag_delete_on_close, 0); if(fh == invalid_handle_value){ return false; } @@ -953,6 +1400,181 @@ inline void get_shared_documents_folder(std::string &s) } } + +inline void get_registry_value(const char *folder, const char *value_key, std::vector &s) +{ + s.clear(); + void *hAdvapi = load_library("Advapi32.dll"); + if (hAdvapi){ + library_unloader unloader(hAdvapi); + // Pointer to function RegOpenKeyA + RegOpenKeyEx_t pRegOpenKey = + (RegOpenKeyEx_t)get_proc_address(hAdvapi, "RegOpenKeyExA"); + if (pRegOpenKey){ + // Pointer to function RegCloseKey + RegCloseKey_t pRegCloseKey = + (RegCloseKey_t)get_proc_address(hAdvapi, "RegCloseKey"); + if (pRegCloseKey){ + // Pointer to function RegQueryValueA + RegQueryValueEx_t pRegQueryValue = + (RegQueryValueEx_t)get_proc_address(hAdvapi, "RegQueryValueExA"); + if (pRegQueryValue){ + //Open the key + void *key; + if ((*pRegOpenKey)( hkey_local_machine + , folder + , 0 + , key_query_value + , &key) == 0){ + reg_closer key_closer(pRegCloseKey, key); + + //Obtain the value + unsigned long size; + unsigned long type; + const char *const reg_value = value_key; + long err = (*pRegQueryValue)( key, reg_value, 0, &type, 0, &size); + if(!err){ + //Size includes terminating NULL + s.resize(size); + err = (*pRegQueryValue)( key, reg_value, 0, &type, (unsigned char*)(&s[0]), &size); + if(!err) + s.erase(s.end()-1); + (void)err; + } + } + } + } + } + } +} + +inline bool get_wmi_class_attribute( std::wstring& strValue, const wchar_t *wmi_class, const wchar_t *wmi_class_var) +{ + CoInitialize(0); + + bool bRet = false; + + if( 0 == CoInitializeSecurity( 0, -1, 0, 0, RPC_C_AUTHN_LEVEL_PKT_IG, RPC_C_IMP_LEVEL_IMPERSONATE_IG, 0, EOAC_NONE_IG, 0 ) ) + { + IWbemLocator_IG * pIWbemLocator = 0; + + IWbemServices_IG * pWbemServices = 0; + IEnumWbemClassObject_IG * pEnumObject = 0; + + const wchar_t * bstrNamespace = L"root\\cimv2"; + + if( 0 != CoCreateInstance( + CLSID_WbemAdministrativeLocator, + 0, + CLSCTX_INPROC_SERVER_IG | CLSCTX_LOCAL_SERVER_IG, + IID_IUnknown, + ( void ** )&pIWbemLocator + ) + ) + { + return false; + } + + if( 0 != pIWbemLocator->ConnectServer( + bstrNamespace, // Namespace + 0, // Userid + 0, // PW + 0, // Locale + 0, // flags + 0, // Authority + 0, // Context + &pWbemServices + ) + ) + { + pIWbemLocator->Release(); + + return false; + } + + strValue.clear(); + strValue += L"Select "; + strValue += wmi_class_var; + strValue += L" from "; + strValue += wmi_class; + + if ( 0 != pWbemServices->ExecQuery( + L"WQL", + strValue.c_str(), + WBEM_FLAG_RETURN_IMMEDIATELY_IG, + 0, + &pEnumObject + ) + ) + { + pIWbemLocator->Release(); + pWbemServices->Release(); + + return false; + } + + unsigned long uCount = 1, uReturned; + IWbemClassObject_IG * pClassObject = 0; + + if ( 0 != pEnumObject->Reset() ) + { + pIWbemLocator->Release(); + pWbemServices->Release(); + pEnumObject->Release(); + + return false; + } + + wchar_variant vwchar; + + while( 0 == pEnumObject->Next( WBEM_INFINITE_IG, uCount, &pClassObject, &uReturned ) ) + { + if ( 0 == pClassObject->Get( L"LastBootUpTime", 0, &vwchar, 0, 0 ) ) + { + bRet = true; + strValue = vwchar.value.pbstrVal; + VariantClear(&vwchar ); + break; + } + } + + pIWbemLocator->Release(); + pWbemServices->Release(); + pEnumObject->Release(); + pClassObject->Release(); + } + + CoUninitialize(); + + return bRet; +} + +inline bool get_last_bootup_time( std::wstring& strValue ) +{ + bool ret = get_wmi_class_attribute(strValue, L"Win32_OperatingSystem", L"LastBootUpTime"); + std::size_t timezone = strValue.find(L'+'); + if(timezone != std::wstring::npos){ + strValue.erase(timezone); + } + timezone = strValue.find(L'-'); + if(timezone != std::wstring::npos){ + strValue.erase(timezone); + } + return ret; +} + +inline bool get_last_bootup_time( std::string& str ) +{ + std::wstring wstr; + bool ret = get_last_bootup_time(wstr); + str.resize(wstr.size()); + for(std::size_t i = 0, max = str.size(); i != max; ++i){ + str[i] = '0' + (wstr[i]-L'0'); + } + return ret; +} + + } //namespace winapi } //namespace interprocess } //namespace boost diff --git a/3party/boost/boost/interprocess/detail/workaround.hpp b/3party/boost/boost/interprocess/detail/workaround.hpp index b924657852..cb3d4a5aff 100644 --- a/3party/boost/boost/interprocess/detail/workaround.hpp +++ b/3party/boost/boost/interprocess/detail/workaround.hpp @@ -46,8 +46,9 @@ # if defined(__CYGWIN__) #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK # endif - //#elif defined(__APPLE__) - //# define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES + //Some platforms have a limited (name length) named semaphore support + #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__) + # define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES #endif #if ((defined _V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\ @@ -98,8 +99,10 @@ //portable "/shmname" format does not work due to permission issues //For those systems we need to form a path to a temporary directory: // hp-ux tru64 vms freebsd - #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 8)) + #if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7)) #define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + #elif defined(__FreeBSD__) + #define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY #endif #endif @@ -115,7 +118,7 @@ #endif -#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)\ +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) #define BOOST_INTERPROCESS_PERFECT_FORWARDING #endif diff --git a/3party/boost/boost/interprocess/detail/xsi_shared_memory_device.hpp b/3party/boost/boost/interprocess/detail/xsi_shared_memory_device.hpp index dcbe6b485f..b2014c4e0f 100644 --- a/3party/boost/boost/interprocess/detail/xsi_shared_memory_device.hpp +++ b/3party/boost/boost/interprocess/detail/xsi_shared_memory_device.hpp @@ -197,9 +197,11 @@ inline void xsi_shared_memory_device::priv_obtain_index (mapped_region ®, xsi_named_mutex &mut, std::string &path) { const char *const filename = "xsi_shm_emulation_file"; + permissions p; + p.set_unrestricted(); std::string xsi_shm_emulation_file_path; - detail::create_tmp_dir_and_get_filename(filename, xsi_shm_emulation_file_path); - detail::create_or_open_file(xsi_shm_emulation_file_path.c_str()); + detail::create_tmp_and_clean_old_and_get_filename(filename, xsi_shm_emulation_file_path); + detail::create_or_open_file(xsi_shm_emulation_file_path.c_str(), read_write, p); const std::size_t MemSize = sizeof(info_t); xsi_shared_memory index_shm(open_or_create, xsi_shm_emulation_file_path.c_str(), 1, MemSize, 0666); diff --git a/3party/boost/boost/interprocess/exceptions.hpp b/3party/boost/boost/interprocess/exceptions.hpp index 9266c7651c..5fd894cb88 100644 --- a/3party/boost/boost/interprocess/exceptions.hpp +++ b/3party/boost/boost/interprocess/exceptions.hpp @@ -33,30 +33,34 @@ namespace interprocess { class interprocess_exception : public std::exception { public: - interprocess_exception(error_code_t ec = other_error ) - : m_err(ec) + interprocess_exception(const char *err/*error_code_t ec = other_error*/) + : m_err(other_error) { - try { m_str = "boost::interprocess_exception::library_error"; } +// try { m_str = "boost::interprocess_exception::library_error"; } + try { m_str = err; } catch (...) {} } - +/* interprocess_exception(native_error_t sys_err_code) : m_err(sys_err_code) { try { fill_system_message(m_err.get_native_error(), m_str); } catch (...) {} - } + }*/ - interprocess_exception(const error_info &err_info) + interprocess_exception(const error_info &err_info, const char *str = 0) : m_err(err_info) { try{ if(m_err.get_native_error() != 0){ fill_system_message(m_err.get_native_error(), m_str); - }/* + } + else if(str){ + m_str = str; + } else{ m_str = "boost::interprocess_exception::library_error"; - }*/ + } } catch(...){} } @@ -132,7 +136,8 @@ class not_previously_created : public interprocess_exception class bad_alloc : public interprocess_exception { public: - virtual const char* what() const throw() + bad_alloc() : interprocess_exception("::boost::interprocess::bad_alloc"){} + virtual const char* what() const throw() { return "boost::interprocess::bad_alloc"; } }; diff --git a/3party/boost/boost/interprocess/interprocess_fwd.hpp b/3party/boost/boost/interprocess/interprocess_fwd.hpp index 9254afea12..917f750d1f 100644 --- a/3party/boost/boost/interprocess/interprocess_fwd.hpp +++ b/3party/boost/boost/interprocess/interprocess_fwd.hpp @@ -55,6 +55,12 @@ struct char_traits; namespace boost { namespace interprocess { +////////////////////////////////////////////////////////////////////////////// +// permissions +////////////////////////////////////////////////////////////////////////////// + +class permissions; + ////////////////////////////////////////////////////////////////////////////// // shared_memory ////////////////////////////////////////////////////////////////////////////// diff --git a/3party/boost/boost/interprocess/ipc/message_queue.hpp b/3party/boost/boost/interprocess/ipc/message_queue.hpp index 5d8e6bcfd3..7f86fe4f5c 100644 --- a/3party/boost/boost/interprocess/ipc/message_queue.hpp +++ b/3party/boost/boost/interprocess/ipc/message_queue.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,8 @@ class message_queue message_queue(create_only_t create_only, const char *name, std::size_t max_num_msg, - std::size_t max_msg_size); + std::size_t max_msg_size, + const permissions &perm = permissions()); //!Opens or creates a process shared message queue with name "name". //!If the queue is created, the maximum number of messages will be "max_num_msg" @@ -66,7 +68,8 @@ class message_queue message_queue(open_or_create_t open_or_create, const char *name, std::size_t max_num_msg, - std::size_t max_msg_size); + std::size_t max_msg_size, + const permissions &perm = permissions()); //!Opens a previously created process shared message queue with name "name". //!If the was not previously created or there are no free resources, @@ -379,7 +382,8 @@ inline std::size_t message_queue::get_mem_size inline message_queue::message_queue(create_only_t create_only, const char *name, std::size_t max_num_msg, - std::size_t max_msg_size) + std::size_t max_msg_size, + const permissions &perm) //Create shared memory and execute functor atomically : m_shmem(create_only, name, @@ -387,13 +391,15 @@ inline message_queue::message_queue(create_only_t create_only, read_write, static_cast(0), //Prepare initialization functor - detail::initialization_func_t (max_num_msg, max_msg_size)) + detail::initialization_func_t (max_num_msg, max_msg_size), + perm) {} inline message_queue::message_queue(open_or_create_t open_or_create, const char *name, std::size_t max_num_msg, - std::size_t max_msg_size) + std::size_t max_msg_size, + const permissions &perm) //Create shared memory and execute functor atomically : m_shmem(open_or_create, name, @@ -401,7 +407,8 @@ inline message_queue::message_queue(open_or_create_t open_or_create, read_write, static_cast(0), //Prepare initialization functor - detail::initialization_func_t (max_num_msg, max_msg_size)) + detail::initialization_func_t (max_num_msg, max_msg_size), + perm) {} inline message_queue::message_queue(open_only_t open_only, @@ -474,14 +481,14 @@ inline bool message_queue::do_send(block_t block, while (p_hdr->is_full()); break; default: - throw interprocess_exception(); + break; } } //Get the first free message from free message queue detail::msg_hdr_t *free_msg = p_hdr->free_msg(); if (free_msg == 0) { - throw interprocess_exception(); + throw interprocess_exception("boost::interprocess::message_queue corrupted"); } //Copy control data to the free message @@ -568,7 +575,7 @@ inline bool //Paranoia check default: - throw interprocess_exception(); + break; } } @@ -577,7 +584,7 @@ inline bool //Paranoia check if (top_msg == 0) { - throw interprocess_exception(); + throw interprocess_exception("boost::interprocess::message_queue corrupted"); } //Get data from the message diff --git a/3party/boost/boost/interprocess/managed_external_buffer.hpp b/3party/boost/boost/interprocess/managed_external_buffer.hpp index 4a5066c360..c4c70f030b 100644 --- a/3party/boost/boost/interprocess/managed_external_buffer.hpp +++ b/3party/boost/boost/interprocess/managed_external_buffer.hpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include //!\file //!Describes a named user memory allocation user class. @@ -58,9 +58,9 @@ class basic_managed_external_buffer (create_only_t, void *addr, std::size_t size) { //Check if alignment is correct - assert((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u))))); + BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u))))); if(!base_t::create_impl(addr, size)){ - throw interprocess_exception(); + throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor"); } } @@ -69,9 +69,9 @@ class basic_managed_external_buffer (open_only_t, void *addr, std::size_t size) { //Check if alignment is correct - assert((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u))))); + BOOST_ASSERT((0 == (((std::size_t)addr) & (AllocationAlgorithm::Alignment - std::size_t(1u))))); if(!base_t::open_impl(addr, size)){ - throw interprocess_exception(); + throw interprocess_exception("Could not initialize buffer in basic_managed_external_buffer constructor"); } } diff --git a/3party/boost/boost/interprocess/managed_heap_memory.hpp b/3party/boost/boost/interprocess/managed_heap_memory.hpp index e747cddc6d..7a60b9f637 100644 --- a/3party/boost/boost/interprocess/managed_heap_memory.hpp +++ b/3party/boost/boost/interprocess/managed_heap_memory.hpp @@ -67,7 +67,7 @@ class basic_managed_heap_memory { if(!base_t::create_impl(&m_heapmem[0], size)){ this->priv_close(); - throw interprocess_exception(); + throw interprocess_exception("Could not initialize heap in basic_managed_heap_memory constructor"); } } diff --git a/3party/boost/boost/interprocess/managed_mapped_file.hpp b/3party/boost/boost/interprocess/managed_mapped_file.hpp index 4334e24a80..d548259715 100644 --- a/3party/boost/boost/interprocess/managed_mapped_file.hpp +++ b/3party/boost/boost/interprocess/managed_mapped_file.hpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace boost { namespace interprocess { @@ -71,9 +72,9 @@ class basic_managed_mapped_file //!Creates mapped file and creates and places the segment manager. //!This can throw. basic_managed_mapped_file(create_only_t create_only, const char *name, - std::size_t size, const void *addr = 0) + std::size_t size, const void *addr = 0, const permissions &perm = permissions()) : m_mfile(create_only, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), detail::DoCreate)) + create_open_func_t(get_this_pointer(), detail::DoCreate), perm) {} //!Creates mapped file and creates and places the segment manager if @@ -82,17 +83,17 @@ class basic_managed_mapped_file //!This can throw. basic_managed_mapped_file (open_or_create_t open_or_create, const char *name, std::size_t size, - const void *addr = 0) - : m_mfile(open_or_create, name, size, read_write, addr, + const void *addr = 0, const permissions &perm = permissions()) + : m_mfile(open_or_create, name, size, read_write, addr, create_open_func_t(get_this_pointer(), - detail::DoOpenOrCreate)) + detail::DoOpenOrCreate), perm) {} //!Connects to a created mapped file and its segment manager. //!This can throw. basic_managed_mapped_file (open_only_t open_only, const char* name, const void *addr = 0) - : m_mfile(open_only, name, read_write, addr, + : m_mfile(open_only, name, read_write, addr, create_open_func_t(get_this_pointer(), detail::DoOpen)) {} diff --git a/3party/boost/boost/interprocess/managed_shared_memory.hpp b/3party/boost/boost/interprocess/managed_shared_memory.hpp index 12aca6a6bc..5884cf6391 100644 --- a/3party/boost/boost/interprocess/managed_shared_memory.hpp +++ b/3party/boost/boost/interprocess/managed_shared_memory.hpp @@ -19,9 +19,11 @@ #include #include +#include #include #include #include +#include namespace boost { @@ -82,10 +84,10 @@ class basic_managed_shared_memory //!Creates shared memory and creates and places the segment manager. //!This can throw. basic_managed_shared_memory(create_only_t create_only, const char *name, - std::size_t size, const void *addr = 0) + std::size_t size, const void *addr = 0, const permissions& perm = permissions()) : base_t() , base2_t(create_only, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), detail::DoCreate)) + create_open_func_t(get_this_pointer(), detail::DoCreate), perm) {} //!Creates shared memory and creates and places the segment manager if @@ -94,11 +96,11 @@ class basic_managed_shared_memory //!This can throw. basic_managed_shared_memory (open_or_create_t open_or_create, const char *name, std::size_t size, - const void *addr = 0) + const void *addr = 0, const permissions& perm = permissions()) : base_t() , base2_t(open_or_create, name, size, read_write, addr, create_open_func_t(get_this_pointer(), - detail::DoOpenOrCreate)) + detail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. @@ -180,6 +182,11 @@ class basic_managed_shared_memory (shmname); } + bool flush() + { + return this->base2_t::flush(); + } + /// @cond //!Tries to find a previous named allocation address. Returns a memory diff --git a/3party/boost/boost/interprocess/managed_windows_shared_memory.hpp b/3party/boost/boost/interprocess/managed_windows_shared_memory.hpp index 8ba588217c..c28b451fb4 100644 --- a/3party/boost/boost/interprocess/managed_windows_shared_memory.hpp +++ b/3party/boost/boost/interprocess/managed_windows_shared_memory.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace boost { @@ -74,9 +75,9 @@ class basic_managed_windows_shared_memory //!This can throw. basic_managed_windows_shared_memory (create_only_t create_only, const char *name, - std::size_t size, const void *addr = 0) + std::size_t size, const void *addr = 0, const permissions &perm = permissions()) : m_wshm(create_only, name, size, read_write, addr, - create_open_func_t(get_this_pointer(), detail::DoCreate)) + create_open_func_t(get_this_pointer(), detail::DoCreate), perm) {} //!Creates shared memory and creates and places the segment manager if @@ -86,10 +87,11 @@ class basic_managed_windows_shared_memory basic_managed_windows_shared_memory (open_or_create_t open_or_create, const char *name, std::size_t size, - const void *addr = 0) + const void *addr = 0, + const permissions &perm = permissions()) : m_wshm(open_or_create, name, size, read_write, addr, create_open_func_t(get_this_pointer(), - detail::DoOpenOrCreate)) + detail::DoOpenOrCreate), perm) {} //!Connects to a created shared memory and its segment manager. diff --git a/3party/boost/boost/interprocess/mapped_region.hpp b/3party/boost/boost/interprocess/mapped_region.hpp index 2c7bc66456..61a8470b9d 100644 --- a/3party/boost/boost/interprocess/mapped_region.hpp +++ b/3party/boost/boost/interprocess/mapped_region.hpp @@ -34,7 +34,7 @@ # if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) # include //System V shared memory... # endif -# include +# include # else # error Unknown platform # endif @@ -42,7 +42,7 @@ #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) //!\file -//!Describes memory_mappable and mapped region classes +//!Describes mapped region class namespace boost { namespace interprocess { @@ -81,7 +81,17 @@ class mapped_region //!Move constructor. *this will be constructed taking ownership of "other"'s //!region and "other" will be left in default constructor state. - mapped_region(BOOST_INTERPROCESS_RV_REF(mapped_region) other); + mapped_region(BOOST_INTERPROCESS_RV_REF(mapped_region) other) + #if defined (BOOST_INTERPROCESS_WINDOWS) + : m_base(0), m_size(0), m_offset(0) + , m_extra_offset(0) + , m_mode(read_only) + , m_file_mapping_hnd(detail::invalid_file()) + #else + : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) + #endif + { this->swap(other); } + //!Destroys the mapped region. //!Does not throw @@ -89,7 +99,12 @@ class mapped_region //!Move assignment. If *this owns a memory mapped region, it will be //!destroyed and it will take ownership of "other"'s memory mapped region. - mapped_region &operator=(BOOST_INTERPROCESS_RV_REF(mapped_region) other); + mapped_region &operator=(BOOST_INTERPROCESS_RV_REF(mapped_region) other) + { + mapped_region tmp(boost::interprocess::move(other)); + this->swap(tmp); + return *this; + } //!Returns the size of the mapping. Note for windows users: If //!windows_shared_memory is mapped using 0 as the size, it returns 0 @@ -154,13 +169,6 @@ class mapped_region inline void swap(mapped_region &x, mapped_region &y) { x.swap(y); } -inline mapped_region &mapped_region::operator=(BOOST_INTERPROCESS_RV_REF(mapped_region) moved) -{ - mapped_region tmp(boost::interprocess::move(moved)); - this->swap(tmp); - return *this; -} - inline mapped_region::~mapped_region() { this->priv_close(); } @@ -176,20 +184,13 @@ inline mode_t mapped_region::get_mode() const inline void* mapped_region::get_address() const { return m_base; } -#if (defined BOOST_INTERPROCESS_WINDOWS) +#if defined (BOOST_INTERPROCESS_WINDOWS) inline mapped_region::mapped_region() : m_base(0), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only) , m_file_mapping_hnd(detail::invalid_file()) {} -inline mapped_region::mapped_region(BOOST_INTERPROCESS_RV_REF(mapped_region) other) - : m_base(0), m_size(0), m_offset(0) - , m_extra_offset(0) - , m_mode(read_only) - , m_file_mapping_hnd(detail::invalid_file()) -{ this->swap(other); } - template inline std::size_t mapped_region::page_size_holder::get_page_size() { @@ -218,6 +219,7 @@ inline mapped_region::mapped_region switch(mode) { case read_only: + case read_private: file_map_access |= winapi::page_readonly; map_access |= winapi::file_map_read; break; @@ -259,7 +261,7 @@ inline mapped_region::mapped_region //Create file mapping native_mapping_handle = winapi::create_file_mapping - (detail::file_handle_from_mapping_handle(mapping.get_mapping_handle()), file_map_access, 0, 0, 0); + (detail::file_handle_from_mapping_handle(mapping.get_mapping_handle()), file_map_access, 0, 0, 0, 0); //Check if all is correct if(!native_mapping_handle){ @@ -350,7 +352,7 @@ inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbyte } //Flush it all - return 0 == winapi::flush_view_of_file + return winapi::flush_view_of_file (static_cast(m_base)+mapping_offset, static_cast(numbytes)); } @@ -378,10 +380,6 @@ inline mapped_region::mapped_region() : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) {} -inline mapped_region::mapped_region(BOOST_INTERPROCESS_RV_REF(mapped_region) other) - : m_base(MAP_FAILED), m_size(0), m_offset(0), m_extra_offset(0), m_mode(read_only), m_is_xsi(false) -{ this->swap(other); } - template inline std::size_t mapped_region::page_size_holder::get_page_size() { return std::size_t(sysconf(_SC_PAGESIZE)); } @@ -467,6 +465,11 @@ inline mapped_region::mapped_region flags |= MAP_SHARED; break; + case read_private: + prot |= (PROT_READ); + flags |= MAP_PRIVATE; + break; + case read_write: prot |= (PROT_WRITE | PROT_READ); flags |= MAP_SHARED; @@ -538,7 +541,7 @@ inline bool mapped_region::flush(std::size_t mapping_offset, std::size_t numbyte } //Flush it all return msync(static_cast(m_base)+mapping_offset, - numbytes, MS_SYNC) == 0; + numbytes, MS_ASYNC) == 0; } inline void mapped_region::priv_close() @@ -547,7 +550,7 @@ inline void mapped_region::priv_close() #ifdef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS if(m_is_xsi){ int ret = ::shmdt(m_base); - assert(ret == 0); + BOOST_ASSERT(ret == 0); (void)ret; return; } diff --git a/3party/boost/boost/interprocess/mem_algo/detail/mem_algo_common.hpp b/3party/boost/boost/interprocess/mem_algo/detail/mem_algo_common.hpp index 7fc8ab0ef1..beaaf521b5 100644 --- a/3party/boost/boost/interprocess/mem_algo/detail/mem_algo_common.hpp +++ b/3party/boost/boost/interprocess/mem_algo/detail/mem_algo_common.hpp @@ -31,6 +31,7 @@ #include #include #include +#include //!\file //!Implements common operations for memory algorithms. @@ -119,7 +120,7 @@ class memory_algorithm_common //biggest of all possibilities current_forward = detail::get_truncated_size_po2(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; - assert((needs_backwards % backwards_multiple) == 0); + BOOST_ASSERT((needs_backwards % backwards_multiple) == 0); needs_backwards_lcmed = detail::get_rounded_size_po2(needs_backwards, lcm); lcm_out = lcm; needs_backwards_lcmed_out = needs_backwards_lcmed; @@ -131,7 +132,7 @@ class memory_algorithm_common current_forward = detail::get_truncated_size(received_size, backwards_multiple); //No need to round needs_backwards because backwards_multiple == lcm needs_backwards_lcmed = needs_backwards = size_to_achieve - current_forward; - assert((needs_backwards_lcmed & (Alignment - 1u)) == 0); + BOOST_ASSERT((needs_backwards_lcmed & (Alignment - 1u)) == 0); lcm_out = lcm; needs_backwards_lcmed_out = needs_backwards_lcmed; return true; @@ -144,7 +145,7 @@ class memory_algorithm_common if(0 != (needs_backwards_lcmed & (Alignment-1))) //while(0 != (needs_backwards_lcmed & (Alignment-1))) needs_backwards_lcmed += backwards_multiple; - assert((needs_backwards_lcmed % lcm) == 0); + BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0); lcm_out = lcm; needs_backwards_lcmed_out = needs_backwards_lcmed; return true; @@ -165,7 +166,7 @@ class memory_algorithm_common needs_backwards_lcmed += (4-remainder)*backwards_multiple; } } - assert((needs_backwards_lcmed % lcm) == 0); + BOOST_ASSERT((needs_backwards_lcmed % lcm) == 0); lcm_out = lcm; needs_backwards_lcmed_out = needs_backwards_lcmed; return true; @@ -178,7 +179,7 @@ class memory_algorithm_common //biggest of all possibilities current_forward = detail::get_truncated_size(received_size, backwards_multiple); needs_backwards = size_to_achieve - current_forward; - assert((needs_backwards % backwards_multiple) == 0); + BOOST_ASSERT((needs_backwards % backwards_multiple) == 0); needs_backwards_lcmed = detail::get_rounded_size(needs_backwards, lcm); lcm_out = lcm; needs_backwards_lcmed_out = needs_backwards_lcmed; @@ -279,9 +280,9 @@ class memory_algorithm_common //Now obtain the address of the blocks block_ctrl *first = memory_algo->priv_get_block(buffer); block_ctrl *second = memory_algo->priv_get_block(pos); - assert(pos <= (reinterpret_cast(first) + first->m_size*Alignment)); - assert(first->m_size >= 2*MinBlockUnits); - assert((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <= + BOOST_ASSERT(pos <= (reinterpret_cast(first) + first->m_size*Alignment)); + BOOST_ASSERT(first->m_size >= 2*MinBlockUnits); + BOOST_ASSERT((pos + MinBlockUnits*Alignment - AllocatedCtrlBytes + nbytes*Alignment/Alignment) <= (reinterpret_cast(first) + first->m_size*Alignment)); //Set the new size of the first block std::size_t old_size = first->m_size; @@ -314,7 +315,7 @@ class memory_algorithm_common } else{ second->m_size = old_size - first->m_size; - assert(second->m_size >= MinBlockUnits); + BOOST_ASSERT(second->m_size >= MinBlockUnits); memory_algo->priv_mark_new_allocated_block(second); } @@ -517,7 +518,7 @@ class memory_algorithm_common block_address += new_block->m_size*Alignment; total_used_units += new_block->m_size; //Check we have enough room to overwrite the intrusive pointer - assert((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); + BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer)); void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0); chain.push_back(p); ++low_idx; diff --git a/3party/boost/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp b/3party/boost/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp index 6293aab970..a0afb2fe7b 100644 --- a/3party/boost/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp +++ b/3party/boost/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include /*!\file @@ -247,8 +247,8 @@ template inline simple_seq_fit_impl::~simple_seq_fit_impl() { //There is a memory leak! -// assert(m_header.m_allocated == 0); -// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); +// BOOST_ASSERT(m_header.m_allocated == 0); +// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); } template @@ -279,7 +279,7 @@ template inline void simple_seq_fit_impl::priv_add_segment(void *addr, std::size_t size) { //Check size - assert(!(size < MinBlockSize)); + BOOST_ASSERT(!(size < MinBlockSize)); if(size < MinBlockSize) return; //Construct big block using the new segment @@ -445,7 +445,7 @@ inline void* simple_seq_fit_impl:: boost::interprocess::multi_segment_services *p_services = static_cast (void_pointer::find_group_data(group)); - assert(p_services); + BOOST_ASSERT(p_services); std::pair ret = p_services->create_new_segment(MinBlockSize > nbytes ? MinBlockSize : nbytes); if(ret.first){ @@ -502,7 +502,7 @@ void* simple_seq_fit_impl:: if((prev->get_user_bytes()) >= needs_backwards){ //Now take all next space. This will succeed if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){ - assert(0); + BOOST_ASSERT(0); } //We need a minimum size to split the previous one @@ -679,7 +679,7 @@ inline bool simple_seq_fit_impl:: std::size_t old_block_size = block->m_size; //All used blocks' next is marked with 0 so check it - assert(block->m_next == 0); + BOOST_ASSERT(block->m_next == 0); //Put this to a safe value received_size = old_block_size*Alignment - BlockCtrlBytes; @@ -735,7 +735,7 @@ inline bool simple_seq_fit_impl:: if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){ //Something very ugly is happening here. This is a bug //or there is memory corruption - assert(0); + BOOST_ASSERT(0); return false; } return true; @@ -754,7 +754,7 @@ inline bool simple_seq_fit_impl:: std::size_t block_size = block->m_size; //All used blocks' next is marked with 0 so check it - assert(block->m_next == 0); + BOOST_ASSERT(block->m_next == 0); //Put this to a safe value received_size = block_size*Alignment - BlockCtrlBytes; @@ -806,7 +806,7 @@ inline void* simple_seq_fit_impl:: //Ensure power of 2 if ((alignment & (alignment - std::size_t(1u))) != 0){ //Alignment is not power of two - assert((alignment & (alignment - std::size_t(1u))) != 0); + BOOST_ASSERT((alignment & (alignment - std::size_t(1u))) != 0); return 0; } @@ -885,7 +885,7 @@ void* simple_seq_fit_impl::priv_check_and_allocate //Mark the block as allocated block->m_next = 0; //Check alignment - assert(((reinterpret_cast(block) - reinterpret_cast(this)) + BOOST_ASSERT(((reinterpret_cast(block) - reinterpret_cast(this)) % Alignment) == 0 ); return reinterpret_cast(block) + BlockCtrlBytes; } @@ -917,14 +917,14 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) (reinterpret_cast(addr) - BlockCtrlBytes); //All used blocks' next is marked with 0 so check it - assert(block->m_next == 0); + BOOST_ASSERT(block->m_next == 0); //Check if alignment and block size are right - assert((reinterpret_cast(addr) - reinterpret_cast(this)) + BOOST_ASSERT((reinterpret_cast(addr) - reinterpret_cast(this)) % Alignment == 0 ); std::size_t total_size = Alignment*block->m_size; - assert(m_header.m_allocated >= total_size); + BOOST_ASSERT(m_header.m_allocated >= total_size); //Update used memory count m_header.m_allocated -= total_size; diff --git a/3party/boost/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp b/3party/boost/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp index 5963860665..8cf2bf3789 100644 --- a/3party/boost/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp +++ b/3party/boost/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include //!\file @@ -338,8 +338,8 @@ template inline simple_seq_fit_impl::~simple_seq_fit_impl() { //There is a memory leak! -// assert(m_header.m_allocated == 0); -// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); +// BOOST_ASSERT(m_header.m_allocated == 0); +// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); } template @@ -397,21 +397,21 @@ void simple_seq_fit_impl::shrink_to_fit() //Check if have only 1 big free block void *unique_block = 0; if(!m_header.m_allocated){ - assert(prev == root); + BOOST_ASSERT(prev == root); std::size_t ignore; unique_block = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first; if(!unique_block) return; last = detail::get_pointer(m_header.m_root.m_next); - assert(last_free_end_address == (reinterpret_cast(last) + last->m_size*Alignment)); + BOOST_ASSERT(last_free_end_address == (reinterpret_cast(last) + last->m_size*Alignment)); } std::size_t last_units = last->m_size; std::size_t received_size; void *addr = priv_check_and_allocate(last_units, prev, last, received_size); (void)addr; - assert(addr); - assert(received_size == last_units*Alignment - AllocatedCtrlBytes); + BOOST_ASSERT(addr); + BOOST_ASSERT(received_size == last_units*Alignment - AllocatedCtrlBytes); //Shrink it m_header.m_size /= Alignment; @@ -452,7 +452,7 @@ inline void simple_seq_fit_impl::priv_add_segment(void { algo_impl_t::assert_alignment(addr); //Check size - assert(!(size < MinBlockSize)); + BOOST_ASSERT(!(size < MinBlockSize)); if(size < MinBlockSize) return; //Construct big block using the new segment @@ -595,7 +595,7 @@ inline std::pair simple_seq_fit_impl:: void *reuse_ptr, std::size_t sizeof_object) { if(!sizeof_object) - return std::pair(static_cast(0), 0); + return std::pair(static_cast(0), false); if(command & boost::interprocess::try_shrink_in_place){ bool success = algo_impl_t::try_shrink ( this, reuse_ptr, limit_objects*sizeof_object @@ -690,7 +690,7 @@ void* simple_seq_fit_impl:: if((prev->get_user_bytes()) >= needs_backwards){ //Now take all next space. This will succeed if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){ - assert(0); + BOOST_ASSERT(0); } //We need a minimum size to split the previous one @@ -819,7 +819,7 @@ std::pair simple_seq_fit_impl:: received_size = biggest_block->m_size*Alignment - BlockCtrlUnits; void *ret = this->priv_check_and_allocate (biggest_block->m_size, prev_biggest_block, biggest_block, received_size); - assert(ret != 0); + BOOST_ASSERT(ret != 0); algo_impl_t::assert_alignment(ret); return return_type(ret, false); } @@ -914,7 +914,7 @@ inline bool simple_seq_fit_impl:: std::size_t old_block_size = block->m_size; //All used blocks' next is marked with 0 so check it - assert(block->m_next == 0); + BOOST_ASSERT(block->m_next == 0); //Put this to a safe value received_size = old_block_size*Alignment - BlockCtrlBytes; @@ -970,7 +970,7 @@ inline bool simple_seq_fit_impl:: if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){ //Something very ugly is happening here. This is a bug //or there is memory corruption - assert(0); + BOOST_ASSERT(0); return false; } return true; @@ -1045,13 +1045,13 @@ void simple_seq_fit_impl::priv_deallocate(void* addr) block_ctrl * block = reinterpret_cast(priv_get_block(addr)); //All used blocks' next is marked with 0 so check it - assert(block->m_next == 0); + BOOST_ASSERT(block->m_next == 0); //Check if alignment and block size are right algo_impl_t::assert_alignment(addr); std::size_t total_size = Alignment*block->m_size; - assert(m_header.m_allocated >= total_size); + BOOST_ASSERT(m_header.m_allocated >= total_size); //Update used memory count m_header.m_allocated -= total_size; diff --git a/3party/boost/boost/interprocess/mem_algo/rbtree_best_fit.hpp b/3party/boost/boost/interprocess/mem_algo/rbtree_best_fit.hpp index d790e71e76..1f982392b4 100644 --- a/3party/boost/boost/interprocess/mem_algo/rbtree_best_fit.hpp +++ b/3party/boost/boost/interprocess/mem_algo/rbtree_best_fit.hpp @@ -37,10 +37,11 @@ #include #include #include +#include #include #include -#include +#include #include #include @@ -368,7 +369,7 @@ inline rbtree_best_fit:: //Now write calculate the offset of the first big block that will //cover the whole segment - assert(get_min_size(extra_hdr_bytes) <= size); + BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size); std::size_t block1_off = priv_first_block_offset(this, extra_hdr_bytes); priv_add_segment(reinterpret_cast(this) + block1_off, size - block1_off); } @@ -377,8 +378,8 @@ template inline rbtree_best_fit::~rbtree_best_fit() { //There is a memory leak! -// assert(m_header.m_allocated == 0); -// assert(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); +// BOOST_ASSERT(m_header.m_allocated == 0); +// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root)); } template @@ -391,7 +392,7 @@ void rbtree_best_fit::grow(std::size_t e block_ctrl *first_block = reinterpret_cast (reinterpret_cast(this) + block1_off); block_ctrl *old_end_block = priv_end_block(first_block); - assert(priv_is_allocated_block(old_end_block)); + BOOST_ASSERT(priv_is_allocated_block(old_end_block)); std::size_t old_border_offset = (reinterpret_cast(old_end_block) - reinterpret_cast(this)) + EndCtrlBlockBytes; @@ -399,7 +400,7 @@ void rbtree_best_fit::grow(std::size_t e m_header.m_size += extra_size; //We need at least MinBlockUnits blocks to create a new block -// assert((m_header.m_size - old_end) >= MinBlockUnits); +// BOOST_ASSERT((m_header.m_size - old_end) >= MinBlockUnits); if((m_header.m_size - old_border_offset) < MinBlockUnits){ return; } @@ -411,18 +412,18 @@ void rbtree_best_fit::grow(std::size_t e new_end_block->m_size = (reinterpret_cast(first_block) - reinterpret_cast(new_end_block))/Alignment; first_block->m_prev_size = new_end_block->m_size; - assert(first_block == priv_next_block(new_end_block)); + BOOST_ASSERT(first_block == priv_next_block(new_end_block)); priv_mark_new_allocated_block(new_end_block); - assert(new_end_block == priv_end_block(first_block)); + BOOST_ASSERT(new_end_block == priv_end_block(first_block)); //The old end block is the new block block_ctrl *new_block = old_end_block; new_block->m_size = (reinterpret_cast(new_end_block) - reinterpret_cast(new_block))/Alignment; - assert(new_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_new_allocated_block(new_block); - assert(priv_next_block(new_block) == new_end_block); + BOOST_ASSERT(priv_next_block(new_block) == new_end_block); m_header.m_allocated += new_block->m_size*Alignment; @@ -443,7 +444,7 @@ void rbtree_best_fit::shrink_to_fit() block_ctrl *old_end_block = priv_end_block(first_block); algo_impl_t::assert_alignment(old_end_block); - assert(priv_is_allocated_block(old_end_block)); + BOOST_ASSERT(priv_is_allocated_block(old_end_block)); algo_impl_t::assert_alignment(old_end_block); @@ -458,10 +459,10 @@ void rbtree_best_fit::shrink_to_fit() return; algo_impl_t::assert_alignment(unique_buffer); block_ctrl *unique_block = priv_get_block(unique_buffer); - assert(priv_is_allocated_block(unique_block)); + BOOST_ASSERT(priv_is_allocated_block(unique_block)); algo_impl_t::assert_alignment(unique_block); last_block = priv_next_block(unique_block); - assert(!priv_is_allocated_block(last_block)); + BOOST_ASSERT(!priv_is_allocated_block(last_block)); algo_impl_t::assert_alignment(last_block); } else{ @@ -487,7 +488,7 @@ void rbtree_best_fit::shrink_to_fit() //store the offset to the end block since in the previous //offset can't be overwritten by a previous block first_block->m_prev_size = new_end_block->m_size; - assert(priv_end_block(first_block) == new_end_block); + BOOST_ASSERT(priv_end_block(first_block) == new_end_block); //Update managed buffer's size m_header.m_size = shrunk_border_offset; @@ -502,12 +503,12 @@ void rbtree_best_fit:: //Check alignment algo_impl_t::check_alignment(addr); //Check size - assert(size >= (BlockCtrlBytes + EndCtrlBlockBytes)); + BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes)); //Initialize the first big block and the "end" node block_ctrl *first_big_block = new(addr)block_ctrl; first_big_block->m_size = size/Alignment - EndCtrlBlockUnits; - assert(first_big_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits); //The "end" node is just a node of size 0 with the "end" bit set block_ctrl *end_block = static_cast @@ -519,20 +520,20 @@ void rbtree_best_fit:: (reinterpret_cast(first_big_block) - reinterpret_cast(end_block))/Alignment; priv_mark_as_allocated_block(end_block); - assert(priv_next_block(first_big_block) == end_block); - assert(priv_next_block(end_block) == first_big_block); - assert(priv_end_block(first_big_block) == end_block); - assert(priv_prev_block(end_block) == first_big_block); + BOOST_ASSERT(priv_next_block(first_big_block) == end_block); + BOOST_ASSERT(priv_next_block(end_block) == first_big_block); + BOOST_ASSERT(priv_end_block(first_big_block) == end_block); + BOOST_ASSERT(priv_prev_block(end_block) == first_big_block); //Some check to validate the algorithm, since it makes some assumptions //to optimize the space wasted in bookkeeping: //Check that the sizes of the header are placed before the rbtree - assert(static_cast(static_cast(first_big_block)) + BOOST_ASSERT(static_cast(static_cast(first_big_block)) < static_cast(static_cast(first_big_block))); //Check that the alignment is power of two (we use some optimizations based on this) - //assert((Alignment % 2) == 0); + //BOOST_ASSERT((Alignment % 2) == 0); //Insert it in the intrusive containers m_header.m_imultiset.insert(*first_big_block); } @@ -656,7 +657,7 @@ inline std::pair rbtree_best_fit(static_cast(0), 0); + return std::pair(static_cast(0), false); if(command & boost::interprocess::try_shrink_in_place){ bool success = algo_impl_t::try_shrink ( this, reuse_ptr, limit_objects*sizeof_object @@ -712,11 +713,19 @@ inline void rbtree_best_fit::zero_free_m imultiset_iterator ib(m_header.m_imultiset.begin()), ie(m_header.m_imultiset.end()); //Iterate through all blocks obtaining their size - for(; ib != ie; ++ib){ - //Just clear user the memory part reserved for the user - std::memset( reinterpret_cast(&*ib) + BlockCtrlBytes - , 0 - , ib->m_size*Alignment - BlockCtrlBytes); + while(ib != ie){ + //Just clear user the memory part reserved for the user + volatile char *ptr = reinterpret_cast(&*ib) + BlockCtrlBytes; + std::size_t s = ib->m_size*Alignment - BlockCtrlBytes; + while(s--){ + *ptr++ = 0; + } + + //This surprisingly is optimized out by Visual C++ 7.1 in release mode! + //std::memset( reinterpret_cast(&*ib) + BlockCtrlBytes + // , 0 + // , ib->m_size*Alignment - BlockCtrlBytes); + ++ib; } } @@ -751,7 +760,7 @@ void* rbtree_best_fit:: block_ctrl *reuse = priv_get_block(reuse_ptr); //Sanity check - //assert(reuse->m_size == priv_tail_size(reuse)); + //BOOST_ASSERT(reuse->m_size == priv_tail_size(reuse)); algo_impl_t::assert_alignment(reuse); block_ctrl *prev_block; @@ -762,10 +771,10 @@ void* rbtree_best_fit:: } prev_block = priv_prev_block(reuse); - assert(!priv_is_allocated_block(prev_block)); + BOOST_ASSERT(!priv_is_allocated_block(prev_block)); //Some sanity checks - assert(prev_block->m_size == reuse->m_prev_size); + BOOST_ASSERT(prev_block->m_size == reuse->m_prev_size); algo_impl_t::assert_alignment(prev_block); std::size_t needs_backwards_aligned; @@ -784,9 +793,9 @@ void* rbtree_best_fit:: if(command & boost::interprocess::expand_fwd){ std::size_t received_size2; if(!priv_expand(reuse_ptr, received_size, received_size, received_size2)){ - assert(0); + BOOST_ASSERT(0); } - assert(received_size = received_size2); + BOOST_ASSERT(received_size = received_size2); } //We need a minimum size to split the previous one if(prev_block->m_size >= (needs_backwards_aligned/Alignment + BlockCtrlUnits)){ @@ -796,12 +805,12 @@ void* rbtree_best_fit:: //Free old previous buffer new_block->m_size = AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment; - assert(new_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits); priv_mark_new_allocated_block(new_block); prev_block->m_size = (reinterpret_cast(new_block) - reinterpret_cast(prev_block))/Alignment; - assert(prev_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits); priv_mark_as_free_block(prev_block); //Update the old previous block in the free blocks tree @@ -827,7 +836,7 @@ void* rbtree_best_fit:: //first bytes, fill them with a pattern void *p = priv_get_user_buffer(new_block); void *user_ptr = reinterpret_cast(p); - assert((static_cast(reuse_ptr) - static_cast(user_ptr)) % backwards_multiple == 0); + BOOST_ASSERT((static_cast(reuse_ptr) - static_cast(user_ptr)) % backwards_multiple == 0); algo_impl_t::assert_alignment(user_ptr); return user_ptr; } @@ -845,13 +854,13 @@ void* rbtree_best_fit:: m_header.m_allocated += prev_block->m_size*Alignment; //Now update sizes prev_block->m_size = prev_block->m_size + reuse->m_size; - assert(prev_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits); priv_mark_new_allocated_block(prev_block); //If the backwards expansion has remaining bytes in the //first bytes, fill them with a pattern void *user_ptr = priv_get_user_buffer(prev_block); - assert((static_cast(reuse_ptr) - static_cast(user_ptr)) % backwards_multiple == 0); + BOOST_ASSERT((static_cast(reuse_ptr) - static_cast(user_ptr)) % backwards_multiple == 0); algo_impl_t::assert_alignment(user_ptr); return user_ptr; } @@ -977,8 +986,8 @@ bool rbtree_best_fit:: std::size_t old_block_units = block->m_size; //The block must be marked as allocated and the sizes must be equal - assert(priv_is_allocated_block(block)); - //assert(old_block_units == priv_tail_size(block)); + BOOST_ASSERT(priv_is_allocated_block(block)); + //BOOST_ASSERT(old_block_units == priv_tail_size(block)); //Put this to a safe value received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk; @@ -990,7 +999,7 @@ bool rbtree_best_fit:: const std::size_t preferred_user_units = algo_impl_t::ceil_units(preferred_size - UsableByPreviousChunk); //Some parameter checks - assert(min_user_units <= preferred_user_units); + BOOST_ASSERT(min_user_units <= preferred_user_units); block_ctrl *next_block; @@ -1022,7 +1031,7 @@ bool rbtree_best_fit:: //This block is bigger than needed, split it in //two blocks, the first one will be merged and //the second's size will be the remaining space - assert(next_block->m_size == priv_next_block(next_block)->m_prev_size); + BOOST_ASSERT(next_block->m_size == priv_next_block(next_block)->m_prev_size); const std::size_t rem_units = merged_units - intended_units; //Check if we we need to update the old next block in the free blocks tree @@ -1045,7 +1054,7 @@ bool rbtree_best_fit:: (reinterpret_cast(block) + intended_units*Alignment))block_ctrl; rem_block->m_size = rem_units; algo_impl_t::assert_alignment(rem_block); - assert(rem_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits); priv_mark_as_free_block(rem_block); //Now the second part of the fixup @@ -1056,7 +1065,7 @@ bool rbtree_best_fit:: //Write the new length block->m_size = intended_user_units + AllocatedCtrlUnits; - assert(block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(block->m_size >= BlockCtrlUnits); m_header.m_allocated += (intended_units - old_block_units)*Alignment; } //There is no free space to create a new node: just merge both blocks @@ -1066,7 +1075,7 @@ bool rbtree_best_fit:: //Write the new length block->m_size = merged_units; - assert(block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(block->m_size >= BlockCtrlUnits); m_header.m_allocated += (merged_units - old_block_units)*Alignment; } priv_mark_as_allocated_block(block); @@ -1079,7 +1088,7 @@ typename rbtree_best_fit::block_ctrl * rbtree_best_fit::priv_prev_block (typename rbtree_best_fit::block_ctrl *ptr) { - assert(!ptr->m_prev_allocated); + BOOST_ASSERT(!ptr->m_prev_allocated); return reinterpret_cast (reinterpret_cast(ptr) - ptr->m_prev_size*Alignment); } @@ -1094,7 +1103,7 @@ bool rbtree_best_fit::priv_is_prev_alloc else{ block_ctrl *prev = priv_prev_block(ptr); (void)prev; - assert(!priv_is_allocated_block(prev)); + BOOST_ASSERT(!priv_is_allocated_block(prev)); return false; } } @@ -1104,12 +1113,12 @@ typename rbtree_best_fit::block_ctrl * rbtree_best_fit::priv_end_block (typename rbtree_best_fit::block_ctrl *first_segment_block) { - assert(first_segment_block->m_prev_allocated); + BOOST_ASSERT(first_segment_block->m_prev_allocated); block_ctrl *end_block = reinterpret_cast (reinterpret_cast(first_segment_block) - first_segment_block->m_prev_size*Alignment); (void)end_block; - assert(priv_is_allocated_block(end_block)); - assert(end_block > first_segment_block); + BOOST_ASSERT(priv_is_allocated_block(end_block)); + BOOST_ASSERT(end_block > first_segment_block); return end_block; } @@ -1131,7 +1140,7 @@ bool rbtree_best_fit::priv_is_allocated_ (reinterpret_cast(block) + block->m_size*Alignment); bool next_block_prev_allocated = next_block->m_prev_allocated != 0; (void)next_block_prev_allocated; - assert(allocated == next_block_prev_allocated); + BOOST_ASSERT(allocated == next_block_prev_allocated); return allocated; } @@ -1139,7 +1148,7 @@ template inline void rbtree_best_fit::priv_mark_as_allocated_block (typename rbtree_best_fit::block_ctrl *block) { - //assert(!priv_is_allocated_block(block)); + //BOOST_ASSERT(!priv_is_allocated_block(block)); block->m_allocated = 1; reinterpret_cast (reinterpret_cast(block)+ block->m_size*Alignment)->m_prev_allocated = 1; @@ -1152,7 +1161,7 @@ void rbtree_best_fit::priv_mark_as_free_ block->m_allocated = 0; reinterpret_cast (reinterpret_cast(block) + block->m_size*Alignment)->m_prev_allocated = 0; - //assert(!priv_is_allocated_block(ptr)); + //BOOST_ASSERT(!priv_is_allocated_block(ptr)); priv_next_block(block)->m_prev_size = block->m_size; } @@ -1172,14 +1181,14 @@ void* rbtree_best_fit::priv_check_and_al //the second's size "block->m_size-units" std::size_t block_old_size = block->m_size; block->m_size = nunits; - assert(block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(block->m_size >= BlockCtrlUnits); //This is the remaining block block_ctrl *rem_block = new(reinterpret_cast (reinterpret_cast(block) + Alignment*nunits))block_ctrl; algo_impl_t::assert_alignment(rem_block); rem_block->m_size = block_old_size - nunits; - assert(rem_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits); priv_mark_as_free_block(rem_block); imultiset_iterator it_hint; @@ -1204,7 +1213,7 @@ void* rbtree_best_fit::priv_check_and_al m_header.m_imultiset.erase(it_old); } else{ - assert(0); + BOOST_ASSERT(0); return 0; } //We need block_ctrl for deallocation stuff, so @@ -1218,7 +1227,16 @@ void* rbtree_best_fit::priv_check_and_al //Clear the memory occupied by the tree hook, since this won't be //cleared with zero_free_memory TreeHook *t = static_cast(block); - std::memset(t, 0, sizeof(*t)); + //Just clear the memory part reserved for the user + std::size_t tree_hook_offset_in_block = (char*)t - (char*)block; + //volatile char *ptr = + char *ptr = reinterpret_cast(block)+tree_hook_offset_in_block; + const std::size_t s = BlockCtrlBytes - tree_hook_offset_in_block; + /* + while(s--){ + *ptr++ = 0; + }*/ + std::memset(ptr, 0, s); this->priv_next_block(block)->m_prev_size = 0; return priv_get_user_buffer(block); } @@ -1241,14 +1259,14 @@ void rbtree_best_fit::priv_deallocate(vo block_ctrl *block = priv_get_block(addr); //The blocks must be marked as allocated and the sizes must be equal - assert(priv_is_allocated_block(block)); -// assert(block->m_size == priv_tail_size(block)); + BOOST_ASSERT(priv_is_allocated_block(block)); +// BOOST_ASSERT(block->m_size == priv_tail_size(block)); //Check if alignment and block size are right algo_impl_t::assert_alignment(addr); std::size_t block_old_size = Alignment*block->m_size; - assert(m_header.m_allocated >= block_old_size); + BOOST_ASSERT(m_header.m_allocated >= block_old_size); //Update used memory count m_header.m_allocated -= block_old_size; @@ -1268,13 +1286,13 @@ void rbtree_best_fit::priv_deallocate(vo //Get the previous block block_ctrl *prev_block = priv_prev_block(block); prev_block->m_size += block->m_size; - assert(prev_block->m_size >= BlockCtrlUnits); + BOOST_ASSERT(prev_block->m_size >= BlockCtrlUnits); block_to_insert = prev_block; } //Merge if the next is free if(merge_with_next){ block_to_insert->m_size += next_block->m_size; - assert(block_to_insert->m_size >= BlockCtrlUnits); + BOOST_ASSERT(block_to_insert->m_size >= BlockCtrlUnits); if(merge_with_prev) m_header.m_imultiset.erase(Imultiset::s_iterator_to(*next_block)); } diff --git a/3party/boost/boost/interprocess/offset_ptr.hpp b/3party/boost/boost/interprocess/offset_ptr.hpp index fe1d901355..4efbea086d 100644 --- a/3party/boost/boost/interprocess/offset_ptr.hpp +++ b/3party/boost/boost/interprocess/offset_ptr.hpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -58,21 +60,17 @@ class offset_ptr typedef void (self_t::*unspecified_bool_type)() const; #if defined(_MSC_VER) && (_MSC_VER >= 1400) - __declspec(noinline) //this workaround is needed for msvc-8.0 and msvc-9.0 + __declspec(noinline) //this workaround is needed for msvc > 8.0 #endif - void set_offset(const volatile void *ptr) - { set_offset(const_cast(ptr)); } - - void set_offset(const void *ptr) + void set_offset(const PointedType *ptr) { - const char *p = static_cast(ptr); //offset == 1 && ptr != 0 is not legal for this pointer if(!ptr){ - m_offset = 1; + internal.m_offset = 1; } else{ - m_offset = p - reinterpret_cast(this); - BOOST_ASSERT(m_offset != 1); + internal.m_offset = (const char*)ptr - (const char*)(this); + BOOST_ASSERT(internal.m_offset != 1); } } @@ -80,15 +78,18 @@ class offset_ptr __declspec(noinline) //this workaround is needed for msvc-8.0 and msvc-9.0 #endif void* get_pointer() const - { return (m_offset == 1) ? 0 : (const_cast(reinterpret_cast(this)) + m_offset); } + { return (internal.m_offset == 1) ? 0 : (const_cast(reinterpret_cast(this)) + internal.m_offset); } void inc_offset(std::ptrdiff_t bytes) - { m_offset += bytes; } + { internal.m_offset += bytes; } void dec_offset(std::ptrdiff_t bytes) - { m_offset -= bytes; } + { internal.m_offset -= bytes; } - std::ptrdiff_t m_offset; //Distance between this object and pointed address + union internal_type{ + std::ptrdiff_t m_offset; //Distance between this object and pointed address + PointedType *aliasing_helper; + } internal; /// @endcond public: @@ -151,8 +152,8 @@ class offset_ptr pointer get()const { return static_cast(this->get_pointer()); } - std::ptrdiff_t get_offset() - { return m_offset; } + std::ptrdiff_t get_offset() const + { return internal.m_offset; } //!Pointer-like -> operator. It can return 0 pointer. //!Never throws. @@ -330,7 +331,7 @@ inline void swap (boost::interprocess::offset_ptr &pt, //!Simulation of static_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr - static_pointer_cast(boost::interprocess::offset_ptr const & r) + static_pointer_cast(const boost::interprocess::offset_ptr & r) { return boost::interprocess::offset_ptr (r, boost::interprocess::detail::static_cast_tag()); @@ -339,7 +340,7 @@ inline boost::interprocess::offset_ptr //!Simulation of const_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr - const_pointer_cast(boost::interprocess::offset_ptr const & r) + const_pointer_cast(const boost::interprocess::offset_ptr & r) { return boost::interprocess::offset_ptr (r, boost::interprocess::detail::const_cast_tag()); @@ -348,7 +349,7 @@ inline boost::interprocess::offset_ptr //!Simulation of dynamic_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr - dynamic_pointer_cast(boost::interprocess::offset_ptr const & r) + dynamic_pointer_cast(const boost::interprocess::offset_ptr & r) { return boost::interprocess::offset_ptr (r, boost::interprocess::detail::dynamic_cast_tag()); @@ -357,7 +358,7 @@ inline boost::interprocess::offset_ptr //!Simulation of reinterpret_cast between pointers. Never throws. template inline boost::interprocess::offset_ptr - reinterpret_pointer_cast(boost::interprocess::offset_ptr const & r) + reinterpret_pointer_cast(const boost::interprocess::offset_ptr & r) { return boost::interprocess::offset_ptr (r, boost::interprocess::detail::reinterpret_cast_tag()); @@ -434,7 +435,7 @@ struct pointer_plus_bits, NumBits> static void set_pointer(pointer &n, pointer p) { std::size_t pint = std::size_t(p.get()); - assert(0 == (std::size_t(pint) & Mask)); + BOOST_ASSERT(0 == (std::size_t(pint) & Mask)); n = reinterpret_cast(pint | (std::size_t(n.get()) & std::size_t(Mask))); } @@ -443,7 +444,7 @@ struct pointer_plus_bits, NumBits> static void set_bits(pointer &n, std::size_t b) { - assert(b < (std::size_t(1) << NumBits)); + BOOST_ASSERT(b < (std::size_t(1) << NumBits)); n = reinterpret_cast(std::size_t(get_pointer(n).get()) | (b << 1u)); } }; diff --git a/3party/boost/boost/interprocess/permissions.hpp b/3party/boost/boost/interprocess/permissions.hpp new file mode 100644 index 0000000000..aa88d6145e --- /dev/null +++ b/3party/boost/boost/interprocess/permissions.hpp @@ -0,0 +1,117 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2009. 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/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTERPROCESS_PERMISSIONS_HPP +#define BOOST_INTERPROCESS_PERMISSIONS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +#include + +#endif + +//!\file +//!Describes permissions class + +namespace boost { +namespace interprocess { + +#if defined(BOOST_INTERPROCESS_WINDOWS) + +namespace detail { + +template +struct unrestricted_permissions_holder +{ + static winapi::interprocess_all_access_security unrestricted; +}; + +template +winapi::interprocess_all_access_security unrestricted_permissions_holder::unrestricted; + +} //namespace detail { + +#endif //defined BOOST_INTERPROCESS_WINDOWS + +//!The permissions class represents permissions to be set to shared memory or +//!files, that can be constructed form usual permission representations: +//!a SECURITY_ATTRIBUTES pointer in windows or ORed rwx chmod integer in UNIX. +class permissions +{ + /// @cond + #if defined (BOOST_INTERPROCESS_WINDOWS) + typedef void* os_permissions_type; + #else + typedef int os_permissions_type; + #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) + os_permissions_type m_perm; + /// @endcond + + public: + //!Constructs a permissions object from a user provided os-dependent + //!permissions. + permissions(os_permissions_type type) + : m_perm(type) + {} + + //!Constructs a default permissions object: + //!A null security attributes pointer for windows or 0644 + //!for UNIX. + permissions() + { set_default(); } + + //!Sets permissions to default values: + //!A null security attributes pointer for windows or 0644 + //!for UNIX. + void set_default() + { + #if (defined BOOST_INTERPROCESS_WINDOWS) + m_perm = 0; + #else + m_perm = 0644; + #endif + } + + //!Sets permissions to unrestricted access: + //!A null DACL for windows or 0666 for UNIX. + void set_unrestricted() + { + #if (defined BOOST_INTERPROCESS_WINDOWS) + m_perm = &detail::unrestricted_permissions_holder<0>::unrestricted; + #else + m_perm = 0666; + #endif + } + + //!Sets permissions from a user provided os-dependent + //!permissions. + void set_permissions(os_permissions_type perm) + { m_perm = perm; } + + //!Returns stored os-dependent + //!permissions + os_permissions_type get_permissions() const + { return m_perm; } +}; + +} //namespace interprocess { +} //namespace boost { + +#include + +#endif //BOOST_INTERPROCESS_PERMISSIONS_HPP diff --git a/3party/boost/boost/interprocess/segment_manager.hpp b/3party/boost/boost/interprocess/segment_manager.hpp index f35a66f19f..5474b0b0ca 100644 --- a/3party/boost/boost/interprocess/segment_manager.hpp +++ b/3party/boost/boost/interprocess/segment_manager.hpp @@ -38,6 +38,7 @@ #include //char_traits #include //std::nothrow #include //std::pair +#include #ifndef BOOST_NO_EXCEPTIONS #include #endif @@ -94,7 +95,7 @@ class segment_manager_base segment_manager_base(std::size_t size, std::size_t reserved_bytes) : MemoryAlgorithm(size, reserved_bytes) { - assert((sizeof(segment_manager_base) == sizeof(MemoryAlgorithm))); + BOOST_ASSERT((sizeof(segment_manager_base) == sizeof(MemoryAlgorithm))); } //!Returns the size of the memory @@ -300,7 +301,7 @@ class segment_manager_base if(ctrl_data->alloc_type() != anonymous_type){ //This is not an anonymous object, the pointer is wrong! - assert(0); + BOOST_ASSERT(0); } //Call destructors and free memory @@ -407,7 +408,7 @@ class segment_manager , m_header(static_cast(get_this_pointer())) { (void) anonymous_instance; (void) unique_instance; - assert(static_cast(this) == static_cast(static_cast(this))); + BOOST_ASSERT(static_cast(this) == static_cast(static_cast(this))); } //!Tries to find a previous named allocation. Returns the address @@ -499,6 +500,24 @@ class segment_manager void atomic_func(Func &f) { scoped_lock guard(m_header); f(); } + //!Tries to calls a functor guaranteeing that no new construction, search or + //!destruction will be executed by any process while executing the object + //!function call. If the atomic function can't be immediatelly executed + //!because the internal mutex is already locked, returns false. + //!If the functor throws, this function throws. + template + bool try_atomic_func(Func &f) + { + scoped_lock guard(m_header, try_to_lock); + if(guard){ + f(); + return true; + } + else{ + return false; + } + } + //!Destroys a previously created unique instance. //!Returns false if the object was not present. template @@ -692,7 +711,7 @@ class segment_manager std::pair priv_find_impl (const CharType* name, bool lock) { //The name can't be null, no anonymous object can be found by name - assert(name != 0); + BOOST_ASSERT(name != 0); detail::placement_destroy table; std::size_t size; void *ret; @@ -766,7 +785,7 @@ class segment_manager default: //This type is unknown, bad pointer passed to this function! - assert(0); + BOOST_ASSERT(0); break; } } @@ -777,22 +796,22 @@ class segment_manager { boost::interprocess::allocation_type type = ctrl_data->alloc_type(); if(type != named_type){ - assert((type == anonymous_type && ctrl_data->m_num_char == 0) || + BOOST_ASSERT((type == anonymous_type && ctrl_data->m_num_char == 0) || (type == unique_type && ctrl_data->m_num_char != 0) ); return 0; } CharType *name = static_cast(ctrl_data->template name()); //Sanity checks - assert(ctrl_data->sizeof_char() == sizeof(CharType)); - assert(ctrl_data->m_num_char == std::char_traits::length(name)); + BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharType)); + BOOST_ASSERT(ctrl_data->m_num_char == std::char_traits::length(name)); return name; } static std::size_t priv_get_instance_length(block_header_t *ctrl_data, std::size_t sizeofvalue) { //Get header - assert((ctrl_data->value_bytes() %sizeofvalue) == 0); + BOOST_ASSERT((ctrl_data->value_bytes() %sizeofvalue) == 0); return ctrl_data->value_bytes()/sizeofvalue; } @@ -801,7 +820,7 @@ class segment_manager static instance_type priv_get_instance_type(block_header_t *ctrl_data) { //Get header - assert((instance_type)ctrl_data->alloc_type() < max_allocation_type); + BOOST_ASSERT((instance_type)ctrl_data->alloc_type() < max_allocation_type); return (instance_type)ctrl_data->alloc_type(); } @@ -844,8 +863,8 @@ class segment_manager block_header_t *ctrl_data = it->get_block_header(); //Sanity check - assert((ctrl_data->m_value_bytes % table.size) == 0); - assert(ctrl_data->sizeof_char() == sizeof(CharT)); + BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); + BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharT)); ret_ptr = ctrl_data->value(); length = ctrl_data->m_value_bytes/table.size; } @@ -883,8 +902,8 @@ class segment_manager (detail::get_pointer(it->second.m_ptr)); //Sanity check - assert((ctrl_data->m_value_bytes % table.size) == 0); - assert(ctrl_data->sizeof_char() == sizeof(CharT)); + BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); + BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharT)); ret_ptr = ctrl_data->value(); length = ctrl_data->m_value_bytes/table.size; } @@ -940,7 +959,7 @@ class segment_manager //If not found, return false if(it == index.end()){ //This name is not present in the index, wrong pointer or name! - //assert(0); + //BOOST_ASSERT(0); return false; } @@ -951,8 +970,8 @@ class segment_manager std::size_t num = ctrl_data->m_value_bytes/table.size; //Sanity check - assert((ctrl_data->m_value_bytes % table.size) == 0); - assert(sizeof(CharT) == ctrl_data->sizeof_char()); + BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); + BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char()); //Erase node from index index.erase(it); @@ -989,7 +1008,7 @@ class segment_manager //If not found, return false if(it == index.end()){ //This name is not present in the index, wrong pointer or name! - //assert(0); + //BOOST_ASSERT(0); return false; } return this->priv_generic_named_destroy_impl(it, index, table); @@ -1016,9 +1035,9 @@ class segment_manager void *values = ctrl_data->value(); //Sanity check - assert((ctrl_data->m_value_bytes % table.size) == 0); - assert(static_cast(stored_name) == static_cast(ctrl_data->template name())); - assert(sizeof(CharT) == ctrl_data->sizeof_char()); + BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0); + BOOST_ASSERT(static_cast(stored_name) == static_cast(ctrl_data->template name())); + BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char()); //Erase node from index index.erase(it); diff --git a/3party/boost/boost/interprocess/shared_memory_object.hpp b/3party/boost/boost/interprocess/shared_memory_object.hpp index bb8de43e2d..b7560e3e0c 100644 --- a/3party/boost/boost/interprocess/shared_memory_object.hpp +++ b/3party/boost/boost/interprocess/shared_memory_object.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,11 @@ # include //shm_xxx # include //ftruncate, close # include //mode_t, S_IRWXG, S_IRWXO, S_IRWXU, +# if defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) +# if defined(__FreeBSD__) +# include +# endif +# endif #else // #endif @@ -56,19 +62,19 @@ class shared_memory_object //!Creates a shared memory object with name "name" and mode "mode", with the access mode "mode" //!If the file previously exists, throws an error.*/ - shared_memory_object(create_only_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoCreate, name, mode); } + shared_memory_object(create_only_t, const char *name, mode_t mode, const permissions &perm = permissions()) + { this->priv_open_or_create(detail::DoCreate, name, mode, perm); } //!Tries to create a shared memory object with name "name" and mode "mode", with the //!access mode "mode". If the file previously exists, it tries to open it with mode "mode". //!Otherwise throws an error. - shared_memory_object(open_or_create_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode); } + shared_memory_object(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) + { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode, perm); } //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. shared_memory_object(open_only_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoOpen, name, mode); } + { this->priv_open_or_create(detail::DoOpen, name, mode, permissions()); } //!Moves the ownership of "moved"'s shared memory object to *this. //!After the call, "moved" does not represent any shared memory object. @@ -126,7 +132,7 @@ class shared_memory_object void priv_close(); //!Closes a previously opened file mapping. Never throws. - bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode); + bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm); file_handle_t m_handle; mode_t m_mode; @@ -168,11 +174,11 @@ inline mode_t shared_memory_object::get_mode() const #if !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) inline bool shared_memory_object::priv_open_or_create - (detail::create_enum_t type, const char *filename, mode_t mode) + (detail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm) { m_filename = filename; std::string shmfile; - detail::create_tmp_dir_and_get_filename(filename, shmfile); + detail::create_tmp_and_clean_old_and_get_filename(filename, shmfile); //Set accesses if (mode != read_write && mode != read_only){ @@ -185,10 +191,10 @@ inline bool shared_memory_object::priv_open_or_create m_handle = detail::open_existing_file(shmfile.c_str(), mode, true); break; case detail::DoCreate: - m_handle = detail::create_new_file(shmfile.c_str(), mode, true); + m_handle = detail::create_new_file(shmfile.c_str(), mode, perm, true); break; case detail::DoOpenOrCreate: - m_handle = detail::create_or_open_file(shmfile.c_str(), mode, true); + m_handle = detail::create_or_open_file(shmfile.c_str(), mode, perm, true); break; default: { @@ -214,7 +220,7 @@ inline bool shared_memory_object::remove(const char *filename) //Make sure a temporary path is created for shared memory std::string shmfile; detail::tmp_filename(filename, shmfile); - return detail::delete_file(shmfile.c_str()) == 0; + return detail::delete_file(shmfile.c_str()); } catch(...){ return false; @@ -239,16 +245,46 @@ inline void shared_memory_object::priv_close() #else //!defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS) +namespace shared_memory_object_detail { + +#ifdef BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY + +#if defined(__FreeBSD__) + +inline bool use_filesistem_based_posix() +{ + int jailed = 0; + std::size_t len = sizeof(jailed); + ::sysctlbyname("security.jail.jailed", &jailed, &len, NULL, 0); + return jailed != 0; +} + +#else +#error "Not supported platform for BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY" +#endif + +#endif + +} //shared_memory_object_detail + inline bool shared_memory_object::priv_open_or_create (detail::create_enum_t type, const char *filename, - mode_t mode) + mode_t mode, const permissions &perm) { - #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY - detail::add_leading_slash(filename, m_filename); + #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) + const bool add_leading_slash = false; + #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) + const bool add_leading_slash = !shared_memory_object_detail::use_filesistem_based_posix(); #else - detail::create_tmp_dir_and_get_filename(filename, m_filename); + const bool add_leading_slash = true; #endif + if(add_leading_slash){ + detail::add_leading_slash(filename, m_filename); + } + else{ + detail::create_tmp_and_clean_old_and_get_filename(filename, m_filename); + } //Create new mapping int oflag = 0; @@ -281,7 +317,11 @@ inline bool shared_memory_object::priv_open_or_create } //Open file using POSIX API - m_handle = shm_open(m_filename.c_str(), oflag, S_IRWXO | S_IRWXG | S_IRWXU); + m_handle = shm_open(m_filename.c_str(), oflag, perm.get_permissions()); + + if(m_handle >= 0){ + ::fchmod(m_handle, perm.get_permissions()); + } //Check for error if(m_handle == -1){ @@ -299,11 +339,19 @@ inline bool shared_memory_object::remove(const char *filename) { try{ std::string file_str; - #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY - detail::add_leading_slash(filename, file_str); + #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) + const bool add_leading_slash = false; + #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY) + const bool add_leading_slash = !shared_memory_object_detail::use_filesistem_based_posix(); #else - detail::tmp_filename(filename, file_str); + const bool add_leading_slash = true; #endif + if(add_leading_slash){ + detail::add_leading_slash(filename, file_str); + } + else{ + detail::tmp_filename(filename, file_str); + } return 0 == shm_unlink(file_str.c_str()); } catch(...){ diff --git a/3party/boost/boost/interprocess/smart_ptr/shared_ptr.hpp b/3party/boost/boost/interprocess/smart_ptr/shared_ptr.hpp index 34d10b8119..9f6ef23152 100644 --- a/3party/boost/boost/interprocess/smart_ptr/shared_ptr.hpp +++ b/3party/boost/boost/interprocess/smart_ptr/shared_ptr.hpp @@ -108,7 +108,7 @@ class shared_ptr typedef typename boost::pointer_to_other ::type const_allocator_pointer; - BOOST_COPYABLE_AND_MOVABLE(shared_ptr) + BOOST_INTERPROCESS_COPYABLE_AND_MOVABLE(shared_ptr) public: //!Constructs an empty shared_ptr. diff --git a/3party/boost/boost/interprocess/streams/bufferstream.hpp b/3party/boost/boost/interprocess/streams/bufferstream.hpp index 32ba3fe312..a04184af53 100644 --- a/3party/boost/boost/interprocess/streams/bufferstream.hpp +++ b/3party/boost/boost/interprocess/streams/bufferstream.hpp @@ -44,7 +44,7 @@ #include #include // char traits #include // ptrdiff_t -#include +#include #include namespace boost { namespace interprocess { diff --git a/3party/boost/boost/interprocess/streams/vectorstream.hpp b/3party/boost/boost/interprocess/streams/vectorstream.hpp index f7383cd32b..fa16c8ae72 100644 --- a/3party/boost/boost/interprocess/streams/vectorstream.hpp +++ b/3party/boost/boost/interprocess/streams/vectorstream.hpp @@ -46,7 +46,7 @@ #include // char traits #include // ptrdiff_t #include -#include +#include namespace boost { namespace interprocess { @@ -186,7 +186,7 @@ class basic_vectorbuf int real_size = (int)m_vect.size(); //Then maximize size for high watermarking m_vect.resize(m_vect.capacity()); - assert(m_vect.size() == m_vect.capacity()); + BOOST_ASSERT(m_vect.size() == m_vect.capacity()); //Set high watermarking with the expanded size mp_high_water = m_vect.size() ? (&m_vect[0] + real_size) : 0; //Now set formatting pointers @@ -263,7 +263,7 @@ class basic_vectorbuf //Insert the new data m_vect.push_back(CharTraits::to_char_type(c)); m_vect.resize(m_vect.capacity()); - assert(m_vect.size() == m_vect.capacity()); + BOOST_ASSERT(m_vect.size() == m_vect.capacity()); char_type* p = const_cast(&m_vect[0]); //A reallocation might have happened, update pointers base_t::setp(p, p + (dif_t)m_vect.size()); @@ -367,7 +367,10 @@ class basic_vectorbuf //!boost::interprocess::basic_string template class basic_ivectorstream - : public std::basic_istream + /// @cond + : private basic_vectorbuf + /// @endcond + , public std::basic_istream { public: typedef CharVector vector_type; @@ -380,25 +383,27 @@ class basic_ivectorstream /// @cond private: - typedef std::basic_ios basic_ios_t; - typedef std::basic_istream base_t; + typedef basic_vectorbuf vectorbuf_t; + typedef std::basic_istream base_t; + + vectorbuf_t & m_buf() { return *this; } + const vectorbuf_t & m_buf() const{ return *this; } /// @endcond public: //!Constructor. Throws if vector_type default //!constructor throws. basic_ivectorstream(std::ios_base::openmode mode = std::ios_base::in) - : basic_ios_t(), base_t(0), m_buf(mode | std::ios_base::in) - { basic_ios_t::init(&m_buf); } + : vectorbuf_t(mode | std::ios_base::in), base_t(&m_buf()) + {} //!Constructor. Throws if vector_type(const VectorParameter ¶m) //!throws. template basic_ivectorstream(const VectorParameter ¶m, std::ios_base::openmode mode = std::ios_base::in) - : basic_ios_t(), base_t(0), - m_buf(param, mode | std::ios_base::in) - { basic_ios_t::init(&m_buf); } + : vectorbuf_t(param, mode | std::ios_base::in), base_t(&m_buf()) + {} ~basic_ivectorstream(){}; @@ -406,34 +411,29 @@ class basic_ivectorstream //!Returns the address of the stored //!stream buffer. basic_vectorbuf* rdbuf() const - { return const_cast*>(&m_buf); } + { return const_cast*>(&m_buf()); } //!Swaps the underlying vector with the passed vector. //!This function resets the read position in the stream. //!Does not throw. void swap_vector(vector_type &vect) - { m_buf.swap_vector(vect); } + { m_buf().swap_vector(vect); } //!Returns a const reference to the internal vector. //!Does not throw. const vector_type &vector() const - { return m_buf.vector(); } + { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. void reserve(typename vector_type::size_type size) - { m_buf.reserve(size); } + { m_buf().reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. void clear() - { m_buf.clear(); } - - /// @cond - private: - basic_vectorbuf m_buf; - /// @endcond + { m_buf().clear(); } }; //!A basic_ostream class that holds a character vector specified by CharVector @@ -442,7 +442,10 @@ class basic_ivectorstream //!boost::interprocess::basic_string template class basic_ovectorstream - : public std::basic_ostream + /// @cond + : private basic_vectorbuf + /// @endcond + , public std::basic_ostream { public: typedef CharVector vector_type; @@ -455,24 +458,27 @@ class basic_ovectorstream /// @cond private: - typedef std::basic_ios basic_ios_t; + typedef basic_vectorbuf vectorbuf_t; typedef std::basic_ostream base_t; + + vectorbuf_t & m_buf() { return *this; } + const vectorbuf_t & m_buf()const { return *this; } /// @endcond public: //!Constructor. Throws if vector_type default //!constructor throws. basic_ovectorstream(std::ios_base::openmode mode = std::ios_base::out) - : basic_ios_t(), base_t(0), m_buf(mode | std::ios_base::out) - { basic_ios_t::init(&m_buf); } + : vectorbuf_t(mode | std::ios_base::out), base_t(&m_buf()) + {} //!Constructor. Throws if vector_type(const VectorParameter ¶m) //!throws. template basic_ovectorstream(const VectorParameter ¶m, std::ios_base::openmode mode = std::ios_base::out) - : basic_ios_t(), base_t(0), m_buf(param, mode | std::ios_base::out) - { basic_ios_t::init(&m_buf); } + : vectorbuf_t(param, mode | std::ios_base::out), base_t(&m_buf()) + {} ~basic_ovectorstream(){} @@ -480,29 +486,24 @@ class basic_ovectorstream //!Returns the address of the stored //!stream buffer. basic_vectorbuf* rdbuf() const - { return const_cast*>(&m_buf); } + { return const_cast*>(&m_buf()); } //!Swaps the underlying vector with the passed vector. //!This function resets the write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) - { m_buf.swap_vector(vect); } + { m_buf().swap_vector(vect); } //!Returns a const reference to the internal vector. //!Does not throw. const vector_type &vector() const - { return m_buf.vector(); } + { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. void reserve(typename vector_type::size_type size) - { m_buf.reserve(size); } - - /// @cond - private: - basic_vectorbuf m_buf; - /// @endcond + { m_buf().reserve(size); } }; diff --git a/3party/boost/boost/interprocess/sync/emulation/interprocess_condition.hpp b/3party/boost/boost/interprocess/sync/emulation/interprocess_condition.hpp index 6fd629d1b9..592b71cde6 100644 --- a/3party/boost/boost/interprocess/sync/emulation/interprocess_condition.hpp +++ b/3party/boost/boost/interprocess/sync/emulation/interprocess_condition.hpp @@ -155,28 +155,6 @@ inline bool interprocess_condition::do_timed_wait(bool tout_enabled, break; } else{ - //Notification occurred, we will lock the checking interprocess_mutex so that - //if a notify_one notification occurs, only one thread can exit - //--------------------------------------------------------------- - /* - InternalLock lock; - if(tout_enabled){ - InternalLock dummy(m_check_mut, abs_time); - lock = boost::interprocess::move(dummy); - } - else{ - InternalLock dummy(m_check_mut); - lock = boost::interprocess::move(dummy); - } - if(!lock){ - timed_out = true; - unlock_enter_mut = true; - detail::atomic_dec32(const_cast(&m_num_waiters)); - break; - } - //--------------------------------------------------------------- - */ - //InternalLock lock(m_check_mut); boost::uint32_t result = detail::atomic_cas32 (const_cast(&m_command), SLEEP, NOTIFY_ONE); if(result == SLEEP){ diff --git a/3party/boost/boost/interprocess/sync/emulation/interprocess_mutex.hpp b/3party/boost/boost/interprocess/sync/emulation/mutex.hpp similarity index 58% rename from 3party/boost/boost/interprocess/sync/emulation/interprocess_mutex.hpp rename to 3party/boost/boost/interprocess/sync/emulation/mutex.hpp index 5d4230472d..029b31e3f5 100644 --- a/3party/boost/boost/interprocess/sync/emulation/interprocess_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/emulation/mutex.hpp @@ -8,13 +8,44 @@ // ////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_DETAIL_EMULATION_MUTEX_HPP +#define BOOST_INTERPROCESS_DETAIL_EMULATION_MUTEX_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include #include +#include +#include +#include +#include namespace boost { - namespace interprocess { +namespace detail { -inline interprocess_mutex::interprocess_mutex() +class emulation_mutex +{ + emulation_mutex(const emulation_mutex &); + emulation_mutex &operator=(const emulation_mutex &); + public: + + emulation_mutex(); + ~emulation_mutex(); + + void lock(); + bool try_lock(); + bool timed_lock(const boost::posix_time::ptime &abs_time); + void unlock(); + void take_ownership(){}; + private: + volatile boost::uint32_t m_s; +}; + +inline emulation_mutex::emulation_mutex() : m_s(0) { //Note that this class is initialized to zero. @@ -22,12 +53,12 @@ inline interprocess_mutex::interprocess_mutex() //initialized mutex } -inline interprocess_mutex::~interprocess_mutex() +inline emulation_mutex::~emulation_mutex() { //Trivial destructor } -inline void interprocess_mutex::lock(void) +inline void emulation_mutex::lock(void) { do{ boost::uint32_t prev_s = detail::atomic_cas32(const_cast(&m_s), 1, 0); @@ -40,13 +71,13 @@ inline void interprocess_mutex::lock(void) }while (true); } -inline bool interprocess_mutex::try_lock(void) +inline bool emulation_mutex::try_lock(void) { boost::uint32_t prev_s = detail::atomic_cas32(const_cast(&m_s), 1, 0); return m_s == 1 && prev_s == 0; } -inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time) +inline bool emulation_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { if(abs_time == boost::posix_time::pos_infin){ this->lock(); @@ -73,9 +104,11 @@ inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_t return true; } -inline void interprocess_mutex::unlock(void) +inline void emulation_mutex::unlock(void) { detail::atomic_cas32(const_cast(&m_s), 0, 1); } +} //namespace detail { } //namespace interprocess { - } //namespace boost { + +#endif //BOOST_INTERPROCESS_DETAIL_EMULATION_MUTEX_HPP diff --git a/3party/boost/boost/interprocess/sync/emulation/interprocess_recursive_mutex.hpp b/3party/boost/boost/interprocess/sync/emulation/recursive_mutex.hpp similarity index 63% rename from 3party/boost/boost/interprocess/sync/emulation/interprocess_recursive_mutex.hpp rename to 3party/boost/boost/interprocess/sync/emulation/recursive_mutex.hpp index 79f21a87d0..d29a873ab1 100644 --- a/3party/boost/boost/interprocess/sync/emulation/interprocess_recursive_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/emulation/recursive_mutex.hpp @@ -24,20 +24,49 @@ // It is provided "as is" without express or implied warranty. ////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTERPROCESS_DETAIL_EMULATION_RECURSIVE_MUTEX_HPP +#define BOOST_INTERPROCESS_DETAIL_EMULATION_RECURSIVE_MUTEX_HPP + #include #include #include +#include +#include +#include +#include +#include namespace boost { - namespace interprocess { +namespace detail { -inline interprocess_recursive_mutex::interprocess_recursive_mutex() +class emulation_recursive_mutex +{ + emulation_recursive_mutex(const emulation_recursive_mutex &); + emulation_recursive_mutex &operator=(const emulation_recursive_mutex &); + public: + + emulation_recursive_mutex(); + ~emulation_recursive_mutex(); + + void lock(); + bool try_lock(); + bool timed_lock(const boost::posix_time::ptime &abs_time); + void unlock(); + void take_ownership(); + private: + emulation_mutex m_mutex; + unsigned int m_nLockCount; + volatile detail::OS_systemwide_thread_id_t m_nOwner; + volatile boost::uint32_t m_s; +}; + +inline emulation_recursive_mutex::emulation_recursive_mutex() : m_nLockCount(0), m_nOwner(detail::get_invalid_systemwide_thread_id()){} -inline interprocess_recursive_mutex::~interprocess_recursive_mutex(){} +inline emulation_recursive_mutex::~emulation_recursive_mutex(){} -inline void interprocess_recursive_mutex::lock() +inline void emulation_recursive_mutex::lock() { typedef detail::OS_systemwide_thread_id_t handle_t; const handle_t thr_id(detail::get_current_systemwide_thread_id()); @@ -46,7 +75,7 @@ inline void interprocess_recursive_mutex::lock() if(detail::equal_systemwide_thread_id(thr_id , old_id)){ if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception - throw interprocess_exception(); + throw interprocess_exception("boost::interprocess::emulation_recursive_mutex recursive lock overflow"); } ++m_nLockCount; } @@ -57,7 +86,7 @@ inline void interprocess_recursive_mutex::lock() } } -inline bool interprocess_recursive_mutex::try_lock() +inline bool emulation_recursive_mutex::try_lock() { typedef detail::OS_systemwide_thread_id_t handle_t; handle_t thr_id(detail::get_current_systemwide_thread_id()); @@ -66,7 +95,7 @@ inline bool interprocess_recursive_mutex::try_lock() if(detail::equal_systemwide_thread_id(thr_id , old_id)) { // we own it if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception - throw interprocess_exception(); + throw interprocess_exception("boost::interprocess::emulation_recursive_mutex recursive lock overflow"); } ++m_nLockCount; return true; @@ -79,7 +108,7 @@ inline bool interprocess_recursive_mutex::try_lock() return false; } -inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time) +inline bool emulation_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { typedef detail::OS_systemwide_thread_id_t handle_t; if(abs_time == boost::posix_time::pos_infin){ @@ -92,7 +121,7 @@ inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::pt if(detail::equal_systemwide_thread_id(thr_id , old_id)) { // we own it if((unsigned int)(m_nLockCount+1) == 0){ //Overflow, throw an exception - throw interprocess_exception(); + throw interprocess_exception("boost::interprocess::emulation_recursive_mutex recursive lock overflow"); } ++m_nLockCount; return true; @@ -105,7 +134,7 @@ inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::pt return false; } -inline void interprocess_recursive_mutex::unlock() +inline void emulation_recursive_mutex::unlock() { typedef detail::OS_systemwide_thread_id_t handle_t; handle_t old_id; @@ -113,7 +142,7 @@ inline void interprocess_recursive_mutex::unlock() const handle_t thr_id(detail::get_current_systemwide_thread_id()); (void)old_id; (void)thr_id; - assert(detail::equal_systemwide_thread_id(thr_id, old_id)); + BOOST_ASSERT(detail::equal_systemwide_thread_id(thr_id, old_id)); --m_nLockCount; if(!m_nLockCount){ const handle_t new_id(detail::get_invalid_systemwide_thread_id()); @@ -122,7 +151,17 @@ inline void interprocess_recursive_mutex::unlock() } } -} //namespace interprocess { +inline void emulation_recursive_mutex::take_ownership() +{ + typedef detail::OS_systemwide_thread_id_t handle_t; + this->m_nLockCount = 1; + const handle_t thr_id(detail::get_current_systemwide_thread_id()); + detail::systemwide_thread_id_copy + (thr_id, m_nOwner); +} +} //namespace detail { +} //namespace interprocess { } //namespace boost { +#endif //BOOST_INTERPROCESS_DETAIL_EMULATION_RECURSIVE_MUTEX_HPP diff --git a/3party/boost/boost/interprocess/sync/file_lock.hpp b/3party/boost/boost/interprocess/sync/file_lock.hpp index 338eccb0e1..30b91c1246 100644 --- a/3party/boost/boost/interprocess/sync/file_lock.hpp +++ b/3party/boost/boost/interprocess/sync/file_lock.hpp @@ -201,7 +201,7 @@ class file_lock inline file_lock::file_lock(const char *name) { - m_file_hnd = detail::open_existing_file(name); + m_file_hnd = detail::open_existing_file(name, read_write); if(m_file_hnd == detail::invalid_file()){ error_info err(system_error_code()); diff --git a/3party/boost/boost/interprocess/sync/interprocess_condition.hpp b/3party/boost/boost/interprocess/sync/interprocess_condition.hpp index 74a3336542..5e909a94e7 100644 --- a/3party/boost/boost/interprocess/sync/interprocess_condition.hpp +++ b/3party/boost/boost/interprocess/sync/interprocess_condition.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) #include @@ -148,8 +148,8 @@ class interprocess_condition #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) enum { SLEEP = 0, NOTIFY_ONE, NOTIFY_ALL }; - interprocess_mutex m_enter_mut; - //interprocess_mutex m_check_mut; + interprocess_mutex m_enter_mut; + //interprocess_mutex m_check_mut; volatile boost::uint32_t m_command; volatile boost::uint32_t m_num_waiters; bool do_timed_wait(bool tout_enabled, const boost::posix_time::ptime &abs_time, interprocess_mutex &mut); diff --git a/3party/boost/boost/interprocess/sync/interprocess_mutex.hpp b/3party/boost/boost/interprocess/sync/interprocess_mutex.hpp index a274012575..867dd2ae1d 100644 --- a/3party/boost/boost/interprocess/sync/interprocess_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/interprocess_mutex.hpp @@ -11,18 +11,6 @@ // Parts of the pthread code come from Boost Threads code. // ////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2001-2003 -// William E. Kempf -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. William E. Kempf makes no representations -// about the suitability of this software for any purpose. -// It is provided "as is" without express or implied warranty. -////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_MUTEX_HPP #define BOOST_INTERPROCESS_MUTEX_HPP @@ -36,7 +24,7 @@ #include #include #include -#include +#include #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && defined (BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) #include @@ -44,10 +32,19 @@ #include #define BOOST_INTERPROCESS_USE_POSIX #else - #include - #include - #include + #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION + +namespace boost { +namespace interprocess { +namespace detail{ +namespace robust_emulation_helpers { + +template +class mutex_traits; + +}}}} + #endif /// @endcond @@ -111,7 +108,9 @@ class interprocess_mutex private: #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) - volatile boost::uint32_t m_s; + friend class detail::robust_emulation_helpers::mutex_traits; + void take_ownership(){ mutex.take_ownership(); } + detail::emulation_mutex mutex; #elif defined(BOOST_INTERPROCESS_USE_POSIX) pthread_mutex_t m_mut; #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) @@ -119,17 +118,29 @@ class interprocess_mutex }; } //namespace interprocess { - } //namespace boost { #ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION -# include + +namespace boost { +namespace interprocess { + +inline interprocess_mutex::interprocess_mutex(){} +inline interprocess_mutex::~interprocess_mutex(){} +inline void interprocess_mutex::lock(){ mutex.lock(); } +inline bool interprocess_mutex::try_lock(){ return mutex.try_lock(); } +inline bool interprocess_mutex::timed_lock(const boost::posix_time::ptime &abs_time){ return mutex.timed_lock(abs_time); } +inline void interprocess_mutex::unlock(){ mutex.unlock(); } + +} //namespace interprocess { +} //namespace boost { + #endif #ifdef BOOST_INTERPROCESS_USE_POSIX +#include # undef BOOST_INTERPROCESS_USE_POSIX -# include #endif #include diff --git a/3party/boost/boost/interprocess/sync/interprocess_recursive_mutex.hpp b/3party/boost/boost/interprocess/sync/interprocess_recursive_mutex.hpp index 0be829df10..818cc2cf7a 100644 --- a/3party/boost/boost/interprocess/sync/interprocess_recursive_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/interprocess_recursive_mutex.hpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \ (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined (BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES)) @@ -45,20 +45,29 @@ #include #define BOOST_INTERPROCESS_USE_POSIX #else - #include - #include - #include - #include + #include #define BOOST_INTERPROCESS_USE_GENERIC_EMULATION #endif +#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) +namespace boost { +namespace interprocess { +namespace detail{ +namespace robust_emulation_helpers { + +template +class mutex_traits; + +}}}} + +#endif + /// @endcond //!\file //!Describes interprocess_recursive_mutex and shared_recursive_try_mutex classes namespace boost { - namespace interprocess { //!Wraps a interprocess_mutex that can be placed in shared memory and can be @@ -86,13 +95,13 @@ class interprocess_recursive_mutex //! mutex must be unlocked by the same mutex. The mutex must be unlocked //! the same number of times it is locked. //!Throws: interprocess_exception on error. - void lock(void); + void lock(); //!Tries to lock the interprocess_mutex, returns false when interprocess_mutex //!is already locked, returns true when success. The mutex must be unlocked //!the same number of times it is locked. //!Throws: interprocess_exception if a severe error is found - bool try_lock(void); + bool try_lock(); //!Tries to lock the interprocess_mutex, if interprocess_mutex can't be locked before //!abs_time time, returns false. The mutex must be unlocked @@ -104,13 +113,14 @@ class interprocess_recursive_mutex //! If the mutex supports recursive locking, the mutex must be unlocked the //! same number of times it is locked. //!Throws: interprocess_exception on error. - void unlock(void); + void unlock(); /// @cond private: + #if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) - interprocess_mutex m_mutex; - unsigned int m_nLockCount; - volatile detail::OS_systemwide_thread_id_t m_nOwner; + void take_ownership(){ mutex.take_ownership(); } + friend class detail::robust_emulation_helpers::mutex_traits; + detail::emulation_recursive_mutex mutex; #else //#if defined (BOOST_INTERPROCESS_USE_GENERIC_EMULATION) pthread_mutex_t m_mut; #endif //#if (defined BOOST_INTERPROCESS_WINDOWS) @@ -118,17 +128,29 @@ class interprocess_recursive_mutex }; } //namespace interprocess { - } //namespace boost { #ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION -# include + +namespace boost { +namespace interprocess { + +inline interprocess_recursive_mutex::interprocess_recursive_mutex(){} +inline interprocess_recursive_mutex::~interprocess_recursive_mutex(){} +inline void interprocess_recursive_mutex::lock(){ mutex.lock(); } +inline bool interprocess_recursive_mutex::try_lock(){ return mutex.try_lock(); } +inline bool interprocess_recursive_mutex::timed_lock(const boost::posix_time::ptime &abs_time){ return mutex.timed_lock(abs_time); } +inline void interprocess_recursive_mutex::unlock(){ mutex.unlock(); } + +} //namespace interprocess { +} //namespace boost { + #endif #ifdef BOOST_INTERPROCESS_USE_POSIX # undef BOOST_INTERPROCESS_USE_POSIX -# include +#include #endif #include diff --git a/3party/boost/boost/interprocess/sync/named_condition.hpp b/3party/boost/boost/interprocess/sync/named_condition.hpp index 881d791296..a38d4181c7 100644 --- a/3party/boost/boost/interprocess/sync/named_condition.hpp +++ b/3party/boost/boost/interprocess/sync/named_condition.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #if defined BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES #include #include @@ -57,7 +58,7 @@ class named_condition public: //!Creates a global condition with a name. //!If the condition can't be created throws interprocess_exception - named_condition(create_only_t create_only, const char *name); + named_condition(create_only_t create_only, const char *name, const permissions &perm = permissions()); //!Opens or creates a global condition with a name. //!If the condition is created, this call is equivalent to @@ -65,7 +66,7 @@ class named_condition //!If the condition is already created, this call is equivalent //!named_condition(open_only_t, ... ) //!Does not throw - named_condition(open_or_create_t open_or_create, const char *name); + named_condition(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); //!Opens a global condition with a name if that condition is previously //!created. If it is not previously created this function throws @@ -199,7 +200,7 @@ class named_condition inline named_condition::~named_condition() {} -inline named_condition::named_condition(create_only_t, const char *name) +inline named_condition::named_condition(create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name ,sizeof(condition_holder) + @@ -207,10 +208,11 @@ inline named_condition::named_condition(create_only_t, const char *name) ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoCreate)) + ,construct_func_t(detail::DoCreate) + ,perm) {} -inline named_condition::named_condition(open_or_create_t, const char *name) +inline named_condition::named_condition(open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name ,sizeof(condition_holder) + @@ -218,7 +220,8 @@ inline named_condition::named_condition(open_or_create_t, const char *name) ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoOpenOrCreate)) + ,construct_func_t(detail::DoOpenOrCreate) + ,perm) {} inline named_condition::named_condition(open_only_t, const char *name) diff --git a/3party/boost/boost/interprocess/sync/named_mutex.hpp b/3party/boost/boost/interprocess/sync/named_mutex.hpp index cf17b9d023..4aca03b880 100644 --- a/3party/boost/boost/interprocess/sync/named_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/named_mutex.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) #include @@ -56,7 +57,7 @@ class named_mutex public: //!Creates a global interprocess_mutex with a name. //!Throws interprocess_exception on error. - named_mutex(create_only_t create_only, const char *name); + named_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); //!Opens or creates a global mutex with a name. //!If the mutex is created, this call is equivalent to @@ -64,7 +65,7 @@ class named_mutex //!If the mutex is already created, this call is equivalent //!named_mutex(open_only_t, ... ) //!Does not throw - named_mutex(open_or_create_t open_or_create, const char *name); + named_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); //!Opens a global mutex with a name if that mutex is previously //!created. If it is not previously created this function throws @@ -122,16 +123,16 @@ class named_mutex #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES) -inline named_mutex::named_mutex(create_only_t, const char *name) - : m_sem(detail::DoCreate, name, read_write, 1) +inline named_mutex::named_mutex(create_only_t, const char *name, const permissions &perm) + : m_sem(detail::DoCreate, name, 1, perm) {} -inline named_mutex::named_mutex(open_or_create_t, const char *name) - : m_sem(detail::DoOpenOrCreate, name, read_write, 1) +inline named_mutex::named_mutex(open_or_create_t, const char *name, const permissions &perm) + : m_sem(detail::DoOpenOrCreate, name, 1, perm) {} inline named_mutex::named_mutex(open_only_t, const char *name) - : m_sem(detail::DoOpen, name, read_write, 1) + : m_sem(detail::DoOpen, name, 1, permissions()) {} inline void named_mutex::dont_close_on_destruction() @@ -169,7 +170,7 @@ inline void named_mutex::dont_close_on_destruction() inline named_mutex::~named_mutex() {} -inline named_mutex::named_mutex(create_only_t, const char *name) +inline named_mutex::named_mutex(create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name ,sizeof(interprocess_mutex) + @@ -177,10 +178,11 @@ inline named_mutex::named_mutex(create_only_t, const char *name) ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoCreate)) + ,construct_func_t(detail::DoCreate) + ,perm) {} -inline named_mutex::named_mutex(open_or_create_t, const char *name) +inline named_mutex::named_mutex(open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name ,sizeof(interprocess_mutex) + @@ -188,7 +190,8 @@ inline named_mutex::named_mutex(open_or_create_t, const char *name) ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoOpenOrCreate)) + ,construct_func_t(detail::DoOpenOrCreate) + ,perm) {} inline named_mutex::named_mutex(open_only_t, const char *name) diff --git a/3party/boost/boost/interprocess/sync/named_recursive_mutex.hpp b/3party/boost/boost/interprocess/sync/named_recursive_mutex.hpp index b5fe2d3497..aa34bc1260 100644 --- a/3party/boost/boost/interprocess/sync/named_recursive_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/named_recursive_mutex.hpp @@ -24,6 +24,7 @@ #include #include #include +#include //!\file //!Describes a named named_recursive_mutex class for inter-process synchronization @@ -50,7 +51,7 @@ class named_recursive_mutex //!Creates a global recursive_mutex with a name. //!If the recursive_mutex can't be created throws interprocess_exception - named_recursive_mutex(create_only_t create_only, const char *name); + named_recursive_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); //!Opens or creates a global recursive_mutex with a name. //!If the recursive_mutex is created, this call is equivalent to @@ -58,7 +59,7 @@ class named_recursive_mutex //!If the recursive_mutex is already created, this call is equivalent //!named_recursive_mutex(open_only_t, ... ) //!Does not throw - named_recursive_mutex(open_or_create_t open_or_create, const char *name); + named_recursive_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); //!Opens a global recursive_mutex with a name if that recursive_mutex is previously //!created. If it is not previously created this function throws @@ -116,7 +117,7 @@ inline named_recursive_mutex::~named_recursive_mutex() inline void named_recursive_mutex::dont_close_on_destruction() { detail::interprocess_tester::dont_close_on_destruction(m_shmem); } -inline named_recursive_mutex::named_recursive_mutex(create_only_t, const char *name) +inline named_recursive_mutex::named_recursive_mutex(create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name ,sizeof(interprocess_recursive_mutex) + @@ -124,10 +125,11 @@ inline named_recursive_mutex::named_recursive_mutex(create_only_t, const char *n ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoCreate)) + ,construct_func_t(detail::DoCreate) + ,perm) {} -inline named_recursive_mutex::named_recursive_mutex(open_or_create_t, const char *name) +inline named_recursive_mutex::named_recursive_mutex(open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name ,sizeof(interprocess_recursive_mutex) + @@ -135,7 +137,8 @@ inline named_recursive_mutex::named_recursive_mutex(open_or_create_t, const char ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoOpenOrCreate)) + ,construct_func_t(detail::DoOpenOrCreate) + ,perm) {} inline named_recursive_mutex::named_recursive_mutex(open_only_t, const char *name) diff --git a/3party/boost/boost/interprocess/sync/named_semaphore.hpp b/3party/boost/boost/interprocess/sync/named_semaphore.hpp index d072ea4004..d8a4d58182 100644 --- a/3party/boost/boost/interprocess/sync/named_semaphore.hpp +++ b/3party/boost/boost/interprocess/sync/named_semaphore.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,7 @@ class named_semaphore public: //!Creates a global semaphore with a name, and an initial count. //!If the semaphore can't be created throws interprocess_exception - named_semaphore(create_only_t, const char *name, unsigned int initialCount); + named_semaphore(create_only_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); //!Opens or creates a global semaphore with a name, and an initial count. //!If the semaphore is created, this call is equivalent to @@ -61,7 +62,7 @@ class named_semaphore //!If the semaphore is already created, this call is equivalent to //!named_semaphore(open_only_t, ... ) //!and initialCount is ignored. - named_semaphore(open_or_create_t, const char *name, unsigned int initialCount); + named_semaphore(open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm = permissions()); //!Opens a global semaphore with a name if that semaphore is previously. //!created. If it is not previously created this function throws @@ -124,18 +125,17 @@ class named_semaphore #if defined(BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES) inline named_semaphore::named_semaphore - (create_only_t, const char *name, unsigned int initialCount) - : m_sem(detail::DoCreate, name, read_write, initialCount) + (create_only_t, const char *name, unsigned int initialCount, const permissions &perm) + : m_sem(detail::DoCreate, name, initialCount, perm) {} inline named_semaphore::named_semaphore - (open_or_create_t, const char *name, unsigned int initialCount) - : m_sem(detail::DoOpenOrCreate, name, read_write, initialCount) + (open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm) + : m_sem(detail::DoOpenOrCreate, name, initialCount, perm) {} -inline named_semaphore::named_semaphore - (open_only_t, const char *name) - : m_sem(detail::DoOpen, name, read_write, 1) +inline named_semaphore::named_semaphore(open_only_t, const char *name) + : m_sem(detail::DoOpen, name, 1, permissions()) {} inline named_semaphore::~named_semaphore() @@ -174,7 +174,7 @@ inline void named_semaphore::dont_close_on_destruction() { detail::interprocess_tester::dont_close_on_destruction(m_shmem); } inline named_semaphore::named_semaphore - (create_only_t, const char *name, unsigned int initialCount) + (create_only_t, const char *name, unsigned int initialCount, const permissions &perm) : m_shmem (create_only ,name ,sizeof(interprocess_semaphore) + @@ -182,11 +182,12 @@ inline named_semaphore::named_semaphore ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoCreate, initialCount)) + ,construct_func_t(detail::DoCreate, initialCount) + ,perm) {} inline named_semaphore::named_semaphore - (open_or_create_t, const char *name, unsigned int initialCount) + (open_or_create_t, const char *name, unsigned int initialCount, const permissions &perm) : m_shmem (open_or_create ,name ,sizeof(interprocess_semaphore) + @@ -194,7 +195,8 @@ inline named_semaphore::named_semaphore ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoOpenOrCreate, initialCount)) + ,construct_func_t(detail::DoOpenOrCreate, initialCount) + ,perm) {} inline named_semaphore::named_semaphore diff --git a/3party/boost/boost/interprocess/sync/named_upgradable_mutex.hpp b/3party/boost/boost/interprocess/sync/named_upgradable_mutex.hpp index 7b5b720a48..0cb246818e 100644 --- a/3party/boost/boost/interprocess/sync/named_upgradable_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/named_upgradable_mutex.hpp @@ -24,6 +24,7 @@ #include #include #include +#include //!\file //!Describes a named upgradable mutex class for inter-process synchronization @@ -53,14 +54,14 @@ class named_upgradable_mutex //!Creates a global upgradable mutex with a name. //!If the upgradable mutex can't be created throws interprocess_exception - named_upgradable_mutex(create_only_t create_only, const char *name); + named_upgradable_mutex(create_only_t create_only, const char *name, const permissions &perm = permissions()); //!Opens or creates a global upgradable mutex with a name, and an initial count. //!If the upgradable mutex is created, this call is equivalent to //!named_upgradable_mutex(create_only_t, ...) //!If the upgradable mutex is already created, this call is equivalent to //!named_upgradable_mutex(open_only_t, ... ). - named_upgradable_mutex(open_or_create_t open_or_create, const char *name); + named_upgradable_mutex(open_or_create_t open_or_create, const char *name, const permissions &perm = permissions()); //!Opens a global upgradable mutex with a name if that upgradable mutex //!is previously. @@ -239,7 +240,7 @@ inline named_upgradable_mutex::~named_upgradable_mutex() {} inline named_upgradable_mutex::named_upgradable_mutex - (create_only_t, const char *name) + (create_only_t, const char *name, const permissions &perm) : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + @@ -247,11 +248,12 @@ inline named_upgradable_mutex::named_upgradable_mutex ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoCreate)) + ,construct_func_t(detail::DoCreate) + ,perm) {} inline named_upgradable_mutex::named_upgradable_mutex - (open_or_create_t, const char *name) + (open_or_create_t, const char *name, const permissions &perm) : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + @@ -259,7 +261,8 @@ inline named_upgradable_mutex::named_upgradable_mutex ManagedOpenOrCreateUserOffset ,read_write ,0 - ,construct_func_t(detail::DoOpenOrCreate)) + ,construct_func_t(detail::DoOpenOrCreate) + ,perm) {} inline named_upgradable_mutex::named_upgradable_mutex diff --git a/3party/boost/boost/interprocess/sync/posix/interprocess_barrier.hpp b/3party/boost/boost/interprocess/sync/posix/interprocess_barrier.hpp index ff180ea0df..fd1d48fa1d 100644 --- a/3party/boost/boost/interprocess/sync/posix/interprocess_barrier.hpp +++ b/3party/boost/boost/interprocess/sync/posix/interprocess_barrier.hpp @@ -10,6 +10,7 @@ #include #include +#include namespace boost { namespace interprocess { @@ -27,7 +28,7 @@ inline barrier::barrier(unsigned int count) inline barrier::~barrier() { int res = pthread_barrier_destroy(&m_barrier); - assert(res == 0);(void)res; + BOOST_ASSERT(res == 0);(void)res; } inline bool barrier::wait() diff --git a/3party/boost/boost/interprocess/sync/posix/interprocess_condition.hpp b/3party/boost/boost/interprocess/sync/posix/interprocess_condition.hpp index 7c19f4414f..a506b619cf 100644 --- a/3party/boost/boost/interprocess/sync/posix/interprocess_condition.hpp +++ b/3party/boost/boost/interprocess/sync/posix/interprocess_condition.hpp @@ -10,6 +10,7 @@ #include #include +#include namespace boost { @@ -21,7 +22,7 @@ inline interprocess_condition::interprocess_condition() pthread_condattr_t cond_attr; res = pthread_condattr_init(&cond_attr); if(res != 0){ - throw interprocess_exception(); + throw interprocess_exception("pthread_condattr_init failed"); } res = pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED); if(res != 0){ @@ -39,21 +40,21 @@ inline interprocess_condition::~interprocess_condition() { int res = 0; res = pthread_cond_destroy(&m_condition); - assert(res == 0); + BOOST_ASSERT(res == 0); } inline void interprocess_condition::notify_one() { int res = 0; res = pthread_cond_signal(&m_condition); - assert(res == 0); + BOOST_ASSERT(res == 0); } inline void interprocess_condition::notify_all() { int res = 0; res = pthread_cond_broadcast(&m_condition); - assert(res == 0); + BOOST_ASSERT(res == 0); } inline void interprocess_condition::do_wait(interprocess_mutex &mut) @@ -61,7 +62,7 @@ inline void interprocess_condition::do_wait(interprocess_mutex &mut) pthread_mutex_t* pmutex = &mut.m_mut; int res = 0; res = pthread_cond_wait(&m_condition, pmutex); - assert(res == 0); + BOOST_ASSERT(res == 0); } inline bool interprocess_condition::do_timed_wait @@ -71,7 +72,7 @@ inline bool interprocess_condition::do_timed_wait pthread_mutex_t* pmutex = &mut.m_mut; int res = 0; res = pthread_cond_timedwait(&m_condition, pmutex, &ts); - assert(res == 0 || res == ETIMEDOUT); + BOOST_ASSERT(res == 0 || res == ETIMEDOUT); return res != ETIMEDOUT; } diff --git a/3party/boost/boost/interprocess/sync/posix/interprocess_mutex.hpp b/3party/boost/boost/interprocess/sync/posix/interprocess_mutex.hpp index bcba0ebaca..8e5b4d91d8 100644 --- a/3party/boost/boost/interprocess/sync/posix/interprocess_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/posix/interprocess_mutex.hpp @@ -30,6 +30,7 @@ #ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS # include #endif +#include namespace boost { namespace interprocess { @@ -44,7 +45,7 @@ inline interprocess_mutex::interprocess_mutex() inline interprocess_mutex::~interprocess_mutex() { int res = pthread_mutex_destroy(&m_mut); - assert(res == 0);(void)res; + BOOST_ASSERT(res == 0);(void)res; } inline void interprocess_mutex::lock() @@ -103,7 +104,7 @@ inline void interprocess_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); - assert(res == 0); + BOOST_ASSERT(res == 0); } } //namespace interprocess { diff --git a/3party/boost/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp b/3party/boost/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp index 85c127faef..b80bab1709 100644 --- a/3party/boost/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp @@ -30,6 +30,7 @@ #ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS # include #endif +#include namespace boost { @@ -45,7 +46,7 @@ inline interprocess_recursive_mutex::interprocess_recursive_mutex() inline interprocess_recursive_mutex::~interprocess_recursive_mutex() { int res = pthread_mutex_destroy(&m_mut); - assert(res == 0);(void)res; + BOOST_ASSERT(res == 0);(void)res; } inline void interprocess_recursive_mutex::lock() @@ -104,7 +105,7 @@ inline void interprocess_recursive_mutex::unlock() { int res = 0; res = pthread_mutex_unlock(&m_mut); - assert(res == 0); + BOOST_ASSERT(res == 0); } } //namespace interprocess { diff --git a/3party/boost/boost/interprocess/sync/posix/pthread_helpers.hpp b/3party/boost/boost/interprocess/sync/posix/pthread_helpers.hpp index 6a8e41cc7a..e175b18567 100644 --- a/3party/boost/boost/interprocess/sync/posix/pthread_helpers.hpp +++ b/3party/boost/boost/interprocess/sync/posix/pthread_helpers.hpp @@ -38,7 +38,7 @@ namespace detail{ pthread_mutexattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0 || (recursive && pthread_mutexattr_settype(&m_attr, PTHREAD_MUTEX_RECURSIVE)!= 0 )) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_mutexattr_xxxx failed"); } //!Destructor @@ -58,7 +58,7 @@ namespace detail{ { if(pthread_condattr_init(&m_attr)!=0 || pthread_condattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_condattr_xxxx failed"); } //!Destructor @@ -79,7 +79,7 @@ namespace detail{ : mp_mut(&mut) { if(pthread_mutex_init(mp_mut, &mut_attr) != 0) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_mutex_init failed"); } ~mutex_initializer() { if(mp_mut) pthread_mutex_destroy(mp_mut); } @@ -98,7 +98,7 @@ namespace detail{ : mp_cond(&cond) { if(pthread_cond_init(mp_cond, &cond_attr)!= 0) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_cond_init failed"); } ~condition_initializer() { if(mp_cond) pthread_cond_destroy(mp_cond); } @@ -121,7 +121,7 @@ namespace detail{ { if(pthread_barrierattr_init(&m_attr)!=0 || pthread_barrierattr_setpshared(&m_attr, PTHREAD_PROCESS_SHARED)!= 0) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_barrierattr_xxx failed"); } //!Destructor @@ -144,7 +144,7 @@ namespace detail{ : mp_barrier(&mut) { if(pthread_barrier_init(mp_barrier, &mut_attr, count) != 0) - throw boost::interprocess::interprocess_exception(); + throw interprocess_exception("pthread_barrier_init failed"); } ~barrier_initializer() { if(mp_barrier) pthread_barrier_destroy(mp_barrier); } diff --git a/3party/boost/boost/interprocess/sync/posix/semaphore_wrapper.hpp b/3party/boost/boost/interprocess/sync/posix/semaphore_wrapper.hpp index 620754157e..7945be8ab4 100644 --- a/3party/boost/boost/interprocess/sync/posix/semaphore_wrapper.hpp +++ b/3party/boost/boost/interprocess/sync/posix/semaphore_wrapper.hpp @@ -16,8 +16,10 @@ #include #include #include +#include #include #include +#include #ifdef SEM_FAILED #define BOOST_INTERPROCESS_POSIX_SEM_FAILED (reinterpret_cast(SEM_FAILED)) @@ -41,29 +43,18 @@ namespace detail{ class interprocess_tester; } namespace detail { inline bool semaphore_open - (sem_t *&handle, detail::create_enum_t type, const char *origname, mode_t mode, - unsigned int count) + (sem_t *&handle, detail::create_enum_t type, const char *origname, + unsigned int count, const permissions &perm = permissions()) { std::string name; #ifndef BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES detail::add_leading_slash(origname, name); #else - detail::create_tmp_dir_and_get_filename(origname, name); + detail::create_tmp_and_clean_old_and_get_filename(origname, name); #endif //Create new mapping int oflag = 0; - if(mode == read_only){ - oflag |= O_RDONLY; - } - else if(mode == read_write){ - oflag |= O_RDWR; - } - else{ - error_info err(mode_error); - throw interprocess_exception(err); - } - switch(type){ case detail::DoOpen: //No addition @@ -83,7 +74,7 @@ inline bool semaphore_open //Open file using POSIX API if(oflag & O_CREAT) - handle = sem_open(name.c_str(), oflag, S_IRWXO | S_IRWXG | S_IRWXU, count); + handle = sem_open(name.c_str(), oflag, perm.get_permissions(), count); else handle = sem_open(name.c_str(), oflag); @@ -99,7 +90,7 @@ inline void semaphore_close(sem_t *handle) { int ret = sem_close(handle); if(ret != 0){ - assert(0); + BOOST_ASSERT(0); } } @@ -134,7 +125,7 @@ inline void semaphore_destroy(sem_t *handle) { int ret = sem_destroy(handle); if(ret != 0){ - assert(0); + BOOST_ASSERT(0); } } @@ -204,8 +195,8 @@ class named_semaphore_wrapper public: named_semaphore_wrapper - (detail::create_enum_t type, const char *name, mode_t mode, unsigned int count) - { semaphore_open(mp_sem, type, name, mode, count); } + (detail::create_enum_t type, const char *name, unsigned int count, const permissions &perm = permissions()) + { semaphore_open(mp_sem, type, name, count, perm); } ~named_semaphore_wrapper() { diff --git a/3party/boost/boost/interprocess/sync/xsi/xsi_named_mutex.hpp b/3party/boost/boost/interprocess/sync/xsi/xsi_named_mutex.hpp index fcf46cd3bc..99161f23b0 100644 --- a/3party/boost/boost/interprocess/sync/xsi/xsi_named_mutex.hpp +++ b/3party/boost/boost/interprocess/sync/xsi/xsi_named_mutex.hpp @@ -27,9 +27,10 @@ #include #include #include -#include +#include #include #include +#include //!\file //!Describes a class representing a xsi-based named_mutex. @@ -198,7 +199,7 @@ inline void xsi_named_mutex::unlock() { bool success = xsi::simple_sem_op(m_semid, 1); (void)success; - assert(success); + BOOST_ASSERT(success); } inline bool xsi_named_mutex::remove() diff --git a/3party/boost/boost/interprocess/windows_shared_memory.hpp b/3party/boost/boost/interprocess/windows_shared_memory.hpp index 01118b073c..f1ccc41c25 100644 --- a/3party/boost/boost/interprocess/windows_shared_memory.hpp +++ b/3party/boost/boost/interprocess/windows_shared_memory.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #if !defined(BOOST_INTERPROCESS_WINDOWS) #error "This header can only be used in Windows operating systems" @@ -62,24 +63,25 @@ class windows_shared_memory //!Creates a new native shared memory with name "name" and mode "mode", //!with the access mode "mode". //!If the file previously exists, throws an error. - windows_shared_memory(create_only_t, const char *name, mode_t mode, std::size_t size) - { this->priv_open_or_create(detail::DoCreate, name, mode, size); } + windows_shared_memory(create_only_t, const char *name, mode_t mode, std::size_t size, const permissions& perm = permissions()) + { this->priv_open_or_create(detail::DoCreate, name, mode, size, perm); } //!Tries to create a shared memory object with name "name" and mode "mode", with the //!access mode "mode". If the file previously exists, it tries to open it with mode "mode". //!Otherwise throws an error. - windows_shared_memory(open_or_create_t, const char *name, mode_t mode, std::size_t size) - { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode, size); } + windows_shared_memory(open_or_create_t, const char *name, mode_t mode, std::size_t size, const permissions& perm = permissions()) + { this->priv_open_or_create(detail::DoOpenOrCreate, name, mode, size, perm); } //!Tries to open a shared memory object with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. windows_shared_memory(open_only_t, const char *name, mode_t mode) - { this->priv_open_or_create(detail::DoOpen, name, mode, 0); } + { this->priv_open_or_create(detail::DoOpen, name, mode, 0, permissions()); } //!Moves the ownership of "moved"'s shared memory object to *this. //!After the call, "moved" does not represent any shared memory object. //!Does not throw windows_shared_memory(BOOST_INTERPROCESS_RV_REF(windows_shared_memory) moved) + : m_handle(0) { this->swap(moved); } //!Moves the ownership of "moved"'s shared memory to *this. @@ -117,7 +119,7 @@ class windows_shared_memory void priv_close(); //!Closes a previously opened file mapping. Never throws. - bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode, std::size_t size); + bool priv_open_or_create(detail::create_enum_t type, const char *filename, mode_t mode, std::size_t size, const permissions& perm = permissions()); void * m_handle; mode_t m_mode; @@ -151,7 +153,7 @@ inline mode_t windows_shared_memory::get_mode() const { return m_mode; } inline bool windows_shared_memory::priv_open_or_create - (detail::create_enum_t type, const char *filename, mode_t mode, std::size_t size) + (detail::create_enum_t type, const char *filename, mode_t mode, std::size_t size, const permissions& perm) { m_name = filename ? filename : ""; @@ -191,7 +193,8 @@ inline bool windows_shared_memory::priv_open_or_create __int64 s = size; unsigned long high_size(s >> 32), low_size((boost::uint32_t)s); m_handle = winapi::create_file_mapping - (winapi::invalid_handle_value, file_map_access, high_size, low_size, filename); + ( winapi::invalid_handle_value, file_map_access, high_size, low_size, filename + , (winapi::interprocess_security_attributes*)perm.get_permissions()); } break; default: diff --git a/3party/boost/boost/intrusive/avl_set.hpp b/3party/boost/boost/intrusive/avl_set.hpp index a9440774e9..1c13c624c3 100644 --- a/3party/boost/boost/intrusive/avl_set.hpp +++ b/3party/boost/boost/intrusive/avl_set.hpp @@ -74,6 +74,8 @@ class avl_set_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; @@ -1264,6 +1266,8 @@ class avl_multiset_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; diff --git a/3party/boost/boost/intrusive/avltree.hpp b/3party/boost/boost/intrusive/avltree.hpp index e65f18253b..4b6e0899ed 100644 --- a/3party/boost/boost/intrusive/avltree.hpp +++ b/3party/boost/boost/intrusive/avltree.hpp @@ -113,7 +113,7 @@ class avltree_impl ::type node_ptr; typedef typename boost::pointer_to_other ::type const_node_ptr; - typedef avltree_algorithms node_algorithms; + typedef avltree_algorithms node_algorithms; static const bool constant_time_size = Config::constant_time_size; static const bool stateful_value_traits = detail::store_cont_ptr_on_it::value; @@ -167,7 +167,7 @@ class avltree_impl static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(detail::get_pointer(ptr))); + return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() @@ -1398,7 +1398,7 @@ class avltree_impl static avltree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_size_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/3party/boost/boost/intrusive/avltree_algorithms.hpp b/3party/boost/boost/intrusive/avltree_algorithms.hpp index a632581c1c..7e0cd2e47c 100644 --- a/3party/boost/boost/intrusive/avltree_algorithms.hpp +++ b/3party/boost/boost/intrusive/avltree_algorithms.hpp @@ -104,7 +104,7 @@ class avltree_algorithms static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); } /// @endcond diff --git a/3party/boost/boost/intrusive/circular_slist_algorithms.hpp b/3party/boost/boost/intrusive/circular_slist_algorithms.hpp index ae06396ed9..8bb95cdf49 100644 --- a/3party/boost/boost/intrusive/circular_slist_algorithms.hpp +++ b/3party/boost/boost/intrusive/circular_slist_algorithms.hpp @@ -63,7 +63,7 @@ class circular_slist_algorithms //! Effects: Constructs an non-used list element, putting the next //! pointer to null: - //! NodeTraits::get_next(this_node) == 0 + //! NodeTraits::get_next(this_node) == 0 //! //! Complexity: Constant //! diff --git a/3party/boost/boost/intrusive/derivation_value_traits.hpp b/3party/boost/boost/intrusive/derivation_value_traits.hpp index 7b5b0131e9..8711d5696b 100644 --- a/3party/boost/boost/intrusive/derivation_value_traits.hpp +++ b/3party/boost/boost/intrusive/derivation_value_traits.hpp @@ -14,6 +14,7 @@ #define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP #include +#include #include namespace boost { @@ -44,10 +45,20 @@ struct derivation_value_traits { return node_ptr(&value); } static pointer to_value_ptr(node_ptr n) - { return pointer(static_cast(detail::get_pointer(n))); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(n)); + return pointer(&static_cast(*n)); + } static const_pointer to_value_ptr(const_node_ptr n) - { return const_pointer(static_cast(detail::get_pointer(n))); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(n)); + return const_pointer(&static_cast(*n)); + } }; } //namespace intrusive diff --git a/3party/boost/boost/intrusive/detail/any_node_and_algorithms.hpp b/3party/boost/boost/intrusive/detail/any_node_and_algorithms.hpp index e2fbbfac69..513bdd9fbb 100644 --- a/3party/boost/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/3party/boost/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace boost { namespace intrusive { @@ -87,7 +88,10 @@ struct any_unordered_node_traits static const bool optimize_multikey = true; static node_ptr get_next(const_node_ptr n) - { return node_ptr(&static_cast(*n->node_ptr_1)); } + { + using ::boost::static_pointer_cast; + return static_pointer_cast(n->node_ptr_1); + } static void set_next(node_ptr n, node_ptr next) { n->node_ptr_1 = next; } diff --git a/3party/boost/boost/intrusive/detail/hashtable_node.hpp b/3party/boost/boost/intrusive/detail/hashtable_node.hpp index 1676b1c88e..72188b9ec5 100644 --- a/3party/boost/boost/intrusive/detail/hashtable_node.hpp +++ b/3party/boost/boost/intrusive/detail/hashtable_node.hpp @@ -22,7 +22,7 @@ #include #include //remove-me #include - +#include namespace boost { namespace intrusive { namespace detail { @@ -36,6 +36,7 @@ struct prime_list_holder template const std::size_t prime_list_holder::prime_list[] = { + 3ul, 7ul, 11ul, 17ul, 29ul, 53ul, 97ul, 193ul, 389ul, 769ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, @@ -117,7 +118,12 @@ class hashtable_iterator typedef typename Container::size_type size_type; static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p) - { return typename Container::node_ptr(&static_cast(*p)); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(p); + return typename Container::node_ptr(&static_cast(*p)); + } public: typedef typename Container::value_type value_type; @@ -164,10 +170,10 @@ class hashtable_iterator { return *this->operator ->(); } pointer operator->() const - { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(downcast_bucket(slist_it_.pointed_node()))); } + { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(downcast_bucket(slist_it_.pointed_node()))); } const Container *get_container() const - { return detail::get_pointer(cont_); } + { return detail::boost_intrusive_get_pointer(cont_); } const real_value_traits *get_real_value_traits() const { return &this->get_container()->get_real_value_traits(); } @@ -175,8 +181,8 @@ class hashtable_iterator private: void increment() { - const Container *cont = detail::get_pointer(cont_); - bucket_type* buckets = detail::get_pointer(cont->bucket_pointer()); + const Container *cont = detail::boost_intrusive_get_pointer(cont_); + bucket_type* buckets = detail::boost_intrusive_get_pointer(cont->bucket_pointer()); size_type buckets_len = cont->bucket_count(); ++slist_it_; diff --git a/3party/boost/boost/intrusive/detail/list_node.hpp b/3party/boost/boost/intrusive/detail/list_node.hpp index 935c522fab..e5df1503c9 100644 --- a/3party/boost/boost/intrusive/detail/list_node.hpp +++ b/3party/boost/boost/intrusive/detail/list_node.hpp @@ -64,11 +64,9 @@ class list_iterator : public std::iterator < std::bidirectional_iterator_tag , typename Container::value_type - , typename std::iterator_traits::difference_type - , typename detail::add_const_if_c - ::type * - , typename detail::add_const_if_c - ::type & + , typename Container::difference_type + , typename detail::if_c::type + , typename detail::if_c::type > { protected: @@ -83,10 +81,8 @@ class list_iterator public: typedef typename Container::value_type value_type; - typedef typename detail::add_const_if_c - ::type *pointer; - typedef typename detail::add_const_if_c - ::type &reference; + typedef typename detail::if_c::type pointer; + typedef typename detail::if_c::type reference; list_iterator() : members_ (node_ptr(0), 0) @@ -133,17 +129,17 @@ class list_iterator return result; } - bool operator== (const list_iterator& i) const - { return members_.nodeptr_ == i.pointed_node(); } + friend bool operator== (const list_iterator& l, const list_iterator& r) + { return l.pointed_node() == r.pointed_node(); } - bool operator!= (const list_iterator& i) const - { return !operator== (i); } + friend bool operator!= (const list_iterator& l, const list_iterator& r) + { return !(l == r); } reference operator*() const { return *operator->(); } pointer operator->() const - { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } const Container *get_container() const { diff --git a/3party/boost/boost/intrusive/detail/parent_from_member.hpp b/3party/boost/boost/intrusive/detail/parent_from_member.hpp index 0b30867abc..c06d932a70 100644 --- a/3party/boost/boost/intrusive/detail/parent_from_member.hpp +++ b/3party/boost/boost/intrusive/detail/parent_from_member.hpp @@ -9,8 +9,8 @@ // See http://www.boost.org/libs/intrusive for documentation. // ///////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP -#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP +#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP +#define BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP #include #include @@ -47,15 +47,13 @@ inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_t template inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member) { - return (Parent*)((char*)member - - offset_from_pointer_to_member(ptr_to_member)); + return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member)); } template inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member) { - return (const Parent*)((const char*)member - - offset_from_pointer_to_member(ptr_to_member)); + return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member)); } } //namespace detail { @@ -68,4 +66,4 @@ inline const Parent *parent_from_member(const Member *member, const Member Paren #include -#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP diff --git a/3party/boost/boost/intrusive/detail/slist_node.hpp b/3party/boost/boost/intrusive/detail/slist_node.hpp index a7df9e19d8..6ed8e4b6d3 100644 --- a/3party/boost/boost/intrusive/detail/slist_node.hpp +++ b/3party/boost/boost/intrusive/detail/slist_node.hpp @@ -56,11 +56,9 @@ class slist_iterator : public std::iterator < std::forward_iterator_tag , typename Container::value_type - , typename std::iterator_traits::difference_type - , typename detail::add_const_if_c - ::type * - , typename detail::add_const_if_c - ::type & + , typename Container::difference_type + , typename detail::if_c::type + , typename detail::if_c::type > { protected: @@ -75,10 +73,8 @@ class slist_iterator public: typedef typename Container::value_type value_type; - typedef typename detail::add_const_if_c - ::type *pointer; - typedef typename detail::add_const_if_c - ::type &reference; + typedef typename detail::if_c::type pointer; + typedef typename detail::if_c::type reference; slist_iterator() : members_ (node_ptr(0), 0) @@ -112,17 +108,17 @@ class slist_iterator return result; } - bool operator== (const slist_iterator& i) const - { return members_.nodeptr_ == i.pointed_node(); } + friend bool operator== (const slist_iterator& l, const slist_iterator& r) + { return l.pointed_node() == r.pointed_node(); } - bool operator!= (const slist_iterator& i) const - { return !operator== (i); } + friend bool operator!= (const slist_iterator& l, const slist_iterator& r) + { return !(l == r); } reference operator*() const { return *operator->(); } pointer operator->() const - { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } const Container *get_container() const { diff --git a/3party/boost/boost/intrusive/detail/tree_algorithms.hpp b/3party/boost/boost/intrusive/detail/tree_algorithms.hpp index 32bbfb58c7..9ad2b4eff8 100644 --- a/3party/boost/boost/intrusive/detail/tree_algorithms.hpp +++ b/3party/boost/boost/intrusive/detail/tree_algorithms.hpp @@ -18,6 +18,7 @@ #include #include #include +//iG pending #include namespace boost { namespace intrusive { @@ -140,7 +141,8 @@ class tree_algorithms static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); + //iG pending return node_ptr(boost::const_pointer_cast(ptr)); } /// @endcond @@ -1499,7 +1501,7 @@ class tree_algorithms static node_ptr vine_to_subtree(node_ptr old_root, std::size_t count) { - std::size_t leaf_nodes = count + 1 - ((size_t) 1 << floor_log2 (count + 1)); + std::size_t leaf_nodes = count + 1 - ((std::size_t) 1 << floor_log2 (count + 1)); std::size_t vine_nodes = count - leaf_nodes; node_ptr new_root = compress_subtree(old_root, leaf_nodes); diff --git a/3party/boost/boost/intrusive/detail/tree_node.hpp b/3party/boost/boost/intrusive/detail/tree_node.hpp index 3508e85bf5..f6a678dc43 100644 --- a/3party/boost/boost/intrusive/detail/tree_node.hpp +++ b/3party/boost/boost/intrusive/detail/tree_node.hpp @@ -73,11 +73,9 @@ class tree_iterator : public std::iterator < std::bidirectional_iterator_tag , typename Container::value_type - , typename std::iterator_traits::difference_type - , typename detail::add_const_if_c - ::type * - , typename detail::add_const_if_c - ::type & + , typename Container::difference_type + , typename detail::if_c::type + , typename detail::if_c::type > { protected: @@ -93,10 +91,9 @@ class tree_iterator public: typedef typename Container::value_type value_type; - typedef typename detail::add_const_if_c - ::type *pointer; - typedef typename detail::add_const_if_c - ::type &reference; + typedef typename detail::if_c::type pointer; + typedef typename detail::if_c::type reference; + tree_iterator() : members_ (0, 0) @@ -143,17 +140,17 @@ class tree_iterator return result; } - bool operator== (const tree_iterator& i) const - { return members_.nodeptr_ == i.pointed_node(); } + friend bool operator== (const tree_iterator& l, const tree_iterator& r) + { return l.pointed_node() == r.pointed_node(); } - bool operator!= (const tree_iterator& i) const - { return !operator== (i); } + friend bool operator!= (const tree_iterator& l, const tree_iterator& r) + { return !(l == r); } reference operator*() const { return *operator->(); } pointer operator->() const - { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } + { return detail::boost_intrusive_get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } const Container *get_container() const { return static_cast(members_.get_ptr()); } diff --git a/3party/boost/boost/intrusive/detail/utilities.hpp b/3party/boost/boost/intrusive/detail/utilities.hpp index c548911739..064ff6e5de 100644 --- a/3party/boost/boost/intrusive/detail/utilities.hpp +++ b/3party/boost/boost/intrusive/detail/utilities.hpp @@ -122,10 +122,10 @@ struct smart_ptr_type { return ptr;} }; -//!Overload for smart pointers to avoid ADL problems with get_pointer +//!Overload for smart pointers to avoid ADL problems with boost_intrusive_get_pointer template inline typename smart_ptr_type::pointer -get_pointer(const Ptr &ptr) +boost_intrusive_get_pointer(const Ptr &ptr) { return smart_ptr_type::get(ptr); } //This functor compares a stored value @@ -319,7 +319,7 @@ struct constptr {} const void *get_ptr() const - { return detail::get_pointer(const_void_ptr_); } + { return detail::boost_intrusive_get_pointer(const_void_ptr_); } ConstVoidPtr const_void_ptr_; }; @@ -410,28 +410,63 @@ struct member_hook_traits static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode; static node_ptr to_node_ptr(reference value) - { - return reinterpret_cast(&(value.*P)); - } + { return static_cast(&(value.*P)); } static const_node_ptr to_node_ptr(const_reference value) - { - return static_cast(&(value.*P)); - } + { return static_cast(&(value.*P)); } static pointer to_value_ptr(node_ptr n) { return detail::parent_from_member - (static_cast(detail::get_pointer(n)), P); + (static_cast(detail::boost_intrusive_get_pointer(n)), P); } static const_pointer to_value_ptr(const_node_ptr n) { return detail::parent_from_member - (static_cast(detail::get_pointer(n)), P); + (static_cast(detail::boost_intrusive_get_pointer(n)), P); } }; +template +struct function_hook_traits +{ + public: + typedef typename Functor::hook_type hook_type; + typedef typename Functor::hook_ptr hook_ptr; + typedef typename Functor::const_hook_ptr const_hook_ptr; + typedef typename hook_type::boost_intrusive_tags::node_traits node_traits; + typedef typename node_traits::node node; + typedef typename Functor::value_type value_type; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename boost::pointer_to_other::type pointer; + typedef typename boost::pointer_to_other::type const_pointer; + typedef typename std::iterator_traits::reference reference; + typedef typename std::iterator_traits::reference const_reference; + static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode; + + static node_ptr to_node_ptr(reference value) + { return static_cast(&*Functor::to_hook_ptr(value)); } + + static const_node_ptr to_node_ptr(const_reference value) + { return static_cast(&*Functor::to_hook_ptr(value)); } + + static pointer to_value_ptr(node_ptr n) + { return Functor::to_value_ptr(to_hook_ptr(n)); } + + static const_pointer to_value_ptr(const_node_ptr n) + { return Functor::to_value_ptr(to_hook_ptr(n)); } + + private: + static hook_ptr to_hook_ptr(node_ptr n) + { return hook_ptr(&*static_cast(&*n)); } + + static const_hook_ptr to_hook_ptr(const_node_ptr n) + { return const_hook_ptr(&*static_cast(&*n)); } +}; + + //This function uses binary search to discover the //highest set bit of the integer inline std::size_t floor_log2 (std::size_t x) @@ -454,14 +489,19 @@ inline std::size_t floor_log2 (std::size_t x) inline float fast_log2 (float val) { - boost::uint32_t * exp_ptr = - static_cast(static_cast(&val)); - boost::uint32_t x = *exp_ptr; + union caster_t + { + boost::uint32_t x; + float val; + } caster; + + caster.val = val; + boost::uint32_t x = caster.x; const int log_2 = (int)(((x >> 23) & 255) - 128); x &= ~(255 << 23); x += 127 << 23; - *exp_ptr = x; - + caster.x = x; + val = caster.val; val = ((-1.0f/3) * val + 2) * val - 2.0f/3; return (val + log_2); @@ -632,6 +672,64 @@ struct node_to_value { return *(this->get_real_value_traits()->to_value_ptr(npointer(&arg))); } }; +//This is not standard, but should work with all compilers +union max_align +{ + char char_; + short short_; + int int_; + long long_; + #ifdef BOOST_HAS_LONG_LONG + long long long_long_; + #endif + float float_; + double double_; + long double long_double_; + void * void_ptr_; +}; + +template +class array_initializer +{ + public: + template + array_initializer(const CommonInitializer &init) + { + char *init_buf = (char*)rawbuf; + std::size_t i = 0; + try{ + for(; i != N; ++i){ + new(init_buf)T(init); + init_buf += sizeof(T); + } + } + catch(...){ + while(i--){ + init_buf -= sizeof(T); + ((T*)init_buf)->~T(); + } + throw; + } + } + + operator T* () + { return (T*)(rawbuf); } + + operator const T*() const + { return (const T*)(rawbuf); } + + ~array_initializer() + { + char *init_buf = (char*)rawbuf + N*sizeof(T); + for(std::size_t i = 0; i != N; ++i){ + init_buf -= sizeof(T); + ((T*)init_buf)->~T(); + } + } + + private: + detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1]; +}; } //namespace detail } //namespace intrusive diff --git a/3party/boost/boost/intrusive/hashtable.hpp b/3party/boost/boost/intrusive/hashtable.hpp index 51cc6c1953..1493eacafb 100644 --- a/3party/boost/boost/intrusive/hashtable.hpp +++ b/3party/boost/boost/intrusive/hashtable.hpp @@ -23,6 +23,7 @@ #include #include #include +#include //General intrusive utilities #include #include @@ -157,26 +158,22 @@ struct get_slist_impl_from_supposed_value_traits template struct unordered_bucket_impl { - /// @cond typedef typename get_slist_impl_from_supposed_value_traits ::type slist_impl; typedef detail::bucket_impl implementation_defined; - /// @endcond typedef implementation_defined type; }; template struct unordered_bucket_ptr_impl { - /// @cond typedef typename detail::get_node_traits ::type::node_ptr node_ptr; typedef typename unordered_bucket_impl ::type bucket_type; typedef typename boost::pointer_to_other ::type implementation_defined; - /// @endcond typedef implementation_defined type; }; @@ -329,7 +326,12 @@ struct group_functions typedef circular_slist_algorithms group_algorithms; static node_ptr dcast_bucket_ptr(slist_node_ptr p) - { return node_ptr(&static_cast(*p)); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(p); + return node_ptr(&static_cast(*p)); + } static slist_node_ptr priv_get_bucket_before_begin (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p) @@ -496,7 +498,6 @@ struct unordered_bucket_ptr template struct unordered_default_bucket_traits { - /// @cond typedef typename ValueTraitsOrHookOption:: template pack::value_traits supposed_value_traits; typedef typename detail:: @@ -504,7 +505,6 @@ struct unordered_default_bucket_traits ::type slist_impl; typedef detail::bucket_traits_impl implementation_defined; - /// @endcond typedef implementation_defined type; }; @@ -886,7 +886,7 @@ class hashtable_impl } else{ size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = detail::get_pointer(this->priv_buckets()); + const bucket_type *b = detail::boost_intrusive_get_pointer(this->priv_buckets()); for (size_type n = 0; n < buckets_len; ++n, ++b){ if(!b->empty()){ return false; @@ -909,7 +909,7 @@ class hashtable_impl else{ size_type len = 0; size_type buckets_len = this->priv_buckets_len(); - const bucket_type *b = detail::get_pointer(this->priv_buckets()); + const bucket_type *b = detail::boost_intrusive_get_pointer(this->priv_buckets()); for (size_type n = 0; n < buckets_len; ++n, ++b){ len += b->size(); } @@ -1229,8 +1229,8 @@ class hashtable_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased element. No destructors are called. - iterator erase(const_iterator i) - { return this->erase_and_dispose(i, detail::null_disposer()); } + void erase(const_iterator i) + { this->erase_and_dispose(i, detail::null_disposer()); } //! Effects: Erases the range pointed to by b end e. //! @@ -1241,8 +1241,8 @@ class hashtable_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. - iterator erase(const_iterator b, const_iterator e) - { return this->erase_and_dispose(b, e, detail::null_disposer()); } + void erase(const_iterator b, const_iterator e) + { this->erase_and_dispose(b, e, detail::null_disposer()); } //! Effects: Erases all the elements with the given value. //! @@ -1295,18 +1295,15 @@ class hashtable_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator i, Disposer disposer + void erase_and_dispose(const_iterator i, Disposer disposer /// @cond , typename detail::enable_if_c::value >::type * = 0 /// @endcond ) { - iterator ret(i.unconst()); - ++ret; priv_erase(i, disposer, optimize_multikey_t()); this->priv_size_traits().decrement(); priv_erasure_update_cache(); - return ret; } //! Requires: Disposer::operator()(pointer) shouldn't throw. @@ -1322,7 +1319,7 @@ class hashtable_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) { if(b != e){ //Get the bucket number and local iterator for both iterators @@ -1347,7 +1344,6 @@ class hashtable_impl priv_erase_range(before_first_local_it, first_bucket_num, last_local_it, last_bucket_num, disposer); priv_erasure_update_cache(first_bucket_num, last_bucket_num); } - return e.unconst(); } //! Requires: Disposer::operator()(pointer) shouldn't throw. @@ -2139,8 +2135,8 @@ class hashtable_impl } //! Effects: Returns the nearest new bucket count optimized for - //! the container that is bigger than n. This suggestion can be used - //! to create bucket arrays with a size that will usually improve + //! the container that is bigger or equal than n. This suggestion can be + //! used to create bucket arrays with a size that will usually improve //! container's performance. If such value does not exist, the //! higher possible value is returned. //! @@ -2153,15 +2149,15 @@ class hashtable_impl const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size; size_type const* bound = std::lower_bound(primes, primes_end, n); if(bound == primes_end) - bound--; + --bound; return size_type(*bound); } //! Effects: Returns the nearest new bucket count optimized for - //! the container that is smaller than n. This suggestion can be used - //! to create bucket arrays with a size that will usually improve + //! the container that is smaller or equal than n. This suggestion can be + //! used to create bucket arrays with a size that will usually improve //! container's performance. If such value does not exist, the - //! lower possible value is returned. + //! lowest possible value is returned. //! //! Complexity: Amortized constant time. //! @@ -2171,8 +2167,8 @@ class hashtable_impl const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0]; const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size; size_type const* bound = std::upper_bound(primes, primes_end, n); - if(bound != primes_end) - bound--; + if(bound != primes) + --bound; return size_type(*bound); } @@ -2240,7 +2236,7 @@ class hashtable_impl { return this->priv_real_bucket_traits().bucket_count(); } static node_ptr uncast(const_node_ptr ptr) - { return node_ptr(const_cast(detail::get_pointer(ptr))); } + { return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } node &priv_value_to_node(value_type &v) { return *this->get_real_value_traits().to_node_ptr(v); } @@ -2326,7 +2322,12 @@ class hashtable_impl } static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p) - { return node_ptr(&static_cast(*p)); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(p); + return node_ptr(&static_cast(*p)); + } std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const { return node_traits::get_hash(this->get_real_value_traits().to_node_ptr(v)); } @@ -2893,7 +2894,6 @@ struct make_hashtable_opt //Real value traits must be calculated from options typedef typename detail::get_value_traits ::type value_traits; - /// @cond static const bool external_value_traits = detail::external_value_traits_is_true::value; typedef typename detail::eval_if_c @@ -2902,7 +2902,6 @@ struct make_hashtable_opt , detail::identity >::type real_value_traits; typedef typename packed_options::bucket_traits specified_bucket_traits; - /// @endcond //Real bucket traits must be calculated from options and calculated value_traits typedef typename detail::get_slist_impl diff --git a/3party/boost/boost/intrusive/intrusive_fwd.hpp b/3party/boost/boost/intrusive/intrusive_fwd.hpp index 7c9b2a1ef8..dc185667e0 100644 --- a/3party/boost/boost/intrusive/intrusive_fwd.hpp +++ b/3party/boost/boost/intrusive/intrusive_fwd.hpp @@ -50,7 +50,7 @@ class rbtree_algorithms; //////////////////////////// //slist -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -64,7 +64,7 @@ template #endif class slist; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -75,7 +75,7 @@ template #endif class slist_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -87,7 +87,7 @@ template class slist_member_hook; //list -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -99,7 +99,7 @@ template #endif class list; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -110,7 +110,7 @@ template #endif class list_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -121,8 +121,19 @@ template #endif class list_member_hook; +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) +template + < class O1 = none + , class O2 = none + , class O3 = none + > +#else +template +#endif +class list_hook; + //rbtree/set/multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -135,7 +146,7 @@ template #endif class rbtree; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -148,7 +159,7 @@ template #endif class set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -161,7 +172,7 @@ template #endif class multiset; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -173,7 +184,7 @@ template #endif class set_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -186,7 +197,7 @@ template class set_member_hook; //splaytree/splay_set/splay_multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -199,7 +210,7 @@ template #endif class splaytree; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -212,7 +223,7 @@ template #endif class splay_set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -225,7 +236,7 @@ template #endif class splay_multiset; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -236,7 +247,7 @@ template #endif class splay_set_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -248,7 +259,7 @@ template class splay_set_member_hook; //avltree/avl_set/avl_multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -261,7 +272,7 @@ template #endif class avltree; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -274,7 +285,7 @@ template #endif class avl_set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -287,7 +298,7 @@ template #endif class avl_multiset; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -299,7 +310,7 @@ template #endif class avl_set_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -313,7 +324,7 @@ class avl_set_member_hook; //treap/treap_set/treap_multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -326,7 +337,7 @@ template #endif class treap; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -339,7 +350,7 @@ template #endif class treap_set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -357,7 +368,7 @@ template struct priority_compare; //sgtree/sg_set/sg_multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -370,7 +381,7 @@ template #endif class sgtree; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -383,7 +394,7 @@ template #endif class sg_set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -396,7 +407,7 @@ template #endif class sg_multiset; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -407,7 +418,7 @@ template #endif class bs_set_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -420,7 +431,7 @@ class bs_set_member_hook; //hashtable/unordered_set/unordered_multiset -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -439,7 +450,7 @@ template #endif class hashtable; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -458,7 +469,7 @@ template #endif class unordered_set; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , class O1 = none @@ -477,7 +488,7 @@ template #endif class unordered_multiset; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -489,7 +500,7 @@ template #endif class unordered_set_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -501,7 +512,7 @@ template #endif class unordered_set_member_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none @@ -512,7 +523,7 @@ template #endif class any_base_hook; -#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class O1 = none , class O2 = none diff --git a/3party/boost/boost/intrusive/list.hpp b/3party/boost/boost/intrusive/list.hpp index 965baa7042..ee3e5baa21 100644 --- a/3party/boost/boost/intrusive/list.hpp +++ b/3party/boost/boost/intrusive/list.hpp @@ -30,6 +30,7 @@ #include #include #include +//iG pending #include namespace boost { namespace intrusive { @@ -129,8 +130,8 @@ class list_impl //Const cast emulation for smart pointers static node_ptr uncast(const_node_ptr ptr) { - //return node_ptr(detail::get_pointer(ptr))); - return const_cast(detail::get_pointer(ptr)); + return const_cast(detail::boost_intrusive_get_pointer(ptr)); + //iG pending return node_ptr(boost::const_pointer_cast(ptr)); } node_ptr get_root_node() @@ -172,6 +173,22 @@ class list_impl real_value_traits &get_real_value_traits(detail::bool_) { return data_.get_value_traits(*this); } + const value_traits &get_value_traits() const + { return data_; } + + value_traits &get_value_traits() + { return data_; } + + protected: + node &prot_root_node() + { return data_.root_plus_size_.root_; } + + node const &prot_root_node() const + { return data_.root_plus_size_.root_; } + + void prot_set_size(size_type s) + { data_.root_plus_size_.set_size(s); } + /// @endcond public: @@ -971,8 +988,8 @@ class list_impl { if(node_traits::get_next(this->get_root_node()) != node_traits::get_previous(this->get_root_node())){ - list_impl carry; - list_impl counter[64]; + list_impl carry(this->get_value_traits()); + detail::array_initializer counter(this->get_value_traits()); int fill = 0; while(!this->empty()){ carry.splice(carry.cbegin(), *this, this->cbegin()); @@ -1268,7 +1285,7 @@ class list_impl static list_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { root_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &root_plus_size::root_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &root_plus_size::root_); data_t *d = detail::parent_from_member ( r, &data_t::root_plus_size_); list_impl *s = detail::parent_from_member(d, &list_impl::data_); diff --git a/3party/boost/boost/intrusive/member_value_traits.hpp b/3party/boost/boost/intrusive/member_value_traits.hpp index ce7e56b3a4..4490d4949d 100644 --- a/3party/boost/boost/intrusive/member_value_traits.hpp +++ b/3party/boost/boost/intrusive/member_value_traits.hpp @@ -49,13 +49,13 @@ struct member_value_traits static pointer to_value_ptr(node_ptr n) { return pointer(detail::parent_from_member - (detail::get_pointer(n), PtrToMember)); + (detail::boost_intrusive_get_pointer(n), PtrToMember)); } static const_pointer to_value_ptr(const_node_ptr n) { return pointer(detail::parent_from_member - (detail::get_pointer(n), PtrToMember)); + (detail::boost_intrusive_get_pointer(n), PtrToMember)); } }; diff --git a/3party/boost/boost/intrusive/options.hpp b/3party/boost/boost/intrusive/options.hpp index d692b1ea40..973165118b 100644 --- a/3party/boost/boost/intrusive/options.hpp +++ b/3party/boost/boost/intrusive/options.hpp @@ -343,6 +343,24 @@ struct member_hook }; +//!This option setter specifies the function object that will +//!be used to convert between values to be inserted in a container +//!and the hook to be used for that purpose. +template< typename Functor> +struct function_hook +{ +/// @cond + typedef detail::function_hook_traits + function_value_traits; + template + struct pack : Base + { + typedef function_value_traits value_traits; + }; +/// @endcond +}; + + //!This option setter specifies that the container //!must use the specified base hook template diff --git a/3party/boost/boost/intrusive/parent_from_member.hpp b/3party/boost/boost/intrusive/parent_from_member.hpp new file mode 100644 index 0000000000..882c073531 --- /dev/null +++ b/3party/boost/boost/intrusive/parent_from_member.hpp @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2010-2010 +// +// 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/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP +#define BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP + +#include +#include + +namespace boost { +namespace intrusive { + +//! Given a pointer to a member and its corresponding pointer to data member, +//! this function returns the pointer of the parent containing that member. +//! Note: this function does not work with pointer to members that rely on +//! virtual inheritance. +template +inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member) +{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } + +//! Given a const pointer to a member and its corresponding const pointer to data member, +//! this function returns the const pointer of the parent containing that member. +//! Note: this function does not work with pointer to members that rely on +//! virtual inheritance. +template +inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member) +{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } + +} //namespace intrusive { +} //namespace boost { + +#include + +#endif //#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP diff --git a/3party/boost/boost/intrusive/rbtree.hpp b/3party/boost/boost/intrusive/rbtree.hpp index 8d9cacf494..c8e8ab5001 100644 --- a/3party/boost/boost/intrusive/rbtree.hpp +++ b/3party/boost/boost/intrusive/rbtree.hpp @@ -33,6 +33,7 @@ #include #include #include +//iG pending #include namespace boost { namespace intrusive { @@ -110,10 +111,8 @@ class rbtree_impl typedef std::reverse_iterator const_reverse_iterator; typedef typename real_value_traits::node_traits node_traits; typedef typename node_traits::node node; - typedef typename boost::pointer_to_other - ::type node_ptr; - typedef typename boost::pointer_to_other - ::type const_node_ptr; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; typedef rbtree_algorithms node_algorithms; static const bool constant_time_size = Config::constant_time_size; @@ -152,7 +151,7 @@ class rbtree_impl {} node_plus_pred_t node_plus_pred_; } data_; - + const value_compare &priv_comp() const { return data_.node_plus_pred_.get(); } @@ -167,7 +166,8 @@ class rbtree_impl static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(detail::get_pointer(ptr))); + return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); +//iG pending return node_ptr(boost::const_pointer_cast(ptr)); } size_traits &priv_size_traits() @@ -188,6 +188,19 @@ class rbtree_impl real_value_traits &get_real_value_traits(detail::bool_) { return data_.get_value_traits(*this); } + protected: + value_compare &prot_comp() + { return priv_comp(); } + + const node &prot_header_node() const + { return priv_header(); } + + node &prot_header_node() + { return priv_header(); } + + void prot_set_size(size_type s) + { this->priv_size_traits().set_size(s); } + /// @endcond public: @@ -1390,7 +1403,7 @@ class rbtree_impl static rbtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_size_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/3party/boost/boost/intrusive/rbtree_algorithms.hpp b/3party/boost/boost/intrusive/rbtree_algorithms.hpp index ca6f7eb969..5458e4fef5 100644 --- a/3party/boost/boost/intrusive/rbtree_algorithms.hpp +++ b/3party/boost/boost/intrusive/rbtree_algorithms.hpp @@ -57,7 +57,6 @@ #include #include - namespace boost { namespace intrusive { @@ -157,7 +156,7 @@ class rbtree_algorithms static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); } /// @endcond diff --git a/3party/boost/boost/intrusive/set.hpp b/3party/boost/boost/intrusive/set.hpp index 54c5a65ade..c85ab08888 100644 --- a/3party/boost/boost/intrusive/set.hpp +++ b/3party/boost/boost/intrusive/set.hpp @@ -75,9 +75,19 @@ class set_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + //static const bool stateful_value_traits = detail::is_stateful_value_traits::value; + /// @cond private: tree_type tree_; + + protected: + node &prot_header_node(){ return tree_.prot_header_node(); } + node const &prot_header_node() const{ return tree_.prot_header_node(); } + void prot_set_size(size_type s){ tree_.prot_set_size(s); } + value_compare &prot_comp(){ return tree_.prot_comp(); } + /// @endcond public: @@ -1265,9 +1275,18 @@ class multiset_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + //static const bool stateful_value_traits = detail::is_stateful_value_traits::value; + /// @cond private: tree_type tree_; + + protected: + node &prot_header_node(){ return tree_.prot_header_node(); } + node const &prot_header_node() const{ return tree_.prot_header_node(); } + void prot_set_size(size_type s){ tree_.prot_set_size(s); } + value_compare &prot_comp(){ return tree_.prot_comp(); } /// @endcond public: @@ -1450,7 +1469,7 @@ class multiset_impl //! //! Throws: Nothing. //! - //! Complexity: Constant. + //! Complexity: Logarithmic. static multiset_impl &container_from_iterator(iterator it) { return *detail::parent_from_member @@ -1464,7 +1483,7 @@ class multiset_impl //! //! Throws: Nothing. //! - //! Complexity: Constant. + //! Complexity: Logarithmic. static const multiset_impl &container_from_iterator(const_iterator it) { return *detail::parent_from_member diff --git a/3party/boost/boost/intrusive/sgtree.hpp b/3party/boost/boost/intrusive/sgtree.hpp index 5507893ddb..5cc361ab60 100644 --- a/3party/boost/boost/intrusive/sgtree.hpp +++ b/3party/boost/boost/intrusive/sgtree.hpp @@ -310,7 +310,7 @@ class sgtree_impl { return data_.node_plus_pred_.header_plus_alpha_.header_; } static node_ptr uncast(const_node_ptr ptr) - { return node_ptr(const_cast(detail::get_pointer(ptr))); } + { return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() { return data_.node_plus_pred_.size_traits_; } @@ -1631,7 +1631,7 @@ class sgtree_impl static sgtree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_alpha *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_alpha::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_alpha_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/3party/boost/boost/intrusive/sgtree_algorithms.hpp b/3party/boost/boost/intrusive/sgtree_algorithms.hpp index bb6ef062eb..99e9d3980f 100644 --- a/3party/boost/boost/intrusive/sgtree_algorithms.hpp +++ b/3party/boost/boost/intrusive/sgtree_algorithms.hpp @@ -70,7 +70,7 @@ class sgtree_algorithms static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); } /// @endcond diff --git a/3party/boost/boost/intrusive/slist.hpp b/3party/boost/boost/intrusive/slist.hpp index 8314a755e8..6aad69ebbe 100644 --- a/3party/boost/boost/intrusive/slist.hpp +++ b/3party/boost/boost/intrusive/slist.hpp @@ -31,6 +31,7 @@ #include #include //std::size_t #include //std::pair +//iG pending #include namespace boost { namespace intrusive { @@ -129,10 +130,9 @@ class slist_impl typedef slist_iterator const_iterator; typedef typename real_value_traits::node_traits node_traits; typedef typename node_traits::node node; - typedef typename boost::pointer_to_other - ::type node_ptr; - typedef typename boost::pointer_to_other - ::type const_node_ptr; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename detail::if_c < Config::linear , linear_slist_algorithms @@ -206,7 +206,8 @@ class slist_impl { data_.root_plus_size_.last_ = n; } static node_ptr uncast(const_node_ptr ptr) - { return node_ptr(const_cast(detail::get_pointer(ptr))); } + { return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } +//iG pending { return boost::const_pointer_cast(ptr); } void set_default_constructed_state() { @@ -251,6 +252,22 @@ class slist_impl real_value_traits &get_real_value_traits(detail::bool_) { return data_.get_value_traits(*this); } + const value_traits &get_value_traits() const + { return data_; } + + value_traits &get_value_traits() + { return data_; } + + protected: + node &prot_root_node() + { return data_.root_plus_size_.root_; } + + node const &prot_root_node() const + { return data_.root_plus_size_.root_; } + + void prot_set_size(size_type s) + { data_.root_plus_size_.set_size(s); } + /// @endcond public: @@ -1220,7 +1237,7 @@ class slist_impl //! assigned to the last spliced element or prev if x is empty. //! This iterator can be used as new "prev" iterator for a new splice_after call. //! that will splice new values after the previously spliced values. - void splice(const_iterator it, slist_impl &x, iterator *last = 0) + void splice(const_iterator it, slist_impl &x, const_iterator *last = 0) { this->splice_after(this->previous(it), x, last); } //! Requires: it p must be a valid iterator of *this. @@ -1295,8 +1312,9 @@ class slist_impl { if (node_traits::get_next(node_traits::get_next(this->get_root_node())) != this->get_root_node()) { - slist_impl carry; - slist_impl counter[64]; + + slist_impl carry(this->get_value_traits()); + detail::array_initializer counter(this->get_value_traits()); int fill = 0; const_iterator last_inserted; while(!this->empty()){ @@ -1879,7 +1897,7 @@ class slist_impl //singly linked lists (because "end" is represented by the null pointer) BOOST_STATIC_ASSERT(!linear); root_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_)); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), (&root_plus_size::root_)); data_t *d = detail::parent_from_member ( r, &data_t::root_plus_size_); slist_impl *s = detail::parent_from_member(d, &slist_impl::data_); diff --git a/3party/boost/boost/intrusive/splay_set.hpp b/3party/boost/boost/intrusive/splay_set.hpp index 9727d14787..f899e78a44 100644 --- a/3party/boost/boost/intrusive/splay_set.hpp +++ b/3party/boost/boost/intrusive/splay_set.hpp @@ -74,6 +74,8 @@ class splay_set_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; @@ -1286,6 +1288,8 @@ class splay_multiset_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; diff --git a/3party/boost/boost/intrusive/splaytree.hpp b/3party/boost/boost/intrusive/splaytree.hpp index 4020c8574e..1cb2a2a797 100644 --- a/3party/boost/boost/intrusive/splaytree.hpp +++ b/3party/boost/boost/intrusive/splaytree.hpp @@ -166,7 +166,7 @@ class splaytree_impl static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(detail::get_pointer(ptr))); + return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() @@ -1405,7 +1405,7 @@ class splaytree_impl static splaytree_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); node_plus_pred_t *n = detail::parent_from_member (r, &node_plus_pred_t::header_plus_size_); data_t *d = detail::parent_from_member(n, &data_t::node_plus_pred_); diff --git a/3party/boost/boost/intrusive/splaytree_algorithms.hpp b/3party/boost/boost/intrusive/splaytree_algorithms.hpp index eb25e9f61f..777b3b9b5e 100644 --- a/3party/boost/boost/intrusive/splaytree_algorithms.hpp +++ b/3party/boost/boost/intrusive/splaytree_algorithms.hpp @@ -147,7 +147,7 @@ class splaytree_algorithms private: static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); } /// @endcond diff --git a/3party/boost/boost/intrusive/treap.hpp b/3party/boost/boost/intrusive/treap.hpp index b7c9ed2724..86bdd0145a 100644 --- a/3party/boost/boost/intrusive/treap.hpp +++ b/3party/boost/boost/intrusive/treap.hpp @@ -116,7 +116,7 @@ class treap_impl ::type node_ptr; typedef typename boost::pointer_to_other ::type const_node_ptr; - typedef treap_algorithms node_algorithms; + typedef treap_algorithms node_algorithms; static const bool constant_time_size = Config::constant_time_size; static const bool stateful_value_traits = detail::is_stateful_value_traits::value; @@ -184,7 +184,7 @@ class treap_impl static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(detail::get_pointer(ptr))); + return node_ptr(const_cast(detail::boost_intrusive_get_pointer(ptr))); } size_traits &priv_size_traits() @@ -1482,7 +1482,7 @@ class treap_impl static treap_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) { header_plus_size *r = detail::parent_from_member - ( detail::get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); + ( detail::boost_intrusive_get_pointer(end_iterator.pointed_node()), &header_plus_size::header_); typename node_plus_pred_t::header_plus_priority_size *n = detail::parent_from_member < typename node_plus_pred_t::header_plus_priority_size diff --git a/3party/boost/boost/intrusive/treap_algorithms.hpp b/3party/boost/boost/intrusive/treap_algorithms.hpp index 6c05efa6fb..a1208156c1 100644 --- a/3party/boost/boost/intrusive/treap_algorithms.hpp +++ b/3party/boost/boost/intrusive/treap_algorithms.hpp @@ -145,7 +145,7 @@ class treap_algorithms static node_ptr uncast(const_node_ptr ptr) { - return node_ptr(const_cast(::boost::intrusive::detail::get_pointer(ptr))); + return node_ptr(const_cast(::boost::intrusive::detail::boost_intrusive_get_pointer(ptr))); } /// @endcond diff --git a/3party/boost/boost/intrusive/treap_set.hpp b/3party/boost/boost/intrusive/treap_set.hpp index 12611ee73c..ef38a1ed6a 100644 --- a/3party/boost/boost/intrusive/treap_set.hpp +++ b/3party/boost/boost/intrusive/treap_set.hpp @@ -75,6 +75,8 @@ class treap_set_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; @@ -1382,6 +1384,8 @@ class treap_multiset_impl typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef typename implementation_defined::node_algorithms node_algorithms; + static const bool constant_time_size = Config::constant_time_size; + /// @cond private: tree_type tree_; diff --git a/3party/boost/boost/intrusive/unordered_set.hpp b/3party/boost/boost/intrusive/unordered_set.hpp index 47d1aab5ab..2b40f6148b 100644 --- a/3party/boost/boost/intrusive/unordered_set.hpp +++ b/3party/boost/boost/intrusive/unordered_set.hpp @@ -248,7 +248,7 @@ class unordered_set_impl //! Effects: Returns the number of elements stored in the unordered_set. //! //! Complexity: Linear to elements contained in *this if - //! constant-time size option is enabled. Constant-time otherwise. + //! constant-time size option is disabled. Constant-time otherwise. //! //! Throws: Nothing. size_type size() const @@ -395,8 +395,8 @@ class unordered_set_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased element. No destructors are called. - iterator erase(const_iterator i) - { return table_.erase(i); } + void erase(const_iterator i) + { table_.erase(i); } //! Effects: Erases the range pointed to by b end e. //! @@ -407,8 +407,8 @@ class unordered_set_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. - iterator erase(const_iterator b, const_iterator e) - { return table_.erase(b, e); } + void erase(const_iterator b, const_iterator e) + { table_.erase(b, e); } //! Effects: Erases all the elements with the given value. //! @@ -460,12 +460,12 @@ class unordered_set_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator i, Disposer disposer + void erase_and_dispose(const_iterator i, Disposer disposer /// @cond , typename detail::enable_if_c::value >::type * = 0 /// @endcond ) - { return table_.erase_and_dispose(i, disposer); } + { table_.erase_and_dispose(i, disposer); } //! Requires: Disposer::operator()(pointer) shouldn't throw. //! @@ -480,8 +480,8 @@ class unordered_set_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) - { return table_.erase_and_dispose(b, e, disposer); } + void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { table_.erase_and_dispose(b, e, disposer); } //! Requires: Disposer::operator()(pointer) shouldn't throw. //! @@ -1305,7 +1305,7 @@ class unordered_multiset_impl //! Effects: Returns the number of elements stored in the unordered_multiset. //! //! Complexity: Linear to elements contained in *this if - //! constant-time size option is enabled. Constant-time otherwise. + //! constant-time size option is disabled. Constant-time otherwise. //! //! Throws: Nothing. size_type size() const @@ -1387,8 +1387,8 @@ class unordered_multiset_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased element. No destructors are called. - iterator erase(const_iterator i) - { return table_.erase(i); } + void erase(const_iterator i) + { table_.erase(i); } //! Effects: Erases the range pointed to by b end e. //! @@ -1399,8 +1399,8 @@ class unordered_multiset_impl //! //! Note: Invalidates the iterators (but not the references) //! to the erased elements. No destructors are called. - iterator erase(const_iterator b, const_iterator e) - { return table_.erase(b, e); } + void erase(const_iterator b, const_iterator e) + { table_.erase(b, e); } //! Effects: Erases all the elements with the given value. //! @@ -1453,17 +1453,17 @@ class unordered_multiset_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator i, Disposer disposer + void erase_and_dispose(const_iterator i, Disposer disposer /// @cond , typename detail::enable_if_c::value >::type * = 0 /// @endcond ) - { return table_.erase_and_dispose(i, disposer); } + { table_.erase_and_dispose(i, disposer); } #if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) template - iterator erase_and_dispose(const_iterator i, Disposer disposer) - { return this->erase_and_dispose(const_iterator(i), disposer); } + void erase_and_dispose(const_iterator i, Disposer disposer) + { this->erase_and_dispose(const_iterator(i), disposer); } #endif //! Requires: Disposer::operator()(pointer) shouldn't throw. @@ -1479,8 +1479,8 @@ class unordered_multiset_impl //! Note: Invalidates the iterators //! to the erased elements. template - iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) - { return table_.erase_and_dispose(b, e, disposer); } + void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) + { table_.erase_and_dispose(b, e, disposer); } //! Requires: Disposer::operator()(pointer) shouldn't throw. //! diff --git a/3party/boost/boost/intrusive/unordered_set_hook.hpp b/3party/boost/boost/intrusive/unordered_set_hook.hpp index 286b318f9b..61f4a72c9c 100644 --- a/3party/boost/boost/intrusive/unordered_set_hook.hpp +++ b/3party/boost/boost/intrusive/unordered_set_hook.hpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -76,7 +77,12 @@ struct unordered_node_traits static const bool optimize_multikey = OptimizeMultiKey; static node_ptr get_next(const_node_ptr n) - { return node_ptr(&static_cast(*n->next_)); } + { +// This still fails in gcc < 4.4 so forget about it +// using ::boost::static_pointer_cast; +// return static_pointer_cast(n->next_); + return node_ptr(&static_cast(*n->next_)); + } static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } diff --git a/3party/boost/boost/math/bindings/rr.hpp b/3party/boost/boost/math/bindings/rr.hpp index 7b72f81f8e..58c22b8891 100644 --- a/3party/boost/boost/math/bindings/rr.hpp +++ b/3party/boost/boost/math/bindings/rr.hpp @@ -682,13 +682,13 @@ namespace ntl{ { asin_root(RR const& target) : t(target){} - std::tr1::tuple operator()(RR const& p) + boost::math::tuple operator()(RR const& p) { RR f0 = sin(p); RR f1 = cos(p); RR f2 = -f0; f0 -= t; - return std::tr1::make_tuple(f0, f1, f2); + return boost::math::make_tuple(f0, f1, f2); } private: RR t; @@ -710,13 +710,13 @@ namespace ntl{ { acos_root(RR const& target) : t(target){} - std::tr1::tuple operator()(RR const& p) + boost::math::tuple operator()(RR const& p) { RR f0 = cos(p); RR f1 = -sin(p); RR f2 = -f0; f0 -= t; - return std::tr1::make_tuple(f0, f1, f2); + return boost::math::make_tuple(f0, f1, f2); } private: RR t; @@ -738,14 +738,14 @@ namespace ntl{ { atan_root(RR const& target) : t(target){} - std::tr1::tuple operator()(RR const& p) + boost::math::tuple operator()(RR const& p) { RR c = cos(p); RR ta = tan(p); RR f0 = ta - t; RR f1 = 1 / (c * c); RR f2 = 2 * ta / (c * c); - return std::tr1::make_tuple(f0, f1, f2); + return boost::math::make_tuple(f0, f1, f2); } private: RR t; diff --git a/3party/boost/boost/math/distributions.hpp b/3party/boost/boost/math/distributions.hpp index ecbc616a0e..1624cb8b3f 100644 --- a/3party/boost/boost/math/distributions.hpp +++ b/3party/boost/boost/math/distributions.hpp @@ -1,12 +1,12 @@ // Copyright John Maddock 2006, 2007. -// Copyright Paul A. Bristow 2006, 2007, 2009. +// Copyright Paul A. Bristow 2006, 2007, 2009, 2010. // 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) // This file includes *all* the distributions. -// this may be useful if many are used +// this *may* be convenient if many are used // - to avoid including each distribution individually. #ifndef BOOST_MATH_DISTRIBUTIONS_HPP @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/3party/boost/boost/math/distributions/bernoulli.hpp b/3party/boost/boost/math/distributions/bernoulli.hpp index aeb6c8f3a1..137ed0f208 100644 --- a/3party/boost/boost/math/distributions/bernoulli.hpp +++ b/3party/boost/boost/math/distributions/bernoulli.hpp @@ -119,14 +119,14 @@ namespace boost inline const std::pair range(const bernoulli_distribution& /* dist */) { // Range of permissible values for random variable k = {0, 1}. using boost::math::tools::max_value; - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template inline const std::pair support(const bernoulli_distribution& /* dist */) { // Range of supported values for random variable k = {0, 1}. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template diff --git a/3party/boost/boost/math/distributions/beta.hpp b/3party/boost/boost/math/distributions/beta.hpp index d1b753c3ab..0573d1d010 100644 --- a/3party/boost/boost/math/distributions/beta.hpp +++ b/3party/boost/boost/math/distributions/beta.hpp @@ -279,14 +279,14 @@ namespace boost inline const std::pair range(const beta_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template inline const std::pair support(const beta_distribution& /* dist */) { // Range of supported values for random variable x. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template diff --git a/3party/boost/boost/math/distributions/binomial.hpp b/3party/boost/boost/math/distributions/binomial.hpp index e6c451a12e..ff70b819cd 100644 --- a/3party/boost/boost/math/distributions/binomial.hpp +++ b/3party/boost/boost/math/distributions/binomial.hpp @@ -421,7 +421,7 @@ namespace boost const std::pair support(const binomial_distribution& dist) { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - return std::pair(0, dist.trials()); + return std::pair(static_cast(0), dist.trials()); } template diff --git a/3party/boost/boost/math/distributions/chi_squared.hpp b/3party/boost/boost/math/distributions/chi_squared.hpp index 0b7d2ef40d..367a7154a3 100644 --- a/3party/boost/boost/math/distributions/chi_squared.hpp +++ b/3party/boost/boost/math/distributions/chi_squared.hpp @@ -1,5 +1,5 @@ // Copyright John Maddock 2006, 2007. -// Copyright Paul A. Bristow 2008. +// Copyright Paul A. Bristow 2008, 2010. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. @@ -59,14 +59,14 @@ template inline const std::pair range(const chi_squared_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, max_value()); // 0 to + infinity. + return std::pair(static_cast(0), max_value()); // 0 to + infinity. } template inline const std::pair support(const chi_squared_distribution& /*dist*/) { // Range of supported values for random variable x. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. - return std::pair(0, tools::max_value()); // 0 to + infinity. + return std::pair(static_cast(0), tools::max_value()); // 0 to + infinity. } template @@ -267,7 +267,9 @@ template struct df_estimator { df_estimator(RealType a, RealType b, RealType variance, RealType delta) - : alpha(a), beta(b), ratio(delta/variance) {} + : alpha(a), beta(b), ratio(delta/variance) + { // Constructor + } RealType operator()(const RealType& df) { @@ -282,14 +284,16 @@ struct df_estimator result = cdf(cs, quantile(complement(cs, alpha)) / r) - beta; } else - { + { // ratio <= 0 RealType r = 1 + ratio; result = cdf(complement(cs, quantile(cs, alpha) / r)) - beta; } return result; } private: - RealType alpha, beta, ratio; + RealType alpha; + RealType beta; + RealType ratio; // Difference from variance / variance, so fractional. }; } // namespace detail @@ -305,18 +309,23 @@ RealType chi_squared_distribution::find_degrees_of_freedom( static const char* function = "boost::math::chi_squared_distribution<%1%>::find_degrees_of_freedom(%1%,%1%,%1%,%1%,%1%)"; // Check for domain errors: RealType error_result; - if(false == detail::check_probability( - function, alpha, &error_result, Policy()) - && detail::check_probability(function, beta, &error_result, Policy())) + if(false == + detail::check_probability(function, alpha, &error_result, Policy()) + && detail::check_probability(function, beta, &error_result, Policy())) + { // Either probability is outside 0 to 1. return error_result; + } if(hint <= 0) + { // No hint given, so guess df = 1. hint = 1; + } detail::df_estimator f(alpha, beta, variance, difference_from_variance); tools::eps_tolerance tol(policies::digits()); boost::uintmax_t max_iter = policies::get_max_root_iterations(); - std::pair r = tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter, Policy()); + std::pair r = + tools::bracket_and_solve_root(f, hint, RealType(2), false, tol, max_iter, Policy()); RealType result = r.first + (r.second - r.first) / 2; if(max_iter >= policies::get_max_root_iterations()) { diff --git a/3party/boost/boost/math/distributions/complement.hpp b/3party/boost/boost/math/distributions/complement.hpp index 7eb08753ab..26d0d49e6d 100644 --- a/3party/boost/boost/math/distributions/complement.hpp +++ b/3party/boost/boost/math/distributions/complement.hpp @@ -9,7 +9,7 @@ // // This code really defines our own tuple type. -// It would be nice to reuse std::tr1::tuple +// It would be nice to reuse boost::math::tuple // while retaining our own type safety, but it's // not clear if that's possible. In any case this // code is *very* lightweight. diff --git a/3party/boost/boost/math/distributions/detail/inv_discrete_quantile.hpp b/3party/boost/boost/math/distributions/detail/inv_discrete_quantile.hpp index d4f424c8e2..2762a96eb6 100644 --- a/3party/boost/boost/math/distributions/detail/inv_discrete_quantile.hpp +++ b/3party/boost/boost/math/distributions/detail/inv_discrete_quantile.hpp @@ -92,7 +92,7 @@ typename Dist::value_type // Max bounds of the distribution: // value_type min_bound, max_bound; - std::tr1::tie(min_bound, max_bound) = support(dist); + boost::math::tie(min_bound, max_bound) = support(dist); if(guess > max_bound) guess = max_bound; diff --git a/3party/boost/boost/math/distributions/fisher_f.hpp b/3party/boost/boost/math/distributions/fisher_f.hpp index 066714adb5..fe7fa06d28 100644 --- a/3party/boost/boost/math/distributions/fisher_f.hpp +++ b/3party/boost/boost/math/distributions/fisher_f.hpp @@ -58,7 +58,7 @@ template inline const std::pair range(const fisher_f_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -66,7 +66,7 @@ inline const std::pair support(const fisher_f_distribution(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -177,7 +177,7 @@ inline RealType quantile(const fisher_f_distribution& dist, co function, p, &error_result, Policy())) return error_result; - // With optimizations turned on, gcc wrongly warns about y being used + // With optimizations turned on, gcc wrongly warns about y being used // uninitializated unless we initialize it to something: RealType x, y(0); diff --git a/3party/boost/boost/math/distributions/fwd.hpp b/3party/boost/boost/math/distributions/fwd.hpp index 7ddb9e6bed..d5d4958daa 100644 --- a/3party/boost/boost/math/distributions/fwd.hpp +++ b/3party/boost/boost/math/distributions/fwd.hpp @@ -1,4 +1,6 @@ -// Copyright Paul A. Bristow 2007. +// fwd.hpp Forward declarations of Boost.Math distributions. + +// Copyright Paul A. Bristow 2007, 2010. // Copyright John Maddock 2007. // Use, modification and distribution are subject to the @@ -41,6 +43,12 @@ class gamma_distribution; template class hypergeometric_distribution; +template +class inverse_chi_squared_distribution; + +template +class inverse_gamma_distribution; + template class laplace_distribution; diff --git a/3party/boost/boost/math/distributions/gamma.hpp b/3party/boost/boost/math/distributions/gamma.hpp index 27d27dc000..059c1466ec 100644 --- a/3party/boost/boost/math/distributions/gamma.hpp +++ b/3party/boost/boost/math/distributions/gamma.hpp @@ -103,7 +103,7 @@ template inline const std::pair range(const gamma_distribution& /* dist */) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template diff --git a/3party/boost/boost/math/distributions/inverse_chi_squared.hpp b/3party/boost/boost/math/distributions/inverse_chi_squared.hpp new file mode 100644 index 0000000000..3df6093ec4 --- /dev/null +++ b/3party/boost/boost/math/distributions/inverse_chi_squared.hpp @@ -0,0 +1,391 @@ +// Copyright John Maddock 2010. +// Copyright Paul A. Bristow 2010. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_DISTRIBUTIONS_INVERSE_CHI_SQUARED_HPP +#define BOOST_MATH_DISTRIBUTIONS_INVERSE_CHI_SQUARED_HPP + +#include +#include // for incomplete beta. +#include // for complements. +#include // for error checks. +#include // for isfinite + +// See http://en.wikipedia.org/wiki/Scaled-inverse-chi-square_distribution +// for definitions of this scaled version. +// See http://en.wikipedia.org/wiki/Inverse-chi-square_distribution +// for unscaled version. + +// http://reference.wolfram.com/mathematica/ref/InverseChiSquareDistribution.html +// Weisstein, Eric W. "Inverse Chi-Squared Distribution." From MathWorld--A Wolfram Web Resource. +// http://mathworld.wolfram.com/InverseChi-SquaredDistribution.html + +#include + +namespace boost{ namespace math{ + +namespace detail +{ + template + inline bool check_inverse_chi_squared( // Check both distribution parameters. + const char* function, + RealType degrees_of_freedom, // degrees_of_freedom (aka nu). + RealType scale, // scale (aka sigma^2) + RealType* result, + const Policy& pol) + { + return check_scale(function, scale, result, pol) + && check_df(function, degrees_of_freedom, + result, pol); + } // bool check_inverse_chi_squared +} // namespace detail + +template > +class inverse_chi_squared_distribution +{ +public: + typedef RealType value_type; + typedef Policy policy_type; + + inverse_chi_squared_distribution(RealType df, RealType scale) : m_df(df), m_scale (scale) + { + RealType result; + detail::check_df( + "boost::math::inverse_chi_squared_distribution<%1%>::inverse_chi_squared_distribution", + m_df, &result, Policy()) + && detail::check_scale( +"boost::math::inverse_chi_squared_distribution<%1%>::inverse_chi_squared_distribution", + m_scale, &result, Policy()); + } // inverse_chi_squared_distribution constructor + + inverse_chi_squared_distribution(RealType df = 1) : m_df(df) + { + RealType result; + m_scale = 1 / m_df ; // Default scale = 1 / degrees of freedom (Wikipedia definition 1). + detail::check_df( + "boost::math::inverse_chi_squared_distribution<%1%>::inverse_chi_squared_distribution", + m_df, &result, Policy()); + } // inverse_chi_squared_distribution + + RealType degrees_of_freedom()const + { + return m_df; // aka nu + } + RealType scale()const + { + return m_scale; // aka xi + } + + // Parameter estimation: NOT implemented yet. + //static RealType find_degrees_of_freedom( + // RealType difference_from_variance, + // RealType alpha, + // RealType beta, + // RealType variance, + // RealType hint = 100); + +private: + // Data members: + RealType m_df; // degrees of freedom are treated as a real number. + RealType m_scale; // distribution scale. + +}; // class chi_squared_distribution + +typedef inverse_chi_squared_distribution inverse_chi_squared; + +template +inline const std::pair range(const inverse_chi_squared_distribution& /*dist*/) +{ // Range of permissible values for random variable x. + using boost::math::tools::max_value; + return std::pair(static_cast(0), max_value()); // 0 to + infinity. +} + +template +inline const std::pair support(const inverse_chi_squared_distribution& /*dist*/) +{ // Range of supported values for random variable x. + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + return std::pair(static_cast(0), tools::max_value()); // 0 to + infinity. +} + +template +RealType pdf(const inverse_chi_squared_distribution& dist, const RealType& x) +{ + BOOST_MATH_STD_USING // for ADL of std functions. + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + RealType error_result; + + static const char* function = "boost::math::pdf(const inverse_chi_squared_distribution<%1%>&, %1%)"; + + if(false == detail::check_inverse_chi_squared + (function, df, scale, &error_result, Policy()) + ) + { // Bad distribution. + return error_result; + } + if((x < 0) || !(boost::math::isfinite)(x)) + { // Bad x. + return policies::raise_domain_error( + function, "inverse Chi Square parameter was %1%, but must be >= 0 !", x, Policy()); + } + + if(x == 0) + { // Treat as special case. + return 0; + } + // Wikipedia scaled inverse chi sq (df, scale) related to inv gamma (df/2, df * scale /2) + // so use inverse gamma pdf with shape = df/2, scale df * scale /2 + // RealType shape = df /2; // inv_gamma shape + // RealType scale = df * scale/2; // inv_gamma scale + // RealType result = gamma_p_derivative(shape, scale / x, Policy()) * scale / (x * x); + RealType result = df * scale/2 / x; + if(result < tools::min_value()) + return 0; // Random variable is near enough infinite. + result = gamma_p_derivative(df/2, result, Policy()) * df * scale/2; + if(result != 0) // prevent 0 / 0: + result /= (x * x); + return result; +} // pdf + +template +inline RealType cdf(const inverse_chi_squared_distribution& dist, const RealType& x) +{ + static const char* function = "boost::math::cdf(const inverse_chi_squared_distribution<%1%>&, %1%)"; + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + RealType error_result; + + if(false == + detail::check_inverse_chi_squared(function, df, scale, &error_result, Policy()) + ) + { // Bad distribution. + return error_result; + } + if((x < 0) || !(boost::math::isfinite)(x)) + { // Bad x. + return policies::raise_domain_error( + function, "inverse Chi Square parameter was %1%, but must be >= 0 !", x, Policy()); + } + if (x == 0) + { // Treat zero as a special case. + return 0; + } + // RealType shape = df /2; // inv_gamma shape, + // RealType scale = df * scale/2; // inv_gamma scale, + // result = boost::math::gamma_q(shape, scale / x, Policy()); // inverse_gamma code. + return boost::math::gamma_q(df / 2, (df * (scale / 2)) / x, Policy()); +} // cdf + +template +inline RealType quantile(const inverse_chi_squared_distribution& dist, const RealType& p) +{ + using boost::math::gamma_q_inv; + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + + static const char* function = "boost::math::quantile(const inverse_chi_squared_distribution<%1%>&, %1%)"; + // Error check: + RealType error_result; + if(false == detail::check_df( + function, df, &error_result, Policy()) + && detail::check_probability( + function, p, &error_result, Policy())) + { + return error_result; + } + if(false == detail::check_probability( + function, p, &error_result, Policy())) + { + return error_result; + } + // RealType shape = df /2; // inv_gamma shape, + // RealType scale = df * scale/2; // inv_gamma scale, + // result = scale / gamma_q_inv(shape, p, Policy()); + RealType result = gamma_q_inv(df /2, p, Policy()); + if(result == 0) + return policies::raise_overflow_error(function, "Random variable is infinite.", Policy()); + result = df * (scale / 2) / result; + return result; +} // quantile + +template +inline RealType cdf(const complemented2_type, RealType>& c) +{ + using boost::math::gamma_q_inv; + RealType const& df = c.dist.degrees_of_freedom(); + RealType const& scale = c.dist.scale(); + RealType const& x = c.param; + static const char* function = "boost::math::cdf(const inverse_chi_squared_distribution<%1%>&, %1%)"; + // Error check: + RealType error_result; + if(false == detail::check_df( + function, df, &error_result, Policy())) + { + return error_result; + } + if (x == 0) + { // Treat zero as a special case. + return 1; + } + if((x < 0) || !(boost::math::isfinite)(x)) + { + return policies::raise_domain_error( + function, "inverse Chi Square parameter was %1%, but must be > 0 !", x, Policy()); + } + // RealType shape = df /2; // inv_gamma shape, + // RealType scale = df * scale/2; // inv_gamma scale, + // result = gamma_p(shape, scale/c.param, Policy()); use inv_gamma. + + return gamma_p(df / 2, (df * scale/2) / x, Policy()); // OK +} // cdf(complemented + +template +inline RealType quantile(const complemented2_type, RealType>& c) +{ + using boost::math::gamma_q_inv; + + RealType const& df = c.dist.degrees_of_freedom(); + RealType const& scale = c.dist.scale(); + RealType const& q = c.param; + static const char* function = "boost::math::quantile(const inverse_chi_squared_distribution<%1%>&, %1%)"; + // Error check: + RealType error_result; + if(false == detail::check_df(function, df, &error_result, Policy())) + { + return error_result; + } + if(false == detail::check_probability(function, q, &error_result, Policy())) + { + return error_result; + } + // RealType shape = df /2; // inv_gamma shape, + // RealType scale = df * scale/2; // inv_gamma scale, + // result = scale / gamma_p_inv(shape, q, Policy()); // using inv_gamma. + RealType result = gamma_p_inv(df/2, q, Policy()); + if(result == 0) + return policies::raise_overflow_error(function, "Random variable is infinite.", Policy()); + result = (df * scale / 2) / result; + return result; +} // quantile(const complement + +template +inline RealType mean(const inverse_chi_squared_distribution& dist) +{ // Mean of inverse Chi-Squared distribution. + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + + static const char* function = "boost::math::mean(const inverse_chi_squared_distribution<%1%>&)"; + if(df <= 2) + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a mode for degrees of freedom > 2, but got degrees of freedom = %1%.", + df, Policy()); + return (df * scale) / (df - 2); +} // mean + +template +inline RealType variance(const inverse_chi_squared_distribution& dist) +{ // Variance of inverse Chi-Squared distribution. + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + static const char* function = "boost::math::variance(const inverse_chi_squared_distribution<%1%>&)"; + if(df <= 4) + { + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a variance for degrees of freedom > 4, but got degrees of freedom = %1%.", + df, Policy()); return 2 * dist.degrees_of_freedom(); + } + return 2 * df * df * scale * scale / ((df - 2)*(df - 2) * (df - 4)); +} // variance + +template +inline RealType mode(const inverse_chi_squared_distribution& dist) +{ // mode is not defined in Mathematica. + // See Discussion section http://en.wikipedia.org/wiki/Talk:Scaled-inverse-chi-square_distribution + // for origin of the formula used below. + + RealType df = dist.degrees_of_freedom(); + RealType scale = dist.scale(); + static const char* function = "boost::math::mode(const inverse_chi_squared_distribution<%1%>&)"; + if(df < 0) + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a mode for degrees of freedom >= 0, but got degrees of freedom = %1%.", + df, Policy()); + return (df * scale) / (df + 2); +} + +//template +//inline RealType median(const inverse_chi_squared_distribution& dist) +//{ // Median is given by Quantile[dist, 1/2] +// RealType df = dist.degrees_of_freedom(); +// if(df <= 1) +// return tools::domain_error( +// BOOST_CURRENT_FUNCTION, +// "The inverse_Chi-Squared distribution only has a median for degrees of freedom >= 0, but got degrees of freedom = %1%.", +// df); +// return df; +//} +// Now implemented via quantile(half) in derived accessors. + +template +inline RealType skewness(const inverse_chi_squared_distribution& dist) +{ + BOOST_MATH_STD_USING // For ADL + RealType df = dist.degrees_of_freedom(); + static const char* function = "boost::math::skewness(const inverse_chi_squared_distribution<%1%>&)"; + if(df <= 6) + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a skewness for degrees of freedom > 6, but got degrees of freedom = %1%.", + df, Policy()); + + return 4 * sqrt (2 * (df - 4)) / (df - 6); // Not a function of scale. +} + +template +inline RealType kurtosis(const inverse_chi_squared_distribution& dist) +{ + RealType df = dist.degrees_of_freedom(); + static const char* function = "boost::math::kurtosis(const inverse_chi_squared_distribution<%1%>&)"; + if(df <= 8) + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a kurtosis for degrees of freedom > 8, but got degrees of freedom = %1%.", + df, Policy()); + + return kurtosis_excess(dist) + 3; +} + +template +inline RealType kurtosis_excess(const inverse_chi_squared_distribution& dist) +{ + RealType df = dist.degrees_of_freedom(); + static const char* function = "boost::math::kurtosis(const inverse_chi_squared_distribution<%1%>&)"; + if(df <= 8) + return policies::raise_domain_error( + function, + "inverse Chi-Squared distribution only has a kurtosis excess for degrees of freedom > 8, but got degrees of freedom = %1%.", + df, Policy()); + + return 12 * (5 * df - 22) / ((df - 6 )*(df - 8)); // Not a function of scale. +} + +// +// Parameter estimation comes last: +// + +} // namespace math +} // namespace boost + +// This include must be at the end, *after* the accessors +// for this distribution have been defined, in order to +// keep compilers that support two-phase lookup happy. +#include + +#endif // BOOST_MATH_DISTRIBUTIONS_INVERSE_CHI_SQUARED_HPP diff --git a/3party/boost/boost/math/distributions/inverse_gamma.hpp b/3party/boost/boost/math/distributions/inverse_gamma.hpp new file mode 100644 index 0000000000..4f274d9cf6 --- /dev/null +++ b/3party/boost/boost/math/distributions/inverse_gamma.hpp @@ -0,0 +1,458 @@ +// inverse_gamma.hpp + +// Copyright Paul A. Bristow 2010. +// Copyright John Maddock 2010. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_STATS_INVERSE_GAMMA_HPP +#define BOOST_STATS_INVERSE_GAMMA_HPP + +// Inverse Gamma Distribution is a two-parameter family +// of continuous probability distributions +// on the positive real line, which is the distribution of +// the reciprocal of a variable distributed according to the gamma distribution. + +// http://en.wikipedia.org/wiki/Inverse-gamma_distribution +// http://rss.acs.unt.edu/Rdoc/library/pscl/html/igamma.html + +// See also gamma distribution at gamma.hpp: +// http://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm +// http://mathworld.wolfram.com/GammaDistribution.html +// http://en.wikipedia.org/wiki/Gamma_distribution + +#include +#include +#include +#include + +#include + +namespace boost{ namespace math +{ +namespace detail +{ + +template +inline bool check_inverse_gamma_shape( + const char* function, // inverse_gamma + RealType shape, // shape aka alpha + RealType* result, // to update, perhaps with NaN + const Policy& pol) +{ // Sources say shape argument must be > 0 + // but seems logical to allow shape zero as special case, + // returning pdf and cdf zero (but not < 0). + // (Functions like mean, variance with other limits on shape are checked + // in version including an operator & limit below). + if((shape < 0) || !(boost::math::isfinite)(shape)) + { + *result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but must be >= 0 !", shape, pol); + return false; + } + return true; +} //bool check_inverse_gamma_shape + +template +inline bool check_inverse_gamma_x( + const char* function, + RealType const& x, + RealType* result, const Policy& pol) +{ + if((x < 0) || !(boost::math::isfinite)(x)) + { + *result = policies::raise_domain_error( + function, + "Random variate is %1% but must be >= 0 !", x, pol); + return false; + } + return true; +} + +template +inline bool check_inverse_gamma( + const char* function, // TODO swap these over, so shape is first. + RealType scale, // scale aka beta + RealType shape, // shape aka alpha + RealType* result, const Policy& pol) +{ + return check_scale(function, scale, result, pol) + && check_inverse_gamma_shape(function, shape, result, pol); +} // bool check_inverse_gamma + +} // namespace detail + +template > +class inverse_gamma_distribution +{ +public: + typedef RealType value_type; + typedef Policy policy_type; + + inverse_gamma_distribution(RealType shape = 1, RealType scale = 1) + : m_shape(shape), m_scale(scale) + { + RealType result; + detail::check_inverse_gamma( + "boost::math::inverse_gamma_distribution<%1%>::inverse_gamma_distribution", + scale, shape, &result, Policy()); + } + + RealType shape()const + { + return m_shape; + } + + RealType scale()const + { + return m_scale; + } +private: + // + // Data members: + // + RealType m_shape; // distribution shape + RealType m_scale; // distribution scale +}; + +typedef inverse_gamma_distribution inverse_gamma; +// typedef - but potential clash with name of inverse gamma *function*. +// but there is a typedef for gamma +// typedef boost::math::gamma_distribution gamma; + +// Allow random variable x to be zero, treated as a special case (unlike some definitions). + +template +inline const std::pair range(const inverse_gamma_distribution& /* dist */) +{ // Range of permissible values for random variable x. + using boost::math::tools::max_value; + return std::pair(0, max_value()); +} + +template +inline const std::pair support(const inverse_gamma_distribution& /* dist */) +{ // Range of supported values for random variable x. + // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. + using boost::math::tools::max_value; + using boost::math::tools::min_value; + return std::pair(0, max_value()); +} + +template +inline RealType pdf(const inverse_gamma_distribution& dist, const RealType& x) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::pdf(const inverse_gamma_distribution<%1%>&, %1%)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + { // distribution parameters bad. + return result; + } + if(x == 0) + { // Treat random variate zero as a special case. + return 0; + } + else if(false == detail::check_inverse_gamma_x(function, x, &result, Policy())) + { // x bad. + return result; + } + result = scale / x; + if(result < tools::min_value()) + return 0; // random variable is infinite or so close as to make no difference. + result = gamma_p_derivative(shape, result, Policy()) * scale; + if(0 != result) + { + if(x < 0) + { + // x * x may under or overflow, likewise our result, + // so be extra careful about the arithmetic: + RealType lim = tools::max_value() * x; + if(lim < result) + return policies::raise_overflow_error(function, "PDF is infinite.", Policy()); + result /= x; + if(lim < result) + return policies::raise_overflow_error(function, "PDF is infinite.", Policy()); + result /= x; + } + result /= (x * x); + } + // better than naive + // result = (pow(scale, shape) * pow(x, (-shape -1)) * exp(-scale/x) ) / tgamma(shape); + return result; +} // pdf + +template +inline RealType cdf(const inverse_gamma_distribution& dist, const RealType& x) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::cdf(const inverse_gamma_distribution<%1%>&, %1%)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + { // distribution parameters bad. + return result; + } + if (x == 0) + { // Treat zero as a special case. + return 0; + } + else if(false == detail::check_inverse_gamma_x(function, x, &result, Policy())) + { // x bad + return result; + } + result = boost::math::gamma_q(shape, scale / x, Policy()); + // result = tgamma(shape, scale / x) / tgamma(shape); // naive using tgamma + return result; +} // cdf + +template +inline RealType quantile(const inverse_gamma_distribution& dist, const RealType& p) +{ + BOOST_MATH_STD_USING // for ADL of std functions + using boost::math::gamma_q_inv; + + static const char* function = "boost::math::quantile(const inverse_gamma_distribution<%1%>&, %1%)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + return result; + if(false == detail::check_probability(function, p, &result, Policy())) + return result; + if(p == 1) + { + return policies::raise_overflow_error(function, 0, Policy()); + } + result = gamma_q_inv(shape, p, Policy()); + if((result < 1) && (result * tools::max_value() < scale)) + return policies::raise_overflow_error(function, "Value of random variable in inverse gamma distribution quantile is infinite.", Policy()); + result = scale / result; + return result; +} + +template +inline RealType cdf(const complemented2_type, RealType>& c) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::quantile(const gamma_distribution<%1%>&, %1%)"; + + RealType shape = c.dist.shape(); + RealType scale = c.dist.scale(); + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + return result; + if(false == detail::check_inverse_gamma_x(function, c.param, &result, Policy())) + return result; + + //result = 1. - gamma_q(shape, c.param / scale, Policy()); + result = gamma_p(shape, scale/c.param, Policy()); + return result; +} + +template +inline RealType quantile(const complemented2_type, RealType>& c) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::quantile(const inverse_gamma_distribution<%1%>&, %1%)"; + + RealType shape = c.dist.shape(); + RealType scale = c.dist.scale(); + RealType q = c.param; + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + return result; + if(false == detail::check_probability(function, q, &result, Policy())) + return result; + + if(q == 0) + { + return policies::raise_overflow_error(function, 0, Policy()); + } + result = gamma_p_inv(shape, q, Policy()); + if((result < 1) && (result * tools::max_value() < scale)) + return policies::raise_overflow_error(function, "Value of random variable in inverse gamma distribution quantile is infinite.", Policy()); + result = scale / result; + return result; +} + +template +inline RealType mean(const inverse_gamma_distribution& dist) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::mean(const inverse_gamma_distribution<%1%>&)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + + if(false == detail::check_scale(function, scale, &result, Policy())) + { + return result; + } + if((shape <= 1) || !(boost::math::isfinite)(shape)) + { + result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but for a defined mean it must be > 1", shape, Policy()); + return result; + } + result = scale / (shape - 1); + return result; +} // mean + +template +inline RealType variance(const inverse_gamma_distribution& dist) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::variance(const inverse_gamma_distribution<%1%>&)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_scale(function, scale, &result, Policy())) + { + return result; + } + if((shape <= 2) || !(boost::math::isfinite)(shape)) + { + result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but for a defined variance it must be > 2", shape, Policy()); + return result; + } + result = (scale * scale) / ((shape - 1) * (shape -1) * (shape -2)); + return result; +} + +template +inline RealType mode(const inverse_gamma_distribution& dist) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::mode(const inverse_gamma_distribution<%1%>&)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_inverse_gamma(function, scale, shape, &result, Policy())) + { + return result; + } + // Only defined for shape >= 0, but is checked by check_inverse_gamma. + result = scale / (shape + 1); + return result; +} + +//template +//inline RealType median(const gamma_distribution& dist) +//{ // Wikipedia does not define median, + // so rely on default definition quantile(0.5) in derived accessors. +// return result. +//} + +template +inline RealType skewness(const inverse_gamma_distribution& dist) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::skewness(const inverse_gamma_distribution<%1%>&)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + RealType result; + + if(false == detail::check_scale(function, scale, &result, Policy())) + { + return result; + } + if((shape <= 3) || !(boost::math::isfinite)(shape)) + { + result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but for a defined skewness it must be > 3", shape, Policy()); + return result; + } + result = (4 * sqrt(shape - 2) ) / (shape - 3); + return result; +} + +template +inline RealType kurtosis_excess(const inverse_gamma_distribution& dist) +{ + BOOST_MATH_STD_USING // for ADL of std functions + + static const char* function = "boost::math::kurtosis_excess(const inverse_gamma_distribution<%1%>&)"; + + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + if(false == detail::check_scale(function, scale, &result, Policy())) + { + return result; + } + if((shape <= 4) || !(boost::math::isfinite)(shape)) + { + result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but for a defined kurtosis excess it must be > 4", shape, Policy()); + return result; + } + result = (30 * shape - 66) / ((shape - 3) * (shape - 4)); + return result; +} + +template +inline RealType kurtosis(const inverse_gamma_distribution& dist) +{ + static const char* function = "boost::math::kurtosis(const inverse_gamma_distribution<%1%>&)"; + RealType shape = dist.shape(); + RealType scale = dist.scale(); + + RealType result; + + if(false == detail::check_scale(function, scale, &result, Policy())) + { + return result; + } + if((shape <= 4) || !(boost::math::isfinite)(shape)) + { + result = policies::raise_domain_error( + function, + "Shape parameter is %1%, but for a defined kurtosis it must be > 4", shape, Policy()); + return result; + } + return kurtosis_excess(dist) + 3; +} + +} // namespace math +} // namespace boost + +// This include must be at the end, *after* the accessors +// for this distribution have been defined, in order to +// keep compilers that support two-phase lookup happy. +#include + +#endif // BOOST_STATS_INVERSE_GAMMA_HPP diff --git a/3party/boost/boost/math/distributions/lognormal.hpp b/3party/boost/boost/math/distributions/lognormal.hpp index a496e4a144..b2809abc2c 100644 --- a/3party/boost/boost/math/distributions/lognormal.hpp +++ b/3party/boost/boost/math/distributions/lognormal.hpp @@ -78,7 +78,7 @@ template inline const std::pair range(const lognormal_distribution& /*dist*/) { // Range of permissible values for random variable x is >0 to +infinity. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -86,7 +86,7 @@ inline const std::pair support(const lognormal_distribution< { // Range of supported values for random variable x. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template diff --git a/3party/boost/boost/math/distributions/negative_binomial.hpp b/3party/boost/boost/math/distributions/negative_binomial.hpp index f9a24e8243..521b52756a 100644 --- a/3party/boost/boost/math/distributions/negative_binomial.hpp +++ b/3party/boost/boost/math/distributions/negative_binomial.hpp @@ -260,7 +260,7 @@ namespace boost inline const std::pair range(const negative_binomial_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; - return std::pair(0, max_value()); // max_integer? + return std::pair(static_cast(0), max_value()); // max_integer? } template @@ -268,7 +268,7 @@ namespace boost { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, max_value()); // max_integer? + return std::pair(static_cast(0), max_value()); // max_integer? } template diff --git a/3party/boost/boost/math/distributions/non_central_beta.hpp b/3party/boost/boost/math/distributions/non_central_beta.hpp index c46d19fedb..fa218c25d3 100644 --- a/3party/boost/boost/math/distributions/non_central_beta.hpp +++ b/3party/boost/boost/math/distributions/non_central_beta.hpp @@ -54,7 +54,7 @@ namespace boost // recurance term: T xterm; // Starting beta term: - T beta = x < y + T beta = x < y ? detail::ibeta_imp(T(a + k), b, x, pol, false, true, &xterm) : detail::ibeta_imp(b, T(a + k), y, pol, true, true, &xterm); @@ -100,7 +100,7 @@ namespace boost if(static_cast(count + i - k) > max_iter) { return policies::raise_evaluation_error( - "cdf(non_central_beta_distribution<%1%>, %1%)", + "cdf(non_central_beta_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); } } @@ -164,7 +164,7 @@ namespace boost if(static_cast(i - k) > max_iter) { return policies::raise_evaluation_error( - "cdf(non_central_beta_distribution<%1%>, %1%)", + "cdf(non_central_beta_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); } last_term = term; @@ -180,7 +180,7 @@ namespace boost if(static_cast(count + k - i) > max_iter) { return policies::raise_evaluation_error( - "cdf(non_central_beta_distribution<%1%>, %1%)", + "cdf(non_central_beta_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); } pois *= i / l2; @@ -195,9 +195,9 @@ namespace boost { typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -216,30 +216,30 @@ namespace boost { // Complement is the smaller of the two: result = detail::non_central_beta_q( - static_cast(a), - static_cast(b), - static_cast(l), - static_cast(x), - static_cast(y), - forwarding_policy(), + static_cast(a), + static_cast(b), + static_cast(l), + static_cast(x), + static_cast(y), + forwarding_policy(), static_cast(invert ? 0 : -1)); invert = !invert; } else { result = detail::non_central_beta_p( - static_cast(a), - static_cast(b), - static_cast(l), - static_cast(x), - static_cast(y), + static_cast(a), + static_cast(b), + static_cast(l), + static_cast(x), + static_cast(y), forwarding_policy(), static_cast(invert ? -1 : 0)); } if(invert) result = -result; return policies::checked_narrowing_cast( - result, + result, "boost::math::non_central_beta_cdf<%1%>(%1%, %1%, %1%)"); } @@ -328,7 +328,7 @@ namespace boost // Escape route just in case the answer is zero! max_iter -= count; max_iter += 1; - return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0)); + return a > 0 ? std::make_pair(T(0), T(a)) : std::make_pair(T(a), T(0)); } if(count == 0) { @@ -355,13 +355,13 @@ namespace boost max_iter -= count; max_iter += 1; std::pair r = toms748_solve( - f, - (a < 0 ? b : a), - (a < 0 ? a : b), - (a < 0 ? fb : fa), - (a < 0 ? fa : fb), - tol, - count, + f, + (a < 0 ? b : a), + (a < 0 ? a : b), + (a < 0 ? fb : fa), + (a < 0 ? fa : fb), + tol, + count, pol); max_iter += count; BOOST_MATH_INSTRUMENT_CODE("max_iter = " << max_iter << " count = " << count); @@ -374,9 +374,9 @@ namespace boost static const char* function = "quantile(non_central_beta_distribution<%1%>, %1%)"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -391,7 +391,7 @@ namespace boost !beta_detail::check_beta( function, b, &r, Policy()) - || + || !detail::check_non_centrality( function, l, @@ -420,9 +420,9 @@ namespace boost value_type mean = 1 - (b / c) * (1 + l / (2 * c * c)); /* // - // Calculate a normal approximation to the quantile, + // Calculate a normal approximation to the quantile, // uses mean and variance approximations from: - // Algorithm AS 310: + // Algorithm AS 310: // Computing the Non-Central Beta Distribution Function // R. Chattamvelli; R. Shanmugam // Applied Statistics, Vol. 46, No. 1. (1997), pp. 146-156. @@ -442,20 +442,20 @@ namespace boost value_type alpha2 = alpha * alpha; value_type eta = (2 * alpha + 1) * (2 * alpha + 1) + 1; value_type H = 3 * alpha2 + 5 * alpha + 2; - value_type F = alpha2 * (alpha + 1) + H * delta + value_type F = alpha2 * (alpha + 1) + H * delta + (2 * alpha + 4) * delta2 + delta3; value_type P = (3 * alpha + 1) * (9 * alpha + 17) + 2 * alpha * (3 * alpha + 2) * (3 * alpha + 4) + 15; value_type Q = 54 * alpha2 + 162 * alpha + 130; value_type R = 6 * (6 * alpha + 11); - value_type D = delta + value_type D = delta * (H * H + 2 * P * delta + Q * delta2 + R * delta3 + 9 * delta4); value_type variance = (b / G) * (1 + delta * (l * l + 3 * l + eta) / (G * G)) - (b * b / F) * (1 + D / (F * F)); value_type sd = sqrt(variance); - value_type guess = comp + value_type guess = comp ? quantile(complement(normal_distribution(static_cast(mean), static_cast(sd)), p)) : quantile(normal_distribution(static_cast(mean), static_cast(sd)), p); @@ -470,9 +470,9 @@ namespace boost tools::eps_tolerance tol(policies::digits()); boost::uintmax_t max_iter = policies::get_max_root_iterations(); - std::pair ir + std::pair ir = bracket_and_solve_root_01( - f, guess, value_type(2.5), true, tol, + f, guess, value_type(2.5), true, tol, max_iter, Policy()); value_type result = ir.first + (ir.second - ir.first) / 2; @@ -480,13 +480,13 @@ namespace boost { return policies::raise_evaluation_error(function, "Unable to locate solution in a reasonable time:" " either there is no answer to quantile of the non central beta distribution" - " or the answer is infinite. Current best guess is %1%", + " or the answer is infinite. Current best guess is %1%", policies::checked_narrowing_cast( - result, + result, function), Policy()); } return policies::checked_narrowing_cast( - result, + result, function); } @@ -509,7 +509,7 @@ namespace boost // Starting Poisson weight: T pois = gamma_p_derivative(T(k+1), l2, pol); // Starting beta term: - T beta = x < y ? + T beta = x < y ? ibeta_derivative(a + k, b, x, pol) : ibeta_derivative(b, a + k, y, pol); T sum = 0; @@ -546,7 +546,7 @@ namespace boost if(static_cast(count + i - k) > max_iter) { return policies::raise_evaluation_error( - "pdf(non_central_beta_distribution<%1%>, %1%)", + "pdf(non_central_beta_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); } } @@ -560,9 +560,9 @@ namespace boost static const char* function = "pdf(non_central_beta_distribution<%1%>, %1%)"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -577,7 +577,7 @@ namespace boost !beta_detail::check_beta( function, b, &r, Policy()) - || + || !detail::check_non_centrality( function, l, @@ -608,7 +608,7 @@ namespace boost typedef Policy policy_type; non_central_beta_distribution(RealType a_, RealType b_, RealType lambda) : a(a_), b(b_), ncp(lambda) - { + { const char* function = "boost::math::non_central_beta_distribution<%1%>::non_central_beta_distribution(%1%,%1%)"; RealType r; beta_detail::check_alpha( @@ -651,7 +651,7 @@ namespace boost inline const std::pair range(const non_central_beta_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template @@ -659,7 +659,7 @@ namespace boost { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, 1); + return std::pair(static_cast(0), static_cast(1)); } template @@ -678,7 +678,7 @@ namespace boost !beta_detail::check_beta( function, b, &r, Policy()) - || + || !detail::check_non_centrality( function, l, @@ -688,8 +688,8 @@ namespace boost RealType c = a + b + l / 2; RealType mean = 1 - (b / c) * (1 + l / (2 * c * c)); return detail::generic_find_mode_01( - dist, - mean, + dist, + mean, function); } @@ -702,7 +702,7 @@ namespace boost // template inline RealType mean(const non_central_beta_distribution& dist) - { + { // TODO return 0; } // mean @@ -728,7 +728,7 @@ namespace boost template inline RealType kurtosis_excess(const non_central_beta_distribution& dist) - { + { const char* function = "boost::math::non_central_beta_distribution<%1%>::kurtosis_excess()"; // TODO return 0; @@ -748,7 +748,7 @@ namespace boost template RealType cdf(const non_central_beta_distribution& dist, const RealType& x) - { + { const char* function = "boost::math::non_central_beta_distribution<%1%>::cdf(%1%)"; RealType a = dist.alpha(); RealType b = dist.beta(); @@ -761,7 +761,7 @@ namespace boost !beta_detail::check_beta( function, b, &r, Policy()) - || + || !detail::check_non_centrality( function, l, @@ -798,7 +798,7 @@ namespace boost !beta_detail::check_beta( function, b, &r, Policy()) - || + || !detail::check_non_centrality( function, l, diff --git a/3party/boost/boost/math/distributions/non_central_chi_squared.hpp b/3party/boost/boost/math/distributions/non_central_chi_squared.hpp index 2afb237e86..3e6e954856 100644 --- a/3party/boost/boost/math/distributions/non_central_chi_squared.hpp +++ b/3party/boost/boost/math/distributions/non_central_chi_squared.hpp @@ -102,13 +102,13 @@ namespace boost //Error check: if(static_cast(i-k) >= max_iter) policies::raise_evaluation_error( - "cdf(non_central_chi_squared_distribution<%1%>, %1%)", + "cdf(non_central_chi_squared_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); // // Now backwards iteration: the gamma // function recurrences are unstable in this // direction, we rely on the terms deminishing in size - // faster than we introduce cancellation errors. + // faster than we introduce cancellation errors. // For this reason it's very important that we start // *before* the largest term so that backwards iteration // is strictly converging. @@ -133,7 +133,7 @@ namespace boost // // This is an implementation of: // - // Algorithm AS 275: + // Algorithm AS 275: // Computing the Non-Central #2 Distribution Function // Cherng G. Ding // Applied Statistics, Vol. 41, No. 2. (1992), pp. 478-482. @@ -176,7 +176,7 @@ namespace boost //Error check: if(static_cast(i) >= max_iter) policies::raise_evaluation_error( - "cdf(non_central_chi_squared_distribution<%1%>, %1%)", + "cdf(non_central_chi_squared_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); return sum; } @@ -240,7 +240,7 @@ namespace boost // Backwards recursion first, this is the stable // direction for gamma function recurrences: // - while(i <= k) + while(i <= k) { xtermb *= (a - i + 1) / x; gamkb += xtermb; @@ -275,7 +275,7 @@ namespace boost //Error check: if(static_cast(i) >= max_iter) policies::raise_evaluation_error( - "cdf(non_central_chi_squared_distribution<%1%>, %1%)", + "cdf(non_central_chi_squared_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); return sum; @@ -306,7 +306,7 @@ namespace boost break; if(static_cast(i - k) >= max_iter) return policies::raise_evaluation_error( - "pdf(non_central_chi_squared_distribution<%1%>, %1%)", + "pdf(non_central_chi_squared_distribution<%1%>, %1%)", "Series did not converge, closest value was %1%", sum, pol); pois *= l2 * x2 / ((i + 1) * (n2 + i)); } @@ -325,9 +325,9 @@ namespace boost { typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -339,10 +339,10 @@ namespace boost { // Complement is the smaller of the two: result = detail::non_central_chi_square_q( - static_cast(x), - static_cast(k), - static_cast(l), - forwarding_policy(), + static_cast(x), + static_cast(k), + static_cast(l), + forwarding_policy(), static_cast(invert ? 0 : -1)); invert = !invert; } @@ -351,9 +351,9 @@ namespace boost // For small values of the non-centrality parameter // we can use Ding's method: result = detail::non_central_chi_square_p_ding( - static_cast(x), - static_cast(k), - static_cast(l), + static_cast(x), + static_cast(k), + static_cast(l), forwarding_policy(), static_cast(invert ? -1 : 0)); } @@ -365,16 +365,16 @@ namespace boost // may return zero when the result is in fact // finite, use Krishnamoorthy's method instead: result = detail::non_central_chi_square_p( - static_cast(x), - static_cast(k), - static_cast(l), + static_cast(x), + static_cast(k), + static_cast(l), forwarding_policy(), static_cast(invert ? -1 : 0)); } if(invert) result = -result; return policies::checked_narrowing_cast( - result, + result, "boost::math::non_central_chi_squared_cdf<%1%>(%1%, %1%, %1%)"); } @@ -403,9 +403,9 @@ namespace boost static const char* function = "quantile(non_central_chi_squared_distribution<%1%>, %1%)"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -442,13 +442,13 @@ namespace boost guess = tools::min_value(); value_type result = detail::generic_quantile( - non_central_chi_squared_distribution(k, l), - p, - guess, - comp, + non_central_chi_squared_distribution(k, l), + p, + guess, + comp, function); return policies::checked_narrowing_cast( - result, + result, function); } @@ -459,9 +459,9 @@ namespace boost static const char* function = "pdf(non_central_chi_squared_distribution<%1%>, %1%)"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -510,7 +510,7 @@ namespace boost } } return policies::checked_narrowing_cast( - r, + r, function); } @@ -545,8 +545,8 @@ namespace boost // // Can't a thing if one of p and q is zero: // - return policies::raise_evaluation_error(function, - "Can't find degrees of freedom when the probability is 0 or 1, only possible answer is %1%", + return policies::raise_evaluation_error(function, + "Can't find degrees of freedom when the probability is 0 or 1, only possible answer is %1%", RealType(std::numeric_limits::quiet_NaN()), Policy()); } degrees_of_freedom_finder f(lam, x, p < q ? p : q, p < q ? false : true); @@ -601,8 +601,8 @@ namespace boost // // Can't do a thing if one of p and q is zero: // - return policies::raise_evaluation_error(function, - "Can't find non centrality parameter when the probability is 0 or 1, only possible answer is %1%", + return policies::raise_evaluation_error(function, + "Can't find non centrality parameter when the probability is 0 or 1, only possible answer is %1%", RealType(std::numeric_limits::quiet_NaN()), Policy()); } non_centrality_finder f(v, x, p < q ? p : q, p < q ? false : true); @@ -636,7 +636,7 @@ namespace boost typedef Policy policy_type; non_central_chi_squared_distribution(RealType df_, RealType lambda) : df(df_), ncp(lambda) - { + { const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::non_central_chi_squared_distribution(%1%,%1%)"; RealType r; detail::check_df( @@ -662,19 +662,19 @@ namespace boost const char* function = "non_central_chi_squared<%1%>::find_degrees_of_freedom"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; value_type result = detail::find_degrees_of_freedom( - static_cast(lam), - static_cast(x), - static_cast(p), - static_cast(1-p), + static_cast(lam), + static_cast(x), + static_cast(p), + static_cast(1-p), forwarding_policy()); return policies::checked_narrowing_cast( - result, + result, function); } template @@ -683,19 +683,19 @@ namespace boost const char* function = "non_central_chi_squared<%1%>::find_degrees_of_freedom"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; value_type result = detail::find_degrees_of_freedom( - static_cast(c.dist), - static_cast(c.param1), - static_cast(1-c.param2), - static_cast(c.param2), + static_cast(c.dist), + static_cast(c.param1), + static_cast(1-c.param2), + static_cast(c.param2), forwarding_policy()); return policies::checked_narrowing_cast( - result, + result, function); } static RealType find_non_centrality(RealType v, RealType x, RealType p) @@ -703,19 +703,19 @@ namespace boost const char* function = "non_central_chi_squared<%1%>::find_non_centrality"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; value_type result = detail::find_non_centrality( - static_cast(v), - static_cast(x), - static_cast(p), - static_cast(1-p), + static_cast(v), + static_cast(x), + static_cast(p), + static_cast(1-p), forwarding_policy()); return policies::checked_narrowing_cast( - result, + result, function); } template @@ -724,19 +724,19 @@ namespace boost const char* function = "non_central_chi_squared<%1%>::find_non_centrality"; typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; value_type result = detail::find_non_centrality( - static_cast(c.dist), - static_cast(c.param1), - static_cast(1-c.param2), - static_cast(c.param2), + static_cast(c.dist), + static_cast(c.param1), + static_cast(1-c.param2), + static_cast(c.param2), forwarding_policy()); return policies::checked_narrowing_cast( - result, + result, function); } private: @@ -753,7 +753,7 @@ namespace boost inline const std::pair range(const non_central_chi_squared_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; - return std::pair(0, max_value()); // Max integer? + return std::pair(static_cast(0), max_value()); // Max integer? } template @@ -761,7 +761,7 @@ namespace boost { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -851,7 +851,7 @@ namespace boost template inline RealType kurtosis_excess(const non_central_chi_squared_distribution& dist) - { + { const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::kurtosis_excess()"; RealType k = dist.degrees_of_freedom(); RealType l = dist.non_centrality(); @@ -883,7 +883,7 @@ namespace boost template RealType cdf(const non_central_chi_squared_distribution& dist, const RealType& x) - { + { const char* function = "boost::math::non_central_chi_squared_distribution<%1%>::cdf(%1%)"; RealType k = dist.degrees_of_freedom(); RealType l = dist.non_centrality(); diff --git a/3party/boost/boost/math/distributions/non_central_f.hpp b/3party/boost/boost/math/distributions/non_central_f.hpp index 41bd3569bf..0549f38fe5 100644 --- a/3party/boost/boost/math/distributions/non_central_f.hpp +++ b/3party/boost/boost/math/distributions/non_central_f.hpp @@ -26,7 +26,7 @@ namespace boost typedef Policy policy_type; non_central_f_distribution(RealType v1_, RealType v2_, RealType lambda) : v1(v1_), v2(v2_), ncp(lambda) - { + { const char* function = "boost::math::non_central_f_distribution<%1%>::non_central_f_distribution(%1%,%1%)"; RealType r; detail::check_df( @@ -69,7 +69,7 @@ namespace boost inline const std::pair range(const non_central_f_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -77,12 +77,12 @@ namespace boost { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template inline RealType mean(const non_central_f_distribution& dist) - { + { const char* function = "mean(non_central_f_distribution<%1%> const&)"; RealType v1 = dist.degrees_of_freedom1(); RealType v2 = dist.degrees_of_freedom2(); @@ -104,8 +104,8 @@ namespace boost return r; if(v2 <= 2) return policies::raise_domain_error( - function, - "Second degrees of freedom parameter was %1%, but must be > 2 !", + function, + "Second degrees of freedom parameter was %1%, but must be > 2 !", v2, Policy()); return v2 * (v1 + l) / (v1 * (v2 - 2)); } // mean @@ -134,8 +134,8 @@ namespace boost Policy())) return r; return detail::generic_find_mode( - dist, - m * (n + l) / (n * (m - 2)), + dist, + m * (n + l) / (n * (m - 2)), function); } @@ -163,8 +163,8 @@ namespace boost return r; if(m <= 4) return policies::raise_domain_error( - function, - "Second degrees of freedom parameter was %1%, but must be > 4 !", + function, + "Second degrees of freedom parameter was %1%, but must be > 4 !", m, Policy()); RealType result = 2 * m * m * ((n + l) * (n + l) + (m - 2) * (n + 2 * l)); @@ -200,8 +200,8 @@ namespace boost return r; if(m <= 6) return policies::raise_domain_error( - function, - "Second degrees of freedom parameter was %1%, but must be > 6 !", + function, + "Second degrees of freedom parameter was %1%, but must be > 6 !", m, Policy()); RealType result = 2 * constants::root_two(); result *= sqrt(m - 4); @@ -214,7 +214,7 @@ namespace boost template inline RealType kurtosis_excess(const non_central_f_distribution& dist) - { + { const char* function = "kurtosis_excess(non_central_f_distribution<%1%> const&)"; BOOST_MATH_STD_USING RealType n = dist.degrees_of_freedom1(); @@ -237,18 +237,18 @@ namespace boost return r; if(m <= 8) return policies::raise_domain_error( - function, - "Second degrees of freedom parameter was %1%, but must be > 8 !", + function, + "Second degrees of freedom parameter was %1%, but must be > 8 !", m, Policy()); RealType l2 = l * l; RealType l3 = l2 * l; RealType l4 = l2 * l2; RealType result = (3 * (m - 4) * (n * (m + n - 2) - * (4 * (m - 2) * (m - 2) + * (4 * (m - 2) * (m - 2) + (m - 2) * (m + 10) * n + (10 + m) * n * n) + 4 * (m + n - 2) * (4 * (m - 2) * (m - 2) - + (m - 2) * (10 + m) * n + + (m - 2) * (10 + m) * n + (10 + m) * n * n) * l + 2 * (10 + m) * (m + n - 2) * (2 * m + 3 * n - 4) * l2 + 4 * (10 + m) * (-2 + m + n) * l3 @@ -270,9 +270,9 @@ namespace boost { // Probability Density/Mass Function. typedef typename policies::evaluation::type value_type; typedef typename policies::normalise< - Policy, - policies::promote_float, - policies::promote_double, + Policy, + policies::promote_float, + policies::promote_double, policies::discrete_quantile<>, policies::assert_undefined<> >::type forwarding_policy; @@ -287,7 +287,7 @@ namespace boost template RealType cdf(const non_central_f_distribution& dist, const RealType& x) - { + { const char* function = "cdf(const non_central_f_distribution<%1%>&, %1%)"; RealType r; if(!detail::check_df( @@ -304,7 +304,7 @@ namespace boost &r, Policy())) return r; - + if((x < 0) || !(boost::math::isfinite)(x)) { return policies::raise_domain_error( @@ -321,7 +321,7 @@ namespace boost // non-central beta cdf routine, this ensures accuracy // even when we compute x to be ~ 1: // - r = detail::non_central_beta_cdf(c, cp, alpha, beta, + r = detail::non_central_beta_cdf(c, cp, alpha, beta, dist.non_centrality(), false, Policy()); return r; } // cdf @@ -345,7 +345,7 @@ namespace boost &r, Policy())) return r; - + if((c.param < 0) || !(boost::math::isfinite)(c.param)) { return policies::raise_domain_error( @@ -362,7 +362,7 @@ namespace boost // non-central beta cdf routine, this ensures accuracy // even when we compute x to be ~ 1: // - r = detail::non_central_beta_cdf(x, cx, alpha, beta, + r = detail::non_central_beta_cdf(x, cx, alpha, beta, c.dist.non_centrality(), true, Policy()); return r; } // ccdf @@ -375,8 +375,8 @@ namespace boost RealType x = quantile(boost::math::non_central_beta_distribution(alpha, beta, dist.non_centrality()), p); if(x == 1) return policies::raise_overflow_error( - "quantile(const non_central_f_distribution<%1%>&, %1%)", - "Result of non central F quantile is too large to represent.", + "quantile(const non_central_f_distribution<%1%>&, %1%)", + "Result of non central F quantile is too large to represent.", Policy()); return (x / (1 - x)) * (dist.degrees_of_freedom2() / dist.degrees_of_freedom1()); } // quantile @@ -389,8 +389,8 @@ namespace boost RealType x = quantile(complement(boost::math::non_central_beta_distribution(alpha, beta, c.dist.non_centrality()), c.param)); if(x == 1) return policies::raise_overflow_error( - "quantile(complement(const non_central_f_distribution<%1%>&, %1%))", - "Result of non central F quantile is too large to represent.", + "quantile(complement(const non_central_f_distribution<%1%>&, %1%))", + "Result of non central F quantile is too large to represent.", Policy()); return (x / (1 - x)) * (c.dist.degrees_of_freedom2() / c.dist.degrees_of_freedom1()); } // quantile complement. diff --git a/3party/boost/boost/math/distributions/pareto.hpp b/3party/boost/boost/math/distributions/pareto.hpp index 7673b96cf2..bfebf6f0d9 100644 --- a/3party/boost/boost/math/distributions/pareto.hpp +++ b/3party/boost/boost/math/distributions/pareto.hpp @@ -164,7 +164,7 @@ namespace boost inline const std::pair range(const pareto_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, max_value()); // scale zero to + infinity. + return std::pair(static_cast(0), max_value()); // scale zero to + infinity. } // range template diff --git a/3party/boost/boost/math/distributions/poisson.hpp b/3party/boost/boost/math/distributions/poisson.hpp index 3b215d0e27..3cb06e0f47 100644 --- a/3party/boost/boost/math/distributions/poisson.hpp +++ b/3party/boost/boost/math/distributions/poisson.hpp @@ -54,7 +54,7 @@ namespace boost { namespace detail{ template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -64,7 +64,7 @@ namespace boost const policies::discrete_quantile&, boost::uintmax_t& max_iter); template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -74,7 +74,7 @@ namespace boost const policies::discrete_quantile&, boost::uintmax_t& max_iter); template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -84,7 +84,7 @@ namespace boost const policies::discrete_quantile&, boost::uintmax_t& max_iter); template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -94,7 +94,7 @@ namespace boost const policies::discrete_quantile&, boost::uintmax_t& max_iter); template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -104,7 +104,7 @@ namespace boost const policies::discrete_quantile&, boost::uintmax_t& max_iter); template - inline typename Dist::value_type + inline typename Dist::value_type inverse_discrete_quantile( const Dist& dist, const typename Dist::value_type& p, @@ -235,7 +235,7 @@ namespace boost inline const std::pair range(const poisson_distribution& /* dist */) { // Range of permissible values for random variable k. using boost::math::tools::max_value; - return std::pair(0, max_value()); // Max integer? + return std::pair(static_cast(0), max_value()); // Max integer? } template @@ -243,7 +243,7 @@ namespace boost { // Range of supported values for random variable k. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template diff --git a/3party/boost/boost/math/distributions/rayleigh.hpp b/3party/boost/boost/math/distributions/rayleigh.hpp index 66d3d507a3..2aeef4d643 100644 --- a/3party/boost/boost/math/distributions/rayleigh.hpp +++ b/3party/boost/boost/math/distributions/rayleigh.hpp @@ -89,7 +89,7 @@ inline const std::pair support(const rayleigh_distribution((0), max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -109,7 +109,7 @@ inline RealType pdf(const rayleigh_distribution& dist, const R return result; } RealType sigmasqr = sigma * sigma; - result = x * (exp(-(x * x) / ( 2 * sigmasqr))) / sigmasqr; + result = x * (exp(-(x * x) / ( 2 * sigmasqr))) / sigmasqr; return result; } // pdf diff --git a/3party/boost/boost/math/distributions/weibull.hpp b/3party/boost/boost/math/distributions/weibull.hpp index 5368b830e2..e47437ff3a 100644 --- a/3party/boost/boost/math/distributions/weibull.hpp +++ b/3party/boost/boost/math/distributions/weibull.hpp @@ -103,7 +103,7 @@ template inline const std::pair range(const weibull_distribution& /*dist*/) { // Range of permissible values for random variable x. using boost::math::tools::max_value; - return std::pair(0, max_value()); + return std::pair(static_cast(0), max_value()); } template @@ -133,7 +133,7 @@ inline RealType pdf(const weibull_distribution& dist, const Re return result; if(x == 0) - { // Special case, but x == min, pdf = 1 for shape = 1, + { // Special case, but x == min, pdf = 1 for shape = 1, return 0; } result = exp(-pow(x / scale, shape)); diff --git a/3party/boost/boost/math/special_functions/cbrt.hpp b/3party/boost/boost/math/special_functions/cbrt.hpp index 5307d858e6..c5421344fb 100644 --- a/3party/boost/boost/math/special_functions/cbrt.hpp +++ b/3party/boost/boost/math/special_functions/cbrt.hpp @@ -69,7 +69,7 @@ T cbrt_imp(T z, const Policy& pol) static_cast(1.5874010519681994747517056392723), // 2^2/3 }; - if(!boost::math::isfinite(z)) + if(!(boost::math::isfinite)(z)) { return policies::raise_domain_error("boost::math::cbrt<%1%>(%1%)", "Argument to function must be finite but got %1%.", z, pol); } diff --git a/3party/boost/boost/math/special_functions/detail/erf_inv.hpp b/3party/boost/boost/math/special_functions/detail/erf_inv.hpp index 33f84651ee..7ab590d7ac 100644 --- a/3party/boost/boost/math/special_functions/detail/erf_inv.hpp +++ b/3party/boost/boost/math/special_functions/detail/erf_inv.hpp @@ -277,12 +277,12 @@ T erf_inv_imp(const T& p, const T& q, const Policy&, const boost::mpl::int_<64>* template struct erf_roots { - std::tr1::tuple operator()(const T& guess) + boost::math::tuple operator()(const T& guess) { BOOST_MATH_STD_USING T derivative = sign * (2 / sqrt(constants::pi())) * exp(-(guess * guess)); T derivative2 = -2 * guess * derivative; - return std::tr1::make_tuple(((sign > 0) ? boost::math::erf(guess, Policy()) : boost::math::erfc(guess, Policy())) - target, derivative, derivative2); + return boost::math::make_tuple(((sign > 0) ? boost::math::erf(guess, Policy()) : boost::math::erfc(guess, Policy())) - target, derivative, derivative2); } erf_roots(T z, int s) : target(z), sign(s) {} private: diff --git a/3party/boost/boost/math/special_functions/detail/fp_traits.hpp b/3party/boost/boost/math/special_functions/detail/fp_traits.hpp index 162193dc20..0f311b6393 100644 --- a/3party/boost/boost/math/special_functions/detail/fp_traits.hpp +++ b/3party/boost/boost/math/special_functions/detail/fp_traits.hpp @@ -545,7 +545,8 @@ struct select_native && !defined(__hpux) \ && !defined(__DECCXX)\ && !defined(__osf__) \ - && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\ + && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) # define BOOST_MATH_USE_STD_FPCLASSIFY #endif diff --git a/3party/boost/boost/math/special_functions/detail/ibeta_inverse.hpp b/3party/boost/boost/math/special_functions/detail/ibeta_inverse.hpp index 8ed1e3046b..deaa924d11 100644 --- a/3party/boost/boost/math/special_functions/detail/ibeta_inverse.hpp +++ b/3party/boost/boost/math/special_functions/detail/ibeta_inverse.hpp @@ -27,7 +27,7 @@ struct temme_root_finder { temme_root_finder(const T t_, const T a_) : t(t_), a(a_) {} - std::tr1::tuple operator()(T x) + boost::math::tuple operator()(T x) { BOOST_MATH_STD_USING // ADL of std names @@ -35,16 +35,16 @@ struct temme_root_finder if(y == 0) { T big = tools::max_value() / 4; - return std::tr1::make_tuple(-big, -big); + return boost::math::make_tuple(-big, -big); } if(x == 0) { T big = tools::max_value() / 4; - return std::tr1::make_tuple(-big, big); + return boost::math::make_tuple(-big, big); } T f = log(x) + a * log(y) + t; T f1 = (1 / x) - (a / (y)); - return std::tr1::make_tuple(f, f1); + return boost::math::make_tuple(f, f1); } private: T t, a; @@ -416,7 +416,7 @@ struct ibeta_roots ibeta_roots(T _a, T _b, T t, bool inv = false) : a(_a), b(_b), target(t), invert(inv) {} - std::tr1::tuple operator()(T x) + boost::math::tuple operator()(T x) { BOOST_MATH_STD_USING // ADL of std names @@ -442,7 +442,7 @@ struct ibeta_roots if(f1 == 0) f1 = (invert ? -1 : 1) * tools::min_value() * 64; - return std::tr1::make_tuple(f, f1, f2); + return boost::math::make_tuple(f, f1, f2); } private: T a, b, target; diff --git a/3party/boost/boost/math/special_functions/detail/igamma_inverse.hpp b/3party/boost/boost/math/special_functions/detail/igamma_inverse.hpp index a7dce6f99b..e3c9c8a6a8 100644 --- a/3party/boost/boost/math/special_functions/detail/igamma_inverse.hpp +++ b/3party/boost/boost/math/special_functions/detail/igamma_inverse.hpp @@ -10,7 +10,7 @@ #pragma once #endif -#include +#include #include #include #include @@ -122,7 +122,7 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) BOOST_MATH_INSTRUMENT_VARIABLE(b); if((b > 0.6) || ((b >= 0.45) && (a >= 0.3))) { - // DiDonato & Morris Eq 21: + // DiDonato & Morris Eq 21: // // There is a slight variation from DiDonato and Morris here: // the first form given here is unstable when p is close to 1, @@ -275,16 +275,18 @@ T find_inverse_gamma(T a, T p, T q, const Policy& pol, bool* p_has_10_digits) { T z = w; T ap1 = a + 1; + T ap2 = a + 2; if(w < 0.15f * ap1) { // DiDonato and Morris Eq 35: T v = log(p) + boost::math::lgamma(ap1, pol); T s = 1; z = exp((v + w) / a); - s = boost::math::log1p(z / ap1 * (1 + z / (a + 2))); + s = boost::math::log1p(z / ap1 * (1 + z / ap2)); z = exp((v + z - s) / a); + s = boost::math::log1p(z / ap1 * (1 + z / ap2)); z = exp((v + z - s) / a); - s = boost::math::log1p(z / ap1 * (1 + z / (a + 2) * (1 + z / (a + 3)))); + s = boost::math::log1p(z / ap1 * (1 + z / ap2 * (1 + z / (a + 3)))); z = exp((v + z - s) / a); BOOST_MATH_INSTRUMENT_VARIABLE(z); } @@ -332,7 +334,7 @@ struct gamma_p_inverse_func } } - std::tr1::tuple operator()(const T& x)const + boost::math::tuple operator()(const T& x)const { BOOST_FPU_EXCEPTION_GUARD // @@ -377,7 +379,7 @@ struct gamma_p_inverse_func f2 = -f2; } - return std::tr1::make_tuple(f - p, f1, f2); + return boost::math::make_tuple(f - p, f1, f2); } private: T a, p; diff --git a/3party/boost/boost/math/special_functions/detail/igamma_large.hpp b/3party/boost/boost/math/special_functions/detail/igamma_large.hpp index f3de0df031..1e69e935e4 100644 --- a/3party/boost/boost/math/special_functions/detail/igamma_large.hpp +++ b/3party/boost/boost/math/special_functions/detail/igamma_large.hpp @@ -257,7 +257,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, mpl::int_<64> const *) }; workspace[12] = tools::evaluate_polynomial(C12, z); - T result = tools::evaluate_polynomial(workspace, 1/a); + T result = tools::evaluate_polynomial<13, T, T>(workspace, 1/a); result *= exp(-y) / sqrt(2 * constants::pi() * a); if(x < a) result = -result; @@ -399,7 +399,7 @@ T igamma_temme_large(T a, T x, const Policy& pol, mpl::int_<53> const *) workspace[8] = tools::evaluate_polynomial(C8, z); workspace[9] = static_cast(-0.00059676129019274625L); - T result = tools::evaluate_polynomial(workspace, 1/a); + T result = tools::evaluate_polynomial<10, T, T>(workspace, 1/a); result *= exp(-y) / sqrt(2 * constants::pi() * a); if(x < a) result = -result; diff --git a/3party/boost/boost/math/special_functions/detail/t_distribution_inv.hpp b/3party/boost/boost/math/special_functions/detail/t_distribution_inv.hpp index 3cfa687704..8f7f0e6fd6 100644 --- a/3party/boost/boost/math/special_functions/detail/t_distribution_inv.hpp +++ b/3party/boost/boost/math/special_functions/detail/t_distribution_inv.hpp @@ -118,7 +118,7 @@ T inverse_students_t_tail_series(T df, T v, const Policy& pol) T rn = sqrt(df); T div = pow(rn * w, 1 / df); T power = div * div; - T result = tools::evaluate_polynomial(d, power); + T result = tools::evaluate_polynomial<7, T, T>(d, power); result *= rn; result /= div; return -result; @@ -200,7 +200,7 @@ T inverse_students_t_body_series(T df, T u, const Policy& pol) // // The result is then a polynomial in v (see Eq 56 of Shaw): // - return tools::evaluate_odd_polynomial(c, v); + return tools::evaluate_odd_polynomial<11, T, T>(c, v); } template diff --git a/3party/boost/boost/math/special_functions/fpclassify.hpp b/3party/boost/boost/math/special_functions/fpclassify.hpp index d3dc42b0ca..f6e920449f 100644 --- a/3party/boost/boost/math/special_functions/fpclassify.hpp +++ b/3party/boost/boost/math/special_functions/fpclassify.hpp @@ -87,7 +87,7 @@ is used. namespace boost{ -#if defined(BOOST_HAS_FPCLASSIFY) || defined(isnan) +#if (defined(BOOST_HAS_FPCLASSIFY) || defined(isnan)) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) // // This must not be located in any namespace under boost::math // otherwise we can get into an infinite loop if isnan is @@ -133,7 +133,7 @@ inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag&) BOOST_MATH_INSTRUMENT_VARIABLE(t); // whenever possible check for Nan's first: -#ifdef BOOST_HAS_FPCLASSIFY +#if defined(BOOST_HAS_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) if(::boost::math_detail::is_nan_helper(t, ::boost::is_floating_point())) return FP_NAN; #elif defined(isnan) diff --git a/3party/boost/boost/math/special_functions/gamma.hpp b/3party/boost/boost/math/special_functions/gamma.hpp index f809fa6f40..5d414259b8 100644 --- a/3party/boost/boost/math/special_functions/gamma.hpp +++ b/3party/boost/boost/math/special_functions/gamma.hpp @@ -835,7 +835,7 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, typedef typename lanczos::lanczos::type lanczos_type; - T result; + T result = 0; // Just to avoid warning C4701: potentially uninitialized local variable 'result' used BOOST_ASSERT((p_derivative == 0) || (normalised == true)); diff --git a/3party/boost/boost/math/special_functions/lanczos.hpp b/3party/boost/boost/math/special_functions/lanczos.hpp index 3a10838db3..8a6eef21d0 100644 --- a/3party/boost/boost/math/special_functions/lanczos.hpp +++ b/3party/boost/boost/math/special_functions/lanczos.hpp @@ -1229,9 +1229,11 @@ struct lanczos } // namespace math } // namespace boost +#if !defined(__GNUC__) || (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 3)) #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(__SSE2__) #include #endif +#endif #endif // BOOST_MATH_SPECIAL_FUNCTIONS_LANCZOS diff --git a/3party/boost/boost/math/special_functions/log1p.hpp b/3party/boost/boost/math/special_functions/log1p.hpp index 57a6699589..494579183a 100644 --- a/3party/boost/boost/math/special_functions/log1p.hpp +++ b/3party/boost/boost/math/special_functions/log1p.hpp @@ -390,6 +390,11 @@ inline float log1p(float x, const Policy& pol) { return static_cast(boost::math::log1p(static_cast(x), pol)); } +#ifndef _WIN32_WCE +// +// For some reason this fails to compile under WinCE... +// Needs more investigation. +// template inline long double log1p(long double x, const Policy& pol) { @@ -406,6 +411,7 @@ inline long double log1p(long double x, const Policy& pol) return ::logl(u)*(x/(u-1.0)); } #endif +#endif template inline typename tools::promote_args::type log1p(T x) diff --git a/3party/boost/boost/math/special_functions/pow.hpp b/3party/boost/boost/math/special_functions/pow.hpp index 1de94d4b0b..5423e9c8e4 100644 --- a/3party/boost/boost/math/special_functions/pow.hpp +++ b/3party/boost/boost/math/special_functions/pow.hpp @@ -30,10 +30,9 @@ template struct positive_power { template - static typename tools::promote_args::type result(T base) + static T result(T base) { - typename tools::promote_args::type power = - positive_power::result(base); + T power = positive_power::result(base); return power * power; } }; @@ -42,10 +41,9 @@ template struct positive_power { template - static typename tools::promote_args::type result(T base) + static T result(T base) { - typename tools::promote_args::type power = - positive_power::result(base); + T power = positive_power::result(base); return base * power * power; } }; @@ -54,8 +52,7 @@ template <> struct positive_power<1, 1> { template - static typename tools::promote_args::type result(T base) - { return base; } + static T result(T base){ return base; } }; @@ -63,7 +60,7 @@ template struct power_if_positive { template - static typename tools::promote_args::type result(T base, const Policy&) + static T result(T base, const Policy&) { return positive_power::result(base); } }; @@ -71,8 +68,7 @@ template struct power_if_positive { template - static typename tools::promote_args::type - result(T base, const Policy& policy) + static T result(T base, const Policy& policy) { if (base == 0) { @@ -91,8 +87,7 @@ template <> struct power_if_positive<0, true> { template - static typename tools::promote_args::type - result(T base, const Policy& policy) + static T result(T base, const Policy& policy) { if (base == 0) { @@ -127,7 +122,10 @@ struct select_power_if_positive template inline typename tools::promote_args::type pow(T base, const Policy& policy) -{ return detail::select_power_if_positive::type::result(base, policy); } +{ + typedef typename tools::promote_args::type result_type; + return detail::select_power_if_positive::type::result(static_cast(base), policy); +} template diff --git a/3party/boost/boost/math/tools/roots.hpp b/3party/boost/boost/math/tools/roots.hpp index ce0cfe0b84..356197dcf2 100644 --- a/3party/boost/boost/math/tools/roots.hpp +++ b/3party/boost/boost/math/tools/roots.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -24,7 +23,7 @@ #pragma warning(push) #pragma warning(disable: 4512) #endif -#include +#include #ifdef BOOST_MSVC #pragma warning(pop) #endif @@ -39,7 +38,7 @@ namespace detail{ template inline void unpack_0(const Tuple& t, T& val) -{ val = std::tr1::get<0>(t); } +{ val = boost::math::get<0>(t); } template void handle_zero_derivative(F f, @@ -64,7 +63,6 @@ void handle_zero_derivative(F f, guess = min; } unpack_0(f(guess), last_f0); - //last_f0 = std::tr1::get<0>(f(guess)); delta = guess - result; } if(sign(last_f0) * sign(f0) < 0) @@ -201,7 +199,7 @@ T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_ last_f0 = f0; delta2 = delta1; delta1 = delta; - std::tr1::tie(f0, f1) = f(result); + boost::math::tie(f0, f1) = f(result); if(0 == f0) break; if(f1 == 0) @@ -296,7 +294,7 @@ T halley_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& max_i last_f0 = f0; delta2 = delta1; delta1 = delta; - std::tr1::tie(f0, f1, f2) = f(result); + boost::math::tie(f0, f1, f2) = f(result); BOOST_MATH_INSTRUMENT_VARIABLE(f0); BOOST_MATH_INSTRUMENT_VARIABLE(f1); @@ -446,7 +444,7 @@ T schroeder_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& ma last_f0 = f0; delta2 = delta1; delta1 = delta; - std::tr1::tie(f0, f1, f2) = f(result); + boost::math::tie(f0, f1, f2) = f(result); if(0 == f0) break; if((f1 == 0) && (f2 == 0)) diff --git a/3party/boost/boost/math/tools/test_data.hpp b/3party/boost/boost/math/tools/test_data.hpp index 23a1abb563..4c28d7569d 100644 --- a/3party/boost/boost/math/tools/test_data.hpp +++ b/3party/boost/boost/math/tools/test_data.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -120,11 +120,11 @@ inline void unpack_and_append_tuple(Seq& s, { // extract the N'th element, append, and recurse: typedef typename Seq::value_type value_type; - value_type val = std::tr1::get(data); + value_type val = boost::math::get(data); s.push_back(val); typedef boost::integral_constant next_value; - typedef boost::integral_constant::value > N+1)> terminate; + typedef boost::integral_constant::value > N+1)> terminate; unpack_and_append_tuple(s, data, next_value(), terminate()); } @@ -140,7 +140,7 @@ inline void unpack_and_append(Seq& s, const Item& data, const boost::false_type& { // Item had better be a tuple-like type or we've had it!!!! typedef boost::integral_constant next_value; - typedef boost::integral_constant::value > 0)> terminate; + typedef boost::integral_constant::value > 0)> terminate; unpack_and_append_tuple(s, data, next_value(), terminate()); } diff --git a/3party/boost/boost/math/tools/tuple.hpp b/3party/boost/boost/math/tools/tuple.hpp new file mode 100644 index 0000000000..7ee42e3fae --- /dev/null +++ b/3party/boost/boost/math/tools/tuple.hpp @@ -0,0 +1,112 @@ +// (C) Copyright John Maddock 2010. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_TUPLE_HPP_INCLUDED +# define BOOST_MATH_TUPLE_HPP_INCLUDED +# include + +#include // for BOOST_HAS_TR1_TUPLE + +#ifndef BOOST_NO_0X_HDR_TUPLE + +#include + +namespace boost{ namespace math{ + +using ::std::tuple; + +// [6.1.3.2] Tuple creation functions +using ::std::ignore; +using ::std::make_tuple; +using ::std::tie; +using ::std::get; + +// [6.1.3.3] Tuple helper classes +using ::std::tuple_size; +using ::std::tuple_element; + +}} + +#elif defined(BOOST_HAS_TR1_TUPLE) + +#include + +namespace boost{ namespace math{ + +using ::std::tr1::tuple; + +// [6.1.3.2] Tuple creation functions +using ::std::tr1::ignore; +using ::std::tr1::make_tuple; +using ::std::tr1::tie; +using ::std::tr1::get; + +// [6.1.3.3] Tuple helper classes +using ::std::tr1::tuple_size; +using ::std::tr1::tuple_element; + +}} + +#elif (defined(__BORLANDC__) && (__BORLANDC__ <= 0x600)) || (defined(_MSC_VER) && (_MSC_VER < 1310)) || defined(__IBMCPP__) + +#include +#include +#include + +namespace boost{ namespace math{ + +using ::boost::tuple; + +// [6.1.3.2] Tuple creation functions +using ::boost::tuples::ignore; +using ::boost::make_tuple; +using ::boost::tie; + +// [6.1.3.3] Tuple helper classes +template +struct tuple_size + : public ::boost::integral_constant + < ::std::size_t, ::boost::tuples::length::value> +{}; + +template < int I, class T> +struct tuple_element +{ + typedef typename boost::tuples::element::type type; +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) +// [6.1.3.4] Element access +using ::boost::get; +#endif + +} } // namespaces + +#else + +#include +#include + +namespace boost{ namespace math{ + +using ::boost::fusion::tuple; + +// [6.1.3.2] Tuple creation functions +using ::boost::fusion::ignore; +using ::boost::fusion::make_tuple; +using ::boost::fusion::tie; +using ::boost::fusion::get; + +// [6.1.3.3] Tuple helper classes +using ::boost::fusion::tuple_size; +using ::boost::fusion::tuple_element; + +}} + +#endif + +#endif + + diff --git a/3party/boost/boost/mpi/datatype.hpp b/3party/boost/boost/mpi/datatype.hpp index 517126bb8b..7fa7e1c3d0 100644 --- a/3party/boost/boost/mpi/datatype.hpp +++ b/3party/boost/boost/mpi/datatype.hpp @@ -341,12 +341,13 @@ BOOST_MPI_DATATYPE(boost::archive::object_reference_type, get_mpi_datatype(uint_ BOOST_MPI_DATATYPE(boost::archive::tracking_type, get_mpi_datatype(bool()), builtin); BOOST_MPI_DATATYPE(boost::serialization::collection_size_type, get_mpi_datatype(std::size_t()), integer); BOOST_MPI_DATATYPE(boost::serialization::item_version_type, get_mpi_datatype(uint_least8_t()), integer); - #endif // Doxygen } } // end namespace boost::mpi +// direct support for special primitive data types of the serialization library +// in the case of homogeneous systems // define a macro to make explicit designation of this more transparent #define BOOST_IS_MPI_DATATYPE(T) \ namespace boost { \ diff --git a/3party/boost/boost/mpi/detail/packed_iprimitive.hpp b/3party/boost/boost/mpi/detail/packed_iprimitive.hpp index 9471a00b92..6e981c7f2b 100644 --- a/3party/boost/boost/mpi/detail/packed_iprimitive.hpp +++ b/3party/boost/boost/mpi/detail/packed_iprimitive.hpp @@ -10,7 +10,6 @@ #define BOOST_MPI_PACKED_IPRIMITIVE_HPP #include -#include #include // size_t #include #include @@ -71,11 +70,13 @@ public: load_impl(x.address(), get_mpi_datatype(*x.address()), x.count()); } +/* template void load(serialization::array const& x) { load_array(x,0u); } +*/ typedef is_mpi_datatype use_array_optimization; @@ -83,35 +84,31 @@ public: template void load( T & t) { - load_impl(&t, get_mpi_datatype(t), 1); + load_impl(&t, get_mpi_datatype(t), 1); } template void load(std::basic_string & s) { - unsigned int l; + unsigned int l; load(l); - // borland de-allocator fixup - #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) - if(NULL != s.data()) - #endif s.resize(l); // note breaking a rule here - could be a problem on some platform - load_impl(const_cast(s.data()),get_mpi_datatype(CharType()),l); + load_impl(const_cast(s.data()),get_mpi_datatype(CharType()),l); } private: void load_impl(void * p, MPI_Datatype t, int l) { - BOOST_MPI_CHECK_RESULT(MPI_Unpack, + BOOST_MPI_CHECK_RESULT(MPI_Unpack, (const_cast(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position, p, l, t, comm)); } - buffer_type & buffer_; - mutable std::size_t size_; - MPI_Comm comm; - int position; + buffer_type & buffer_; + mutable std::size_t size_; + MPI_Comm comm; + int position; }; } } // end namespace boost::mpi diff --git a/3party/boost/boost/mpi/detail/packed_oprimitive.hpp b/3party/boost/boost/mpi/detail/packed_oprimitive.hpp index eb7ba2febc..1f59df8977 100644 --- a/3party/boost/boost/mpi/detail/packed_oprimitive.hpp +++ b/3party/boost/boost/mpi/detail/packed_oprimitive.hpp @@ -10,7 +10,6 @@ #define BOOST_MPI_PACKED_OPRIMITIVE_HPP #include -#include #include // size_t #include @@ -74,7 +73,7 @@ public: template void save(const T & t) { - save_impl(&t, get_mpi_datatype(t), 1); + save_impl(&t, get_mpi_datatype(t), 1); } template @@ -88,23 +87,22 @@ public: private: void save_impl(void const * p, MPI_Datatype t, int l) - { - // allocate enough memory + { + // allocate enough memory int memory_needed; BOOST_MPI_CHECK_RESULT(MPI_Pack_size,(l,t,comm,&memory_needed)); - int position = buffer_.size(); - buffer_.resize(position + memory_needed); + int position = buffer_.size(); + buffer_.resize(position + memory_needed); - // pack the data into the buffer - BOOST_MPI_CHECK_RESULT(MPI_Pack, - (const_cast(p), l, t, boost::serialization::detail::get_data(buffer_), buffer_.size(), &position, comm)); - - // reduce the buffer size if needed - BOOST_ASSERT(std::size_t(position) <= buffer_.size()); - if (std::size_t(position) < buffer_.size()) - buffer_.resize(position); - } + // pack the data into the buffer + BOOST_MPI_CHECK_RESULT(MPI_Pack, + (const_cast(p), l, t, boost::serialization::detail::get_data(buffer_), buffer_.size(), &position, comm)); + // reduce the buffer size if needed + BOOST_ASSERT(std::size_t(position) <= buffer_.size()); + if (std::size_t(position) < buffer_.size()) + buffer_.resize(position); + } buffer_type& buffer_; mutable std::size_t size_; diff --git a/3party/boost/boost/mpi/packed_iarchive.hpp b/3party/boost/boost/mpi/packed_iarchive.hpp index d8b43766d7..c33e7f9979 100644 --- a/3party/boost/boost/mpi/packed_iarchive.hpp +++ b/3party/boost/boost/mpi/packed_iarchive.hpp @@ -118,6 +118,9 @@ public: load_override(x, version, use_optimized()); } + // input archives need to ignore the optional information + void load_override(archive::class_id_optional_type & /*t*/, int){} + void load_override(archive::class_name_type & t, int) { std::string cn; diff --git a/3party/boost/boost/mpi/packed_oarchive.hpp b/3party/boost/boost/mpi/packed_oarchive.hpp index c873bb42e8..fb87e460c5 100644 --- a/3party/boost/boost/mpi/packed_oarchive.hpp +++ b/3party/boost/boost/mpi/packed_oarchive.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -45,8 +46,9 @@ namespace boost { namespace mpi { */ class BOOST_MPI_DECL packed_oarchive - : public oprimitive, - public archive::detail::common_oarchive + : public oprimitive + , public archive::detail::common_oarchive + , public archive::detail::shared_ptr_helper { public: /** @@ -106,6 +108,9 @@ public: save_override(x, version, use_optimized()); } + // input archives need to ignore the optional information + void save_override(const archive::class_id_optional_type & /*t*/, int){} + // explicitly convert to char * to avoid compile ambiguities void save_override(const archive::class_name_type & t, int){ const std::string s(t); diff --git a/3party/boost/boost/msm/back/dispatch_table.hpp b/3party/boost/boost/msm/back/dispatch_table.hpp index fa3f3cd683..7c6acb68d9 100644 --- a/3party/boost/boost/msm/back/dispatch_table.hpp +++ b/3party/boost/boost/msm/back/dispatch_table.hpp @@ -68,16 +68,16 @@ struct dispatch_table HandledEnum res = first_row::execute(fsm,region_index,state,evt); if (HANDLED_TRUE!=res) { - // if the first rejected, move on to the next one + // if the first rejected, move on to the next one HandledEnum sub_res = execute::type>(fsm,region_index,state,evt, ::boost::mpl::bool_< ::boost::mpl::empty::type>::type::value>()); - // if at least one guards rejects, the event will not generate a call to no_transition - HandledEnum handled = ((HANDLED_GUARD_REJECT==sub_res) || - (HANDLED_GUARD_REJECT==res))? - HANDLED_GUARD_REJECT:sub_res; - return handled; + // if at least one guards rejects, the event will not generate a call to no_transition + if ((HANDLED_FALSE==sub_res) && (HANDLED_GUARD_REJECT==res) ) + return HANDLED_GUARD_REJECT; + else + return sub_res; } return res; } diff --git a/3party/boost/boost/msm/back/fold_to_list.hpp b/3party/boost/boost/msm/back/fold_to_list.hpp new file mode 100644 index 0000000000..334d17d52d --- /dev/null +++ b/3party/boost/boost/msm/back/fold_to_list.hpp @@ -0,0 +1,56 @@ +// Copyright 2008 Christophe Henry +// henry UNDERSCORE christophe AT hotmail DOT com +// This is taken from Boost.Proto's documentation +// Copyright for the original version: +// Copyright 2008 Eric Niebler. Distributed +// under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MSM_BACK_FOLD_TO_LIST_H +#define BOOST_MSM_BACK_FOLD_TO_LIST_H + +#include +#include +#include +#include + +namespace boost { namespace msm { namespace back +{ + struct state_copy_tag + { + }; + ::boost::proto::terminal::type const states_={{}}; + struct FoldToList + : ::boost::proto::or_< + // Don't add the states_ terminal to the list + ::boost::proto::when< + ::boost::proto::terminal< state_copy_tag > + , ::boost::proto::_state + > + // Put all other terminals at the head of the + // list that we're building in the "state" parameter + , ::boost::proto::when< + ::boost::proto::terminal< ::boost::proto::_> + , boost::fusion::cons< ::boost::proto::_value, ::boost::proto::_state>( + ::boost::proto::_value, ::boost::proto::_state + ) + > + // For left-shift operations, first fold the right + // child to a list using the current state. Use + // the result as the state parameter when folding + // the left child to a list. + , ::boost::proto::when< + ::boost::proto::shift_left + , FoldToList( + ::boost::proto::_left + , ::boost::proto::call + ) + > + > + {}; + +}}} + +#endif //BOOST_MSM_BACK_FOLD_TO_LIST_H + diff --git a/3party/boost/boost/msm/back/history_policies.hpp b/3party/boost/boost/msm/back/history_policies.hpp index 4ef930454e..cf507b52eb 100644 --- a/3party/boost/boost/msm/back/history_policies.hpp +++ b/3party/boost/boost/msm/back/history_policies.hpp @@ -36,7 +36,7 @@ public: } // returns the state where the state machine should be at start template - int* const history_entry(Event const& ) + const int* history_entry(Event const& ) { // always come back to the original state return m_initialStates; @@ -49,6 +49,11 @@ public: } return *this; } + template + void serialize(Archive & ar, const unsigned int) + { + ar & m_initialStates; + } private: int m_initialStates[NumberOfRegions]; }; @@ -72,7 +77,7 @@ public: } // returns the state where the state machine should be at start template - int* const history_entry(Event const& ) + const int* history_entry(Event const& ) { // always load back the last active state return m_initialStates; @@ -85,6 +90,11 @@ public: } return *this; } + template + void serialize(Archive & ar, const unsigned int) + { + ar & m_initialStates; + } private: int m_initialStates[NumberOfRegions]; }; @@ -111,7 +121,7 @@ public: } // returns the state where the state machine should be at start template - int* const history_entry(Event const&) + const int* history_entry(Event const&) { if ( ::boost::mpl::contains::value) { @@ -129,6 +139,12 @@ public: } return *this; } + template + void serialize(Archive & ar, const unsigned int) + { + ar & m_initialStates; + ar & m_currentStates; + } private: int m_initialStates[NumberOfRegions]; int m_currentStates[NumberOfRegions]; diff --git a/3party/boost/boost/msm/back/metafunctions.hpp b/3party/boost/boost/msm/back/metafunctions.hpp index b0fbe2626b..f150cc42b6 100644 --- a/3party/boost/boost/msm/back/metafunctions.hpp +++ b/3party/boost/boost/msm/back/metafunctions.hpp @@ -648,7 +648,7 @@ template inline typename ::boost::disable_if::type, typename is_pseudo_exit::type>,bool >::type -is_exit_state_active(FSM& fsm) +is_exit_state_active(FSM&) { return false; } diff --git a/3party/boost/boost/msm/back/state_machine.hpp b/3party/boost/boost/msm/back/state_machine.hpp index 294debfae5..1210bd17a8 100644 --- a/3party/boost/boost/msm/back/state_machine.hpp +++ b/3party/boost/boost/msm/back/state_machine.hpp @@ -17,6 +17,9 @@ #include #include #include + +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + #include #include @@ -44,7 +47,11 @@ #ifndef BOOST_NO_RTTI #include #endif + +#include + #include +#include #include #include #include @@ -58,6 +65,7 @@ BOOST_MPL_HAS_XXX_TRAIT_DEF(no_automatic_create) BOOST_MPL_HAS_XXX_TRAIT_DEF(non_forwarding_flag) BOOST_MPL_HAS_XXX_TRAIT_DEF(direct_entry) BOOST_MPL_HAS_XXX_TRAIT_DEF(initial_event) +BOOST_MPL_HAS_XXX_TRAIT_DEF(do_serialize) #ifndef BOOST_MSM_CONSTRUCTOR_ARG_SIZE #define BOOST_MSM_CONSTRUCTOR_ARG_SIZE 5 // default max number of arguments for constructors @@ -81,6 +89,7 @@ template const boost::msm::back::dispatch_table dispatch_table::instance; + // library-containing class for state machines. Pass the actual FSM class as // the Concrete parameter. template @@ -991,6 +1000,11 @@ private: { ret_handled = HANDLED_TRUE; } + + // process completion transitions BEFORE any other event in the pool (UML Standard 2.3 §15.3.14) + handle_eventless_transitions_helper eventless_helper(this,(handled == HANDLED_TRUE)); + eventless_helper.process_completion_event(); + // after handling, take care of the deferred events defer_helper.do_post_handle_deferred(handled); @@ -998,11 +1012,6 @@ private: // because of another processing, and if yes, start handling them do_post_msg_queue_helper(::boost::mpl::bool_::type::value>()); - // event can be handled, processing - // handle with lowest priority event-less transitions - handle_eventless_transitions_helper eventless_helper(this,(handled!=HANDLED_FALSE)); - eventless_helper.process_completion_event(); - return ret_handled; } } @@ -1013,6 +1022,53 @@ private: return this->m_states; } + template + struct serialize_state + { + serialize_state(Archive& ar):ar_(ar){} + + template + typename ::boost::enable_if< + typename ::boost::mpl::or_< + typename has_do_serialize::type, + typename is_composite_state::type + >::type + ,void + >::type + operator()(T& t) const + { + ar_ & t; + } + template + typename ::boost::disable_if< + typename ::boost::mpl::or_< + typename has_do_serialize::type, + typename is_composite_state::type + >::type + ,void + >::type + operator()(T& t) const + { + // no state to serialize + } + Archive& ar_; + }; + + template + void serialize(Archive & ar, const unsigned int) + { + // invoke serialization of the base class + (serialize_state(ar))(boost::serialization::base_object(*this)); + // now our attributes + ar & m_states; + // queues cannot be serialized => skip + ar & m_history; + ar & m_event_processing; + ar & m_is_included; + // visitors cannot be serialized => skip + ::boost::fusion::for_each(m_substate_list, serialize_state(ar)); + } + // linearly search for the state with the given id struct get_state_id_helper { @@ -1138,7 +1194,24 @@ private: int* const m_initial_states; int m_index; }; - public: + public: + struct update_state + { + update_state(substate_list& to_overwrite_):to_overwrite(&to_overwrite_){} + template + void operator()(StateType const& astate) const + { + ::boost::fusion::at_key(*to_overwrite)=astate; + } + substate_list* to_overwrite; + }; + template + void set_states(Expr const& expr) + { + ::boost::fusion::for_each( + ::boost::fusion::as_vector(FoldToList()(expr, boost::fusion::nil())),update_state(this->m_substate_list)); + } + // Construct with the default initial states state_machine() :Derived() @@ -1157,13 +1230,38 @@ private: // create states fill_states(this); } + template + state_machine + (Expr const& expr,typename ::boost::enable_if::type >::type* dummy=0) + :Derived() + ,m_events_queue() + ,m_deferred_events_queue() + ,m_history() + ,m_event_processing(false) + ,m_is_included(false) + ,m_visitors() + ,m_substate_list() + { + BOOST_MPL_ASSERT_MSG( + ( ::boost::proto::matches::value), + THE_STATES_EXPRESSION_PASSED_DOES_NOT_MATCH_GRAMMAR, + (FoldToList)); + // initialize our list of states with the ones defined in Derived::initial_state + ::boost::mpl::for_each< seq_initial_states, ::boost::msm::wrap > + (init_states(m_states)); + m_history.set_initial_states(m_states); + // create states + fill_states(this); + set_states(expr); + } // Construct with the default initial states and some default argument(s) #define MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB(z, n, unused) ARG ## n t ## n #define MSM_CONSTRUCTOR_HELPER_EXECUTE(z, n, unused) \ template \ state_machine(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ) ) \ + >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \ + typename ::boost::disable_if::type >::type* dummy=0 ) \ :Derived(BOOST_PP_ENUM_PARAMS(n,t)) \ ,m_events_queue() \ ,m_deferred_events_queue() \ @@ -1177,7 +1275,31 @@ private: (init_states(m_states)); \ m_history.set_initial_states(m_states); \ fill_states(this); \ + } \ + template \ + state_machine(Expr const& expr,BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ), \ + typename ::boost::enable_if::type >::type* dummy=0 ) \ + :Derived(BOOST_PP_ENUM_PARAMS(n,t)) \ + ,m_events_queue() \ + ,m_deferred_events_queue() \ + ,m_history() \ + ,m_event_processing(false) \ + ,m_is_included(false) \ + ,m_visitors() \ + ,m_substate_list() \ + { \ + BOOST_MPL_ASSERT_MSG( \ + ( ::boost::proto::matches::value), \ + THE_STATES_EXPRESSION_PASSED_DOES_NOT_MATCH_GRAMMAR, \ + (FoldToList)); \ + ::boost::mpl::for_each< seq_initial_states, ::boost::msm::wrap > \ + (init_states(m_states)); \ + m_history.set_initial_states(m_states); \ + fill_states(this); \ + set_states(expr); \ } + BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_CONSTRUCTOR_ARG_SIZE,1), MSM_CONSTRUCTOR_HELPER_EXECUTE, ~) #undef MSM_CONSTRUCTOR_HELPER_EXECUTE #undef MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB @@ -1650,12 +1772,21 @@ BOOST_PP_REPEAT(BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_ARGS_EXE #undef MSM_VISITOR_ARGS_EXECUTE #undef MSM_VISITOR_ARGS_SUB +// the IBM compiler seems to have problems with nested classes +// the same seems to apply to the Apple version of gcc 4.0.1 (just in case we do for < 4.1) +// and also to MS VC < 8 +#if defined (__IBMCPP__) || (defined (__APPLE_CC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) || (defined(_MSC_VER) && (_MSC_VER < 1400)) + public: +#endif template void set_containing_sm(ContainingSM* sm) { m_is_included=true; ::boost::fusion::for_each(m_substate_list,add_state(this,sm)); } +#if defined (__IBMCPP__) || (defined (__APPLE_CC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) || (defined(_MSC_VER) && (_MSC_VER < 1400)) + private: +#endif // A function object for use with mpl::for_each that stuffs // states into the state list. template @@ -2012,6 +2143,10 @@ BOOST_PP_REPEAT(BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_ARGS_EXE m_history.history_exit(this->m_states); } + // the IBM and VC<8 compilers seem to have problems with the friend declaration of dispatch_table +#if defined (__IBMCPP__) || (defined(_MSC_VER) && (_MSC_VER < 1400)) + public: +#endif // no transition for event. template static HandledEnum call_no_transition(library_sm& , int , int , Event const& ) @@ -2025,7 +2160,6 @@ BOOST_PP_REPEAT(BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_ARGS_EXE fsm.defer_event(e); return HANDLED_DEFERRED; } - // called for completion events. Default address set in the dispatch_table at init // prevents no-transition detection for completion events template @@ -2033,7 +2167,9 @@ BOOST_PP_REPEAT(BOOST_PP_ADD(BOOST_MSM_VISITOR_ARG_SIZE,1), MSM_VISITOR_ARGS_EXE { return HANDLED_FALSE; } - +#if defined (__IBMCPP__) || (defined(_MSC_VER) && (_MSC_VER < 1400)) + private: +#endif // puts a deferred event in the queue void post_deferred_event(deferred_fct& deferred) { diff --git a/3party/boost/boost/msm/front/euml/common.hpp b/3party/boost/boost/msm/front/euml/common.hpp index b9150bff50..c611287341 100644 --- a/3party/boost/boost/msm/front/euml/common.hpp +++ b/3party/boost/boost/msm/front/euml/common.hpp @@ -12,27 +12,12 @@ #define BOOST_MSM_FRONT_EUML_COMMON_H #include - -#ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY -#undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY -#endif - -#ifdef BOOST_PROTO_MAX_ARITY -#undef BOOST_PROTO_MAX_ARITY -#endif +#include #ifndef BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif -#ifdef BOOST_MSVC -#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 7 -#define BOOST_PROTO_MAX_ARITY 7 -#else -#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6 -#define BOOST_PROTO_MAX_ARITY 6 -#endif - #include #include @@ -197,6 +182,18 @@ struct sm_domain : proto::domain< proto::generator, terminal_grammar > {}; +struct state_grammar : + proto::and_< + proto::not_ >, + proto::not_ >, + proto::not_ >, + proto::not_ > + > +{}; +struct state_domain + : proto::domain< proto::generator, state_grammar,sm_domain > +{}; + template struct euml_terminal : proto::extends, sm_domain> @@ -229,10 +226,10 @@ struct euml_event: proto::extends::type, EVT }; }; template -struct euml_state: proto::extends::type, STATE, sm_domain> +struct euml_state: proto::extends::type, STATE, state_domain> { typedef state_tag euml_tag_type; - using proto::extends::type, STATE, sm_domain>::operator=; + using proto::extends::type, STATE, state_domain>::operator=; template }; NoAction const no_action; +struct fsm_artefact_tag {}; template struct GetSource_ : euml_action > { @@ -397,8 +395,7 @@ struct GetSource_ : euml_action > return src; } }; -struct get_source_tag {}; -struct GetSource_Helper: proto::extends< proto::terminal::type, GetSource_Helper, sm_domain> +struct GetSource_Helper: proto::extends< proto::terminal::type, GetSource_Helper, sm_domain> { GetSource_Helper(){} template : euml_action > return tgt; } }; -struct get_target_tag {}; -struct GetTarget_Helper: proto::extends< proto::terminal::type, GetTarget_Helper, sm_domain> +struct GetTarget_Helper: proto::extends< proto::terminal::type, GetTarget_Helper, sm_domain> { GetTarget_Helper(){} template : euml_action > return state; } }; -struct get_state_tag {}; -struct GetState_Helper: proto::extends< proto::terminal::type, GetState_Helper, sm_domain> +struct GetState_Helper: proto::extends< proto::terminal::type, GetState_Helper, sm_domain> { GetState_Helper(){} template : euml_action > return evt; } }; -struct get_event_tag {}; -struct GetEvent_Helper: proto::extends< proto::terminal::type, GetEvent_Helper, sm_domain> +struct GetEvent_Helper: proto::extends< proto::terminal::type, GetEvent_Helper, sm_domain> { GetEvent_Helper(){} template : euml_action > return fsm; } }; -struct get_fsm_tag {}; -struct GetFsm_Helper: proto::extends< proto::terminal::type, GetFsm_Helper, sm_domain> +struct GetFsm_Helper: proto::extends< proto::terminal::type, GetFsm_Helper, sm_domain> { GetFsm_Helper(){} template } }; -struct substate_tag {}; -struct SubState_Helper: proto::extends< proto::terminal::type, SubState_Helper, sm_domain> +struct SubState_Helper: proto::extends< proto::terminal::type, SubState_Helper, sm_domain> { SubState_Helper(){} - using proto::extends< proto::terminal::type, SubState_Helper, sm_domain>::operator=; + using proto::extends< proto::terminal::type, SubState_Helper, sm_domain>::operator=; template > } }; -struct get_attribute_tag -{ -}; -struct GetAttribute_Helper: proto::extends< proto::terminal::type, GetAttribute_Helper, sm_domain> +struct GetAttribute_Helper: proto::extends< proto::terminal::type, GetAttribute_Helper, sm_domain> { GetAttribute_Helper(){} template ::type, Get_Flag_Helper, sm_domain> +struct Get_Flag_Helper: proto::extends< proto::terminal::type, Get_Flag_Helper, sm_domain> { Get_Flag_Helper(){} template fsm.defer_event(evt); } }; -struct defer_event_tag {}; -struct Defer_Helper : proto::extends< proto::terminal::type, Defer_Helper, sm_domain> +struct Defer_Helper : proto::extends< proto::terminal::type, Defer_Helper, sm_domain> { Defer_Helper(){} - using proto::extends< proto::terminal::type, Defer_Helper, sm_domain>::operator=; + using proto::extends< proto::terminal::type, Defer_Helper, sm_domain>::operator=; template struct BuildGuardsCases::case_ : proto::or_< proto::when < - proto::terminal, - get_action_name() - >, + proto::terminal, + get_action_name() + >, proto::when< - proto::terminal, - proto::_ - >, + proto::terminal, + proto::_ + >, proto::when< - proto::terminal, - proto::_ - >, + proto::terminal, + proto::_ + >, proto::when< - proto::terminal, - proto::_ - > + proto::terminal, + proto::_ + >, + proto::when< + proto::terminal, + get_fct() + >, + proto::when< + proto::terminal, + proto::_child + > > {}; diff --git a/3party/boost/boost/msm/front/euml/state_grammar.hpp b/3party/boost/boost/msm/front/euml/state_grammar.hpp index c9338ab207..2d49ed9fbd 100644 --- a/3party/boost/boost/msm/front/euml/state_grammar.hpp +++ b/3party/boost/boost/msm/front/euml/state_grammar.hpp @@ -484,23 +484,27 @@ struct BuildActionsCases::case_ proto::when< proto::terminal, get_action_name() - >, + >, proto::when< proto::terminal, proto::_ - >, + >, proto::when< proto::terminal, proto::_ - >, + >, proto::when< proto::terminal, proto::_ - >, + >, proto::when< - proto::terminal, - get_fct() - > + proto::terminal, + get_fct() + >, + proto::when< + proto::terminal, + proto::_child + > > {}; struct BuildActions diff --git a/3party/boost/boost/msm/front/functor_row.hpp b/3party/boost/boost/msm/front/functor_row.hpp index f9bf38631b..f65c23f75f 100644 --- a/3party/boost/boost/msm/front/functor_row.hpp +++ b/3party/boost/boost/msm/front/functor_row.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_MSM_FRONT_FUNCTOR_ROW_H #define BOOST_MSM_FRONT_FUNCTOR_ROW_H +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + #include #include diff --git a/3party/boost/boost/msm/front/state_machine_def.hpp b/3party/boost/boost/msm/front/state_machine_def.hpp index 80782856d5..33c14b014c 100644 --- a/3party/boost/boost/msm/front/state_machine_def.hpp +++ b/3party/boost/boost/msm/front/state_machine_def.hpp @@ -13,6 +13,9 @@ #include #include + +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + #include #include diff --git a/3party/boost/boost/msm/proto_config.hpp b/3party/boost/boost/msm/proto_config.hpp new file mode 100644 index 0000000000..ec8182f728 --- /dev/null +++ b/3party/boost/boost/msm/proto_config.hpp @@ -0,0 +1,34 @@ +// Copyright 2008 Christophe Henry +// henry UNDERSCORE christophe AT hotmail DOT com +// This is an extended version of the state machine available in the boost::mpl library +// Distributed under the same license as the original. +// Copyright for the original version: +// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed +// under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MSM_PROTO_CONFIG_H +#define BOOST_MSM_PROTO_CONFIG_H + +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +#ifdef BOOST_MSVC + #if BOOST_PROTO_MAX_ARITY <= 7 + #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY + #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY + #endif + #define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 7 + #define BOOST_PROTO_MAX_ARITY 7 + #endif +#else + #if BOOST_PROTO_MAX_ARITY <= 6 + #ifdef BOOST_MPL_LIMIT_METAFUNCTION_ARITY + #undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY + #endif + #define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 6 + #define BOOST_PROTO_MAX_ARITY 6 + #endif +#endif + +#endif //BOOST_MSM_PROTO_CONFIG_H diff --git a/3party/boost/boost/multi_array/base.hpp b/3party/boost/boost/multi_array/base.hpp index 9eb23c6238..ecbe09708a 100644 --- a/3party/boost/boost/multi_array/base.hpp +++ b/3party/boost/boost/multi_array/base.hpp @@ -431,22 +431,52 @@ protected: index offset = 0; size_type dim = 0; for (size_type n = 0; n != NumDims; ++n) { + + // Use array specs and input specs to produce real specs. const index default_start = index_bases[n]; const index default_finish = default_start+extents[n]; const index_range& current_range = indices.ranges_[n]; index start = current_range.get_start(default_start); index finish = current_range.get_finish(default_finish); - index index_factor = current_range.stride(); + index stride = current_range.stride(); + BOOST_ASSERT(stride != 0); - // integral trick for ceiling((finish-start) / index_factor) - index shrinkage = index_factor > 0 ? 1 : -1; - index len = (finish - start + (index_factor - shrinkage)) / index_factor; + // An index range indicates a half-open strided interval + // [start,finish) (with stride) which faces upward when stride + // is positive and downward when stride is negative, + // RG: The following code for calculating length suffers from + // some representation issues: if finish-start cannot be represented as + // by type index, then overflow may result. + + index len; + if ((finish - start) / stride < 0) { + // [start,finish) is empty according to the direction imposed by + // the stride. + len = 0; + } else { + // integral trick for ceiling((finish-start) / stride) + // taking into account signs. + index shrinkage = stride > 0 ? 1 : -1; + len = (finish - start + (stride - shrinkage)) / stride; + } + + // start marks the closed side of the range, so it must lie + // exactly in the set of legal indices + // with a special case for empty arrays 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); + ((start <= index_bases[n]+index(extents[n])) || + (start == index_bases[n] && extents[n] == 0))); + +#ifndef BOOST_DISABLE_ASSERTS + // finish marks the open side of the range, so it can go one past + // the "far side" of the range (the top if stride is positive, the bottom + // if stride is negative). + index bound_adjustment = stride < 0 ? 1 : 0; + BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) && + (finish <= (index_bases[n] + index(extents[n]) - bound_adjustment))); +#endif // BOOST_DISABLE_ASSERTS + // the array data pointer is modified to account for non-zero // bases during slicing (see [Garcia] for the math involved) @@ -454,9 +484,9 @@ protected: if (!current_range.is_degenerate()) { - // The index_factor for each dimension is included into the + // The stride for each dimension is included into the // strides for the array_view (see [Garcia] for the math involved). - new_strides[dim] = index_factor * strides[n]; + new_strides[dim] = stride * strides[n]; // calculate new extents new_extents[dim] = len; diff --git a/3party/boost/boost/multi_array/collection_concept.hpp b/3party/boost/boost/multi_array/collection_concept.hpp index c79ace1bd8..c2cd403c4d 100644 --- a/3party/boost/boost/multi_array/collection_concept.hpp +++ b/3party/boost/boost/multi_array/collection_concept.hpp @@ -17,46 +17,10 @@ namespace boost { namespace detail { -namespace multi_array { - - //=========================================================================== - // Collection Concept - - template - struct CollectionConcept - { - typedef typename Collection::value_type value_type; - typedef typename Collection::iterator iterator; - typedef typename Collection::const_iterator const_iterator; - typedef typename Collection::reference reference; - typedef typename Collection::const_reference const_reference; - // typedef typename Collection::pointer pointer; - typedef typename Collection::difference_type difference_type; - typedef typename Collection::size_type size_type; - - void constraints() { - boost::function_requires >(); - boost::function_requires >(); - boost::function_requires >(); - const_constraints(c); - i = c.begin(); - i = c.end(); - c.swap(c); - } - void const_constraints(const Collection& c) { - ci = c.begin(); - ci = c.end(); - n = c.size(); - b = c.empty(); - } - Collection c; - bool b; - iterator i; - const_iterator ci; - size_type n; - }; - +namespace multi_array { // Old location for this + using boost::CollectionConcept; } } + } #endif // COLLECTION_CONCEPT_RG103101_HPP diff --git a/3party/boost/boost/multi_array/concept_checks.hpp b/3party/boost/boost/multi_array/concept_checks.hpp index 326f0ce6f8..8b9d465144 100644 --- a/3party/boost/boost/multi_array/concept_checks.hpp +++ b/3party/boost/boost/multi_array/concept_checks.hpp @@ -22,9 +22,9 @@ #include "boost/iterator/iterator_concepts.hpp" namespace boost { -namespace detail { -namespace multi_array { +namespace multi_array_concepts { +namespace detail { // // idgen_helper - // This is a helper for generating index_gen instantiations with @@ -56,6 +56,8 @@ namespace multi_array { } }; +} // namespace detail + template struct ConstMultiArrayConcept @@ -70,10 +72,10 @@ namespace multi_array { // RG - a( CollectionArchetype) when available... a[ id ]; // Test slicing, keeping only the first dimension, losing the rest - idgen_helper::call(a,idgen[range],id); + detail::idgen_helper::call(a,idgen[range],id); // Test slicing, keeping all dimensions. - idgen_helper::call(a,idgen[range],range); + detail::idgen_helper::call(a,idgen[range],range); st = a.size(); st = a.num_dimensions(); @@ -134,10 +136,10 @@ namespace multi_array { value_type vt = a[ id ]; // Test slicing, keeping only the first dimension, losing the rest - idgen_helper::call(a,idgen[range],id); + detail::idgen_helper::call(a,idgen[range],id); // Test slicing, keeping all dimensions. - idgen_helper::call(a,idgen[range],range); + detail::idgen_helper::call(a,idgen[range],range); st = a.size(); st = a.num_dimensions(); @@ -158,10 +160,10 @@ namespace multi_array { // value_type vt = a[ id ]; // Test slicing, keeping only the first dimension, losing the rest - idgen_helper::call(a,idgen[range],id); + detail::idgen_helper::call(a,idgen[range],id); // Test slicing, keeping all dimensions. - idgen_helper::call(a,idgen[range],range); + detail::idgen_helper::call(a,idgen[range],range); st = a.size(); st = a.num_dimensions(); @@ -208,7 +210,14 @@ namespace multi_array { } // namespace multi_array -} // namespace detail + +namespace detail { + namespace multi_array { // Old locations for these + using boost::multi_array_concepts::ConstMultiArrayConcept; + using boost::multi_array_concepts::MutableMultiArrayConcept; + } +} + } // namespace boost diff --git a/3party/boost/boost/multi_array/multi_array_ref.hpp b/3party/boost/boost/multi_array/multi_array_ref.hpp index a8e0f7a124..7015e23591 100644 --- a/3party/boost/boost/multi_array/multi_array_ref.hpp +++ b/3party/boost/boost/multi_array/multi_array_ref.hpp @@ -89,7 +89,7 @@ public: explicit const_multi_array_ref(TPtr base, const ExtentList& extents) : base_(base), storage_(c_storage_order()) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); index_base_list_.assign(0); init_multi_array_ref(extents.begin()); @@ -100,7 +100,7 @@ public: const general_storage_order& so) : base_(base), storage_(so) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); index_base_list_.assign(0); init_multi_array_ref(extents.begin()); @@ -145,7 +145,7 @@ public: #endif // BOOST_NO_SFINAE reindex(const BaseList& values) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); boost::detail::multi_array:: copy_n(values.begin(),num_dimensions(),index_base_list_.begin()); origin_offset_ = @@ -163,7 +163,7 @@ public: template void reshape(const SizeList& extents) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); BOOST_ASSERT(num_elements_ == std::accumulate(extents.begin(),extents.end(), size_type(1),std::multiplies())); @@ -210,7 +210,7 @@ public: template const element& operator()(IndexList indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), shape(),strides(),index_bases()); @@ -448,7 +448,7 @@ public: explicit multi_array_ref(T* base, const ExtentList& extents) : super_type(base,extents) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); } template @@ -456,7 +456,7 @@ public: const general_storage_order& so) : super_type(base,extents,so) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); } @@ -478,7 +478,7 @@ public: template multi_array_ref& operator=(const ConstMultiArray& other) { function_requires< - detail::multi_array:: + multi_array_concepts:: ConstMultiArrayConcept >(); // make sure the dimensions agree @@ -511,7 +511,7 @@ public: template element& operator()(const IndexList& indices) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), this->shape(),this->strides(), @@ -578,7 +578,7 @@ public: template const element& operator()(const IndexList& indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::operator()(indices); } diff --git a/3party/boost/boost/multi_array/subarray.hpp b/3party/boost/boost/multi_array/subarray.hpp index c336f82d1e..a49891612f 100644 --- a/3party/boost/boost/multi_array/subarray.hpp +++ b/3party/boost/boost/multi_array/subarray.hpp @@ -80,7 +80,7 @@ public: template const element& operator()(const IndexList& indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), shape(),strides(),index_bases()); @@ -231,7 +231,7 @@ public: // Assignment from other ConstMultiArray types. template sub_array& operator=(const ConstMultiArray& other) { - function_requires< boost::detail::multi_array::ConstMultiArrayConcept< + function_requires< boost::multi_array_concepts::ConstMultiArrayConcept< ConstMultiArray, NumDims> >(); // make sure the dimensions agree @@ -288,7 +288,7 @@ public: template element& operator()(const IndexList& indices) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), this->shape(),this->strides(), @@ -323,7 +323,7 @@ public: template const element& operator()(const IndexList& indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::operator()(indices); } diff --git a/3party/boost/boost/multi_array/view.hpp b/3party/boost/boost/multi_array/view.hpp index 75d698f35e..cd3e44bf71 100644 --- a/3party/boost/boost/multi_array/view.hpp +++ b/3party/boost/boost/multi_array/view.hpp @@ -81,7 +81,7 @@ public: #endif reindex(const BaseList& values) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); boost::detail::multi_array:: copy_n(values.begin(),num_dimensions(),index_base_list_.begin()); origin_offset_ = @@ -119,7 +119,7 @@ public: template const element& operator()(IndexList indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), shape(),strides(),index_bases()); @@ -297,7 +297,7 @@ public: template multi_array_view& operator=(const ConstMultiArray& other) { function_requires< - boost::detail::multi_array:: + boost::multi_array_concepts:: ConstMultiArrayConcept >(); // make sure the dimensions agree @@ -328,7 +328,7 @@ public: template element& operator()(const IndexList& indices) { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::access_element(boost::type(), indices,origin(), this->shape(),this->strides(), @@ -392,7 +392,7 @@ public: template const element& operator()(const IndexList& indices) const { boost::function_requires< - detail::multi_array::CollectionConcept >(); + CollectionConcept >(); return super_type::operator()(indices); } diff --git a/3party/boost/boost/numeric/ublas/detail/matrix_assign.hpp b/3party/boost/boost/numeric/ublas/detail/matrix_assign.hpp index 36bca28d4a..3bc48ee072 100644 --- a/3party/boost/boost/numeric/ublas/detail/matrix_assign.hpp +++ b/3party/boost/boost/numeric/ublas/detail/matrix_assign.hpp @@ -13,6 +13,7 @@ #ifndef _BOOST_UBLAS_MATRIX_ASSIGN_ #define _BOOST_UBLAS_MATRIX_ASSIGN_ +#include // Required for make_conformant storage #include @@ -90,7 +91,7 @@ namespace detail { break; } else if (compare > 0) { if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ())) - if (*it2e != value_type/*zero*/()) + if (static_cast(*it2e) != value_type/*zero*/()) index.push_back (std::pair (it2e.index1 (), it2e.index2 ())); ++ it2e; if (it2e != it2e_end) @@ -102,7 +103,7 @@ namespace detail { } while (it2e != it2e_end) { if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ())) - if (*it2e != value_type/*zero*/()) + if (static_cast(*it2e) != value_type/*zero*/()) index.push_back (std::pair (it2e.index1 (), it2e.index2 ())); ++ it2e; } @@ -119,7 +120,7 @@ namespace detail { #endif while (it2e != it2e_end) { if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ())) - if (*it2e != value_type/*zero*/()) + if (static_cast(*it2e) != value_type/*zero*/()) index.push_back (std::pair (it2e.index1 (), it2e.index2 ())); ++ it2e; } @@ -136,7 +137,7 @@ namespace detail { #endif while (it2e != it2e_end) { if (conformant_restrict_type::other (it2e.index1 (), it2e.index2 ())) - if (*it2e != value_type/*zero*/()) + if (static_cast(*it2e) != value_type/*zero*/()) index.push_back (std::pair (it2e.index1 (), it2e.index2 ())); ++ it2e; } @@ -193,7 +194,7 @@ namespace detail { break; } else if (compare > 0) { if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ())) - if (*it1e != value_type/*zero*/()) + if (static_cast(*it1e) != value_type/*zero*/()) index.push_back (std::pair (it1e.index1 (), it1e.index2 ())); ++ it1e; if (it1e != it1e_end) @@ -205,7 +206,7 @@ namespace detail { } while (it1e != it1e_end) { if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ())) - if (*it1e != value_type/*zero*/()) + if (static_cast(*it1e) != value_type/*zero*/()) index.push_back (std::pair (it1e.index1 (), it1e.index2 ())); ++ it1e; } @@ -222,7 +223,7 @@ namespace detail { #endif while (it1e != it1e_end) { if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ())) - if (*it1e != value_type/*zero*/()) + if (static_cast(*it1e) != value_type/*zero*/()) index.push_back (std::pair (it1e.index1 (), it1e.index2 ())); ++ it1e; } @@ -239,7 +240,7 @@ namespace detail { #endif while (it1e != it1e_end) { if (conformant_restrict_type::other (it1e.index1 (), it1e.index2 ())) - if (*it1e != value_type/*zero*/()) + if (static_cast(*it1e) != value_type/*zero*/()) index.push_back (std::pair (it1e.index1 (), it1e.index2 ())); ++ it1e; } @@ -636,7 +637,8 @@ namespace detail { template