|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82285 - in trunk: boost/icl boost/icl/concept libs/icl/test/ex_boost_party_ libs/icl/test/test_casual_
From: afojgo_at_[hidden]
Date: 2012-12-30 16:11:47
Author: jofaber
Date: 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
New Revision: 82285
URL: http://svn.boost.org/trac/boost/changeset/82285
Log:
Bugfix Ticket #7231. Disabling move semantics for newest compiler versions.
Text files modified:
trunk/boost/icl/concept/interval_associator.hpp | 78 ++++++++--------
trunk/boost/icl/impl_config.hpp | 15 +++
trunk/boost/icl/interval_base_map.hpp | 4
trunk/boost/icl/interval_base_set.hpp | 4
trunk/boost/icl/interval_map.hpp | 6
trunk/boost/icl/interval_set.hpp | 4
trunk/boost/icl/map.hpp | 4
trunk/boost/icl/separate_interval_set.hpp | 4
trunk/boost/icl/split_interval_map.hpp | 6
trunk/boost/icl/split_interval_set.hpp | 4
trunk/libs/icl/test/ex_boost_party_/ex_boost_party.cpp | 8 +
trunk/libs/icl/test/ex_boost_party_/vc10_ex_boost_party.vcxproj | 4
trunk/libs/icl/test/test_casual_/test_casual.cpp | 179 +++++++++++++++++++++++++++++++++++++++
13 files changed, 254 insertions(+), 66 deletions(-)
Modified: trunk/boost/icl/concept/interval_associator.hpp
==============================================================================
--- trunk/boost/icl/concept/interval_associator.hpp (original)
+++ trunk/boost/icl/concept/interval_associator.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -325,7 +325,7 @@
}
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op + (T, c P&) T:{S}|{M} P:{e i S}|{b p M}
//------------------------------------------------------------------------------
@@ -340,7 +340,7 @@
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -357,9 +357,9 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op + (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'}
//------------------------------------------------------------------------------
@@ -374,7 +374,7 @@
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -391,9 +391,9 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op + (T, c P&) T:{S}|{M} P:{S}|{M}
//------------------------------------------------------------------------------
@@ -408,7 +408,7 @@
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type>
typename enable_if<is_interval_container<Type>, Type>::type
@@ -439,7 +439,7 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- Addition |=, |
@@ -477,7 +477,7 @@
return object += operand;
}
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op | (T, c P&) T:{S}|{M} P:{e i S}|{b p M}
//------------------------------------------------------------------------------
@@ -492,7 +492,7 @@
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -509,9 +509,9 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op | (T, c P&) T:{S}|{M} P:{S}|{M}
//------------------------------------------------------------------------------
@@ -526,7 +526,7 @@
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -543,9 +543,9 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op | (T, c P&) T:{S}|{M} P:{S}|{M}
//------------------------------------------------------------------------------
@@ -559,7 +559,7 @@
{
return object += operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type>
typename enable_if<is_interval_container<Type>, Type>::type
@@ -590,7 +590,7 @@
return boost::move(object += operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==============================================================================
@@ -707,7 +707,7 @@
return erase(object, operand);
}
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op - (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'}
//------------------------------------------------------------------------------
@@ -718,7 +718,7 @@
return object -= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_right_inter_combinable<Type, OperandT>, Type>::type
@@ -735,7 +735,7 @@
return boost::move(object -= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==============================================================================
//= Intersection<IntervalSet|IntervalSet>
@@ -776,7 +776,7 @@
return object;
}
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op & (T, c P&) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S<S' M<M' <:coarser
//------------------------------------------------------------------------------
@@ -787,7 +787,7 @@
return object &= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_inter_combinable<Type, OperandT>, Type>::type
@@ -804,9 +804,9 @@
return boost::move(object &= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op & (c P&, T) T:{S}|{M} P:{e i S'}|{e i b p S' M'} S<S' M<M' <:coarser
//------------------------------------------------------------------------------
@@ -817,7 +817,7 @@
return object &= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_inter_combinable<Type, OperandT>, Type>::type
@@ -834,9 +834,9 @@
return boost::move(object &= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op & (T, c T&) T:{S M}
//------------------------------------------------------------------------------
@@ -847,7 +847,7 @@
return object &= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type>
typename enable_if<is_interval_container<Type>, Type>::type
@@ -878,7 +878,7 @@
return boost::move(object &= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- intersects<IntervalSet|IntervalMap>
@@ -1011,7 +1011,7 @@
return icl::flip(object, operand);
}
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op ^ (T, c P&) T:{S}|{M} P:{e i S'}|{b p M'} S<S' M<M' <:coarser
//------------------------------------------------------------------------------
@@ -1022,7 +1022,7 @@
return object ^= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -1039,9 +1039,9 @@
return boost::move(object ^= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op ^ (c P&, T) T:{S}|{M} P:{e i S'}|{b p M'} S<S' M<M' <:coarser
//------------------------------------------------------------------------------
@@ -1052,7 +1052,7 @@
return object ^= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type, class OperandT>
typename enable_if<is_binary_intra_combinable<Type, OperandT>, Type>::type
@@ -1069,9 +1069,9 @@
return boost::move(object ^= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
-#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
+#ifdef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//------------------------------------------------------------------------------
//- T op ^ (T, c T&) T:{S M}
//------------------------------------------------------------------------------
@@ -1082,7 +1082,7 @@
return object ^= operand;
}
-#else //BOOST_NO_CXX11_RVALUE_REFERENCES
+#else //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
template<class Type>
typename enable_if<is_interval_container<Type>, Type>::type
@@ -1113,7 +1113,7 @@
return boost::move(object ^= operand);
}
-#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
+#endif //BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Element Iteration <IntervalSet|IntervalMap>
Modified: trunk/boost/icl/impl_config.hpp
==============================================================================
--- trunk/boost/icl/impl_config.hpp (original)
+++ trunk/boost/icl/impl_config.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -9,6 +9,8 @@
#ifndef BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225
#define BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225
+#include <boost/icl/detail/boost_config.hpp>
+
/*-----------------------------------------------------------------------------+
| You can choose an implementation for the basic set and map classes. |
| Select at most ONE of the following defines to change the default |
@@ -39,6 +41,19 @@
# define ICL_IMPL_SPACE std
#endif
+/*-----------------------------------------------------------------------------+
+| MEMO 2012-12-30: Due to problems with new c++11 compilers and their |
+| implementation of rvalue references, ICL's move implementation will be |
+| disabled for some new compilers for version 1.53. |
++-----------------------------------------------------------------------------*/
+#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
+# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
+#elif defined(__clang__)
+# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
+#elif (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))
+# define BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
+#endif
+
#include <boost/move/move.hpp>
#endif // BOOST_ICL_IMPL_CONFIG_HPP_JOFA_091225
Modified: trunk/boost/icl/interval_base_map.hpp
==============================================================================
--- trunk/boost/icl/interval_base_map.hpp (original)
+++ trunk/boost/icl/interval_base_map.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -222,7 +222,7 @@
return *this;
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -244,7 +244,7 @@
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
/** swap the content of containers */
void swap(interval_base_map& object) { _map.swap(object._map); }
Modified: trunk/boost/icl/interval_base_set.hpp
==============================================================================
--- trunk/boost/icl/interval_base_set.hpp (original)
+++ trunk/boost/icl/interval_base_set.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -175,7 +175,7 @@
return *this;
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -195,7 +195,7 @@
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
/** swap the content of containers */
void swap(interval_base_set& operand) { _set.swap(operand._set); }
Modified: trunk/boost/icl/interval_map.hpp
==============================================================================
--- trunk/boost/icl/interval_map.hpp (original)
+++ trunk/boost/icl/interval_map.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -86,7 +86,7 @@
Traits,Compare,Combine,Section,Interval,Alloc>& src)
{ this->assign(src); }
- explicit interval_map(domain_mapping_type& base_pair): base_type()
+ explicit interval_map(const domain_mapping_type& base_pair): base_type()
{ this->add(base_pair); }
explicit interval_map(const value_type& value_pair): base_type()
@@ -120,7 +120,7 @@
prior_ = this->add(prior_, *it_);
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -138,7 +138,7 @@
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
private:
// Private functions that shall be accessible by the baseclass:
Modified: trunk/boost/icl/interval_set.hpp
==============================================================================
--- trunk/boost/icl/interval_set.hpp (original)
+++ trunk/boost/icl/interval_set.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -144,7 +144,7 @@
prior_ = this->add(prior_, *it_);
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -161,7 +161,7 @@
return *this;
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
private:
// Private functions that shall be accessible by the baseclass:
Modified: trunk/boost/icl/map.hpp
==============================================================================
--- trunk/boost/icl/map.hpp (original)
+++ trunk/boost/icl/map.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -198,7 +198,7 @@
return *this;
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -218,7 +218,7 @@
return *this;
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
void swap(map& src) { base_type::swap(src); }
Modified: trunk/boost/icl/separate_interval_set.hpp
==============================================================================
--- trunk/boost/icl/separate_interval_set.hpp (original)
+++ trunk/boost/icl/separate_interval_set.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -130,7 +130,7 @@
this->_set.insert(src.begin(), src.end());
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -147,7 +147,7 @@
return *this;
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
private:
// Private functions that shall be accessible by the baseclass:
Modified: trunk/boost/icl/split_interval_map.hpp
==============================================================================
--- trunk/boost/icl/split_interval_map.hpp (original)
+++ trunk/boost/icl/split_interval_map.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -72,7 +72,7 @@
/// Copy constructor
split_interval_map(const split_interval_map& src): base_type(src) {}
- explicit split_interval_map(domain_mapping_type& base_pair): base_type()
+ explicit split_interval_map(const domain_mapping_type& base_pair): base_type()
{ this->add(base_pair); }
explicit split_interval_map(const value_type& value_pair): base_type()
@@ -101,7 +101,7 @@
this->_map.insert(src.begin(), src.end());
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -119,7 +119,7 @@
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
private:
// Private functions that shall be accessible by the baseclass:
Modified: trunk/boost/icl/split_interval_set.hpp
==============================================================================
--- trunk/boost/icl/split_interval_set.hpp (original)
+++ trunk/boost/icl/split_interval_set.hpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -125,7 +125,7 @@
this->_set.insert(src.begin(), src.end());
}
-# ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+# ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
//==========================================================================
//= Move semantics
//==========================================================================
@@ -142,7 +142,7 @@
return *this;
}
//==========================================================================
-# endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+# endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES
private:
Modified: trunk/libs/icl/test/ex_boost_party_/ex_boost_party.cpp
==============================================================================
--- trunk/libs/icl/test/ex_boost_party_/ex_boost_party.cpp (original)
+++ trunk/libs/icl/test/ex_boost_party_/ex_boost_party.cpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -9,6 +9,8 @@
#include <libs/icl/test/disable_test_warnings.hpp>
#include "../unit_test_unwarned.hpp"
+#include <boost/icl/set.hpp> // Needed for implicit calls of operator << on
+ // GuestSets via test macros.
//------------------------------------------------------------------------------
// begin example code. return value added to function boost_party
@@ -122,7 +124,11 @@
BOOST_AUTO_TEST_CASE(icl_example_boost_party)
{
- BOOST_CHECK_EQUAL(boost_party(), check_party());
+ PartyHistory party1 = boost_party();
+ PartyHistory party2 = check_party();
+ bool party_equality = (party1==party2);
+ BOOST_CHECK(party_equality);
+ //BOOST_CHECK_EQUAL(boost_party(), check_party());
}
Modified: trunk/libs/icl/test/ex_boost_party_/vc10_ex_boost_party.vcxproj
==============================================================================
--- trunk/libs/icl/test/ex_boost_party_/vc10_ex_boost_party.vcxproj (original)
+++ trunk/libs/icl/test/ex_boost_party_/vc10_ex_boost_party.vcxproj 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -94,10 +94,6 @@
<ItemGroup>
<ClCompile Include="ex_boost_party.cpp" />
</ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\test_interval_map_shared.hpp" />
- <ClInclude Include="..\test_type_lists.hpp" />
- </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Modified: trunk/libs/icl/test/test_casual_/test_casual.cpp
==============================================================================
--- trunk/libs/icl/test/test_casual_/test_casual.cpp (original)
+++ trunk/libs/icl/test/test_casual_/test_casual.cpp 2012-12-30 16:11:45 EST (Sun, 30 Dec 2012)
@@ -32,7 +32,44 @@
#include <boost/icl/interval_set.hpp>
#include <boost/icl/interval.hpp>
-#include <boost/scoped_ptr.hpp>
+
+namespace my
+{
+
+class Tag
+{
+public:
+ Tag():_val(0){}
+ Tag(int val):_val(val){}
+ int val()const { return _val; }
+
+ Tag& operator += (const Tag& rhs){ return *this; }
+ Tag& operator -= (const Tag& rhs){ if(_val == rhs.val()) _val=0; return *this; }
+ Tag& operator &= (const Tag& rhs){ if(_val != rhs.val()) _val=0; return *this; }
+
+private:
+ int _val;
+};
+
+bool operator == (const Tag& lhs, const Tag& rhs){ return lhs.val() == rhs.val(); }
+bool operator < (const Tag& lhs, const Tag& rhs){ return lhs.val() < rhs.val(); }
+
+template<class CharType, class CharTraits>
+std::basic_ostream<CharType, CharTraits> &operator<<
+ (std::basic_ostream<CharType, CharTraits> &stream, Tag const& value)
+{
+ return stream << value.val();
+}
+
+} // namespace my
+
+namespace boost{ namespace icl{
+ template<> struct is_set<my::Tag>
+ {
+ typedef is_set type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+}} // namespace icl boost
using namespace std;
using namespace boost;
@@ -40,18 +77,152 @@
using namespace boost::icl;
-BOOST_AUTO_TEST_CASE(casual)
+BOOST_AUTO_TEST_CASE(CacheSegments)
{
+ using namespace my;
+
typedef int T;
typedef int U;
typedef interval_map<T,U, partial_absorber> IntervalMapT;
typedef interval_set<T> IntervalSetT;
typedef IntervalMapT::interval_type IntervalT;
- IntervalSetT is = IntervalSetT(I_I(1,1)) + IntervalSetT(I_I(3,3));
+ typedef interval_map<int, Tag> InsMapT;
+ InsMapT imap;
- cout << is << endl;
+ imap += make_pair(interval<int>::right_open( 0, 8), Tag(1));
+ imap += make_pair(interval<int>::right_open( 8,16), Tag(2));
+ imap += make_pair(interval<int>::right_open(16,18), Tag(1));
+ imap += make_pair(interval<int>::right_open(17,20), Tag(2));
+ cout << imap << endl;
+
+ //imap -= make_pair(interval<int>::right_open( 4,20), Tag(1)); //drop_if(1)
+ imap &= make_pair(interval<int>::right_open( 4,20), Tag(1)); //keep_if(1)
+ cout << imap << endl;
BOOST_CHECK_EQUAL(true, true);
}
+BOOST_AUTO_TEST_CASE(casual)
+{
+ typedef int T;
+ typedef int U;
+ typedef interval_map<T,U, partial_absorber> IntervalMapT;
+ typedef interval_set<T> IntervalSetT;
+ typedef IntervalMapT::interval_type IntervalT;
+
+
+ BOOST_CHECK_EQUAL(true, true);
+}
+
+
+#include <boost/chrono.hpp>
+
+typedef chrono::time_point<chrono::system_clock> time_point;
+typedef icl::interval_map<time_point, int> IntervalMap;
+typedef IntervalMap::interval_type Interval;
+
+template<class D, class C>
+void add_closed(icl::interval_map<D,std::set<C>>& im, D low, D up, C data)
+{
+ typedef typename icl::interval_map<D,std::set<C>> IntervalMap;
+ typedef typename IntervalMap::interval_type Interval;
+ std::set<C> single;
+ single.insert(std::move(data));
+ im += make_pair(Interval::closed(low, up), single);
+}
+
+void icl_and_chrono()
+{
+ typedef chrono::time_point<chrono::system_clock> time_point;
+ typedef icl::interval_map<time_point, std::set<int> > IntervalMap;
+
+ IntervalMap im;
+ auto now = chrono::system_clock::now();
+
+ add_closed(im, now, now + chrono::seconds(10), 42);
+ add_closed(im, now + chrono::seconds(5), now + chrono::seconds(15), 24);
+ cout << im << endl;
+}
+
+void icl_chrono_101()
+{
+ typedef chrono::time_point<chrono::system_clock> time_point;
+ typedef icl::interval_map<time_point, int> IntervalMap;
+ typedef IntervalMap::interval_type Interval;
+
+ IntervalMap im;
+ auto now = chrono::system_clock::now();
+ im += make_pair(Interval::closed(now, now + chrono::seconds(10)), 42);
+ icl::discrete_interval<time_point> itv2
+ = Interval::closed(now + chrono::seconds(5), now + chrono::seconds(15));
+ im += make_pair(itv2, 24);
+
+ cout << im << endl;
+}
+
+BOOST_AUTO_TEST_CASE(chrono_101)
+{
+ icl_and_chrono();
+}
+
+
+template <typename Domain, typename Codomain>
+class interval_map2
+{
+public:
+ void add_closed(Domain lower, Domain upper, Codomain data)
+ {
+ set_type set;
+ set.insert(std::move(data));
+ map_ += std::make_pair(interval_type::closed(lower, upper), set);
+ }
+
+private:
+ typedef std::set<Codomain> set_type;
+ typedef boost::icl::discrete_interval<Domain> interval_type;
+ typedef boost::icl::interval_map<Domain, set_type> map_type;
+
+ map_type map_;
+};
+
+BOOST_AUTO_TEST_CASE(chrono_102)
+{
+ typedef chrono::time_point<chrono::system_clock> time_point;
+ interval_map2<time_point, int> im;
+ auto now = chrono::system_clock::now();
+ im.add_closed(now, now + chrono::seconds(10), 42);
+
+}
+
+//--------------------------------------
+BOOST_AUTO_TEST_CASE(hudel)
+{
+ typedef int Time;
+ icl::interval_set<Time> _badMonths;
+ std::vector<int> badMonths;
+ badMonths.push_back(2);
+ badMonths.push_back(6);
+ badMonths.push_back(9);
+
+ for(int m : badMonths)
+ {
+ icl::interval<Time>::type month(m, m+2);
+ _badMonths.insert(month);
+ }
+
+ Time timepoint = 7;
+ if ( icl::contains(_badMonths, timepoint) )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+ if ( icl::within(timepoint, _badMonths) )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+ if ( icl::intersects(_badMonths, timepoint) )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+ if ( _badMonths.find(timepoint) != _badMonths.end() )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+ if ( !icl::is_empty(_badMonths & timepoint) )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+ if ( !(_badMonths &= timepoint).empty() )
+ std::cout << timepoint << " intersects bad months" << std::endl;
+}
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk