Added boost header
This commit is contained in:
88
test/external/boost/pending/detail/disjoint_sets.hpp
vendored
Normal file
88
test/external/boost/pending/detail/disjoint_sets.hpp
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// (C) Copyright Jeremy Siek 2004
|
||||
// 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_DETAIL_DISJOINT_SETS_HPP
|
||||
#define BOOST_DETAIL_DISJOINT_SETS_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class ParentPA, class Vertex>
|
||||
Vertex
|
||||
find_representative_with_path_halving(ParentPA p, Vertex v)
|
||||
{
|
||||
Vertex parent = get(p, v);
|
||||
Vertex grandparent = get(p, parent);
|
||||
while (parent != grandparent) {
|
||||
put(p, v, grandparent);
|
||||
v = grandparent;
|
||||
parent = get(p, v);
|
||||
grandparent = get(p, parent);
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
template <class ParentPA, class Vertex>
|
||||
Vertex
|
||||
find_representative_with_full_compression(ParentPA parent, Vertex v)
|
||||
{
|
||||
Vertex old = v;
|
||||
Vertex ancestor = get(parent, v);
|
||||
while (ancestor != v) {
|
||||
v = ancestor;
|
||||
ancestor = get(parent, v);
|
||||
}
|
||||
v = get(parent, old);
|
||||
while (ancestor != v) {
|
||||
put(parent, old, ancestor);
|
||||
old = v;
|
||||
v = get(parent, old);
|
||||
}
|
||||
return ancestor;
|
||||
}
|
||||
|
||||
/* the postcondition of link sets is:
|
||||
component_representative(i) == component_representative(j)
|
||||
*/
|
||||
template <class ParentPA, class RankPA, class Vertex,
|
||||
class ComponentRepresentative>
|
||||
inline void
|
||||
link_sets(ParentPA p, RankPA rank, Vertex i, Vertex j,
|
||||
ComponentRepresentative comp_rep)
|
||||
{
|
||||
i = comp_rep(p, i);
|
||||
j = comp_rep(p, j);
|
||||
if (i == j) return;
|
||||
if (get(rank, i) > get(rank, j))
|
||||
put(p, j, i);
|
||||
else {
|
||||
put(p, i, j);
|
||||
if (get(rank, i) == get(rank, j))
|
||||
put(rank, j, get(rank, j) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// normalize components has the following postcondidition:
|
||||
// i >= p[i]
|
||||
// that is, the representative is the node with the smallest index in its class
|
||||
// as its precondition it it assumes that the node container is compressed
|
||||
|
||||
template <class ParentPA, class Vertex>
|
||||
inline void
|
||||
normalize_node(ParentPA p, Vertex i)
|
||||
{
|
||||
if (i > get(p,i) || get(p, get(p,i)) != get(p,i))
|
||||
put(p,i, get(p, get(p,i)));
|
||||
else {
|
||||
put(p, get(p,i), i);
|
||||
put(p, i, i);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_DISJOINT_SETS_HPP
|
||||
74
test/external/boost/pending/detail/int_iterator.hpp
vendored
Normal file
74
test/external/boost/pending/detail/int_iterator.hpp
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// (C) Copyright Jeremy Siek 1999.
|
||||
// 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_INT_ITERATOR_H
|
||||
#define BOOST_INT_ITERATOR_H
|
||||
|
||||
#include <boost/iterator.hpp>
|
||||
#if !defined BOOST_MSVC
|
||||
#include <boost/operators.hpp>
|
||||
#endif
|
||||
#include <iostream>
|
||||
//using namespace std;
|
||||
|
||||
#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
namespace boost {
|
||||
#endif
|
||||
|
||||
// this should use random_access_iterator_helper but I've had
|
||||
// VC++ portablility problems with that. -JGS
|
||||
template <class IntT>
|
||||
class int_iterator
|
||||
{
|
||||
typedef int_iterator self;
|
||||
public:
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef IntT value_type;
|
||||
typedef IntT& reference;
|
||||
typedef IntT* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
inline int_iterator() : _i(0) { }
|
||||
inline int_iterator(IntT i) : _i(i) { }
|
||||
inline int_iterator(const self& x) : _i(x._i) { }
|
||||
inline self& operator=(const self& x) { _i = x._i; return *this; }
|
||||
inline IntT operator*() { return _i; }
|
||||
inline IntT operator[](IntT n) { return _i + n; }
|
||||
inline self& operator++() { ++_i; return *this; }
|
||||
inline self operator++(int) { self t = *this; ++_i; return t; }
|
||||
inline self& operator+=(IntT n) { _i += n; return *this; }
|
||||
inline self operator+(IntT n) { self t = *this; t += n; return t; }
|
||||
inline self& operator--() { --_i; return *this; }
|
||||
inline self operator--(int) { self t = *this; --_i; return t; }
|
||||
inline self& operator-=(IntT n) { _i -= n; return *this; }
|
||||
inline IntT operator-(const self& x) const { return _i - x._i; }
|
||||
inline bool operator==(const self& x) const { return _i == x._i; }
|
||||
// vc++ had a problem finding != in random_access_iterator_helper
|
||||
// need to look into this... for now implementing everything here -JGS
|
||||
inline bool operator!=(const self& x) const { return _i != x._i; }
|
||||
inline bool operator<(const self& x) const { return _i < x._i; }
|
||||
inline bool operator<=(const self& x) const { return _i <= x._i; }
|
||||
inline bool operator>(const self& x) const { return _i > x._i; }
|
||||
inline bool operator>=(const self& x) const { return _i >= x._i; }
|
||||
protected:
|
||||
IntT _i;
|
||||
};
|
||||
|
||||
template <class IntT>
|
||||
inline int_iterator<IntT>
|
||||
operator+(IntT n, int_iterator<IntT> t) { t += n; return t; }
|
||||
|
||||
#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
namespace boost {
|
||||
using ::int_iterator;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* BOOST_INT_ITERATOR_H */
|
||||
160
test/external/boost/pending/detail/property.hpp
vendored
Normal file
160
test/external/boost/pending/detail/property.hpp
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
// (C) Copyright Jeremy Siek 2004
|
||||
// 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_DETAIL_PROPERTY_HPP
|
||||
#define BOOST_DETAIL_PROPERTY_HPP
|
||||
|
||||
#include <utility> // for std::pair
|
||||
#include <boost/type_traits/same_traits.hpp> // for is_same
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class PropertyTag1, class PropertyTag2>
|
||||
struct same_property {
|
||||
enum { value = is_same<PropertyTag1,PropertyTag2>::value };
|
||||
};
|
||||
|
||||
struct error_property_not_found { };
|
||||
|
||||
template <int TagMatched>
|
||||
struct property_value_dispatch {
|
||||
template <class PropertyTag, class T, class Tag>
|
||||
inline static T& get_value(PropertyTag& p, T*, Tag) {
|
||||
return p.m_value;
|
||||
}
|
||||
template <class PropertyTag, class T, class Tag>
|
||||
inline static const T& const_get_value(const PropertyTag& p, T*, Tag) {
|
||||
return p.m_value;
|
||||
}
|
||||
};
|
||||
|
||||
template <class PropertyList>
|
||||
struct property_value_end {
|
||||
template <class T> struct result { typedef T type; };
|
||||
|
||||
template <class T, class Tag>
|
||||
inline static T& get_value(PropertyList& p, T* t, Tag tag) {
|
||||
typedef typename PropertyList::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = same_property<Next_tag,Tag>::value };
|
||||
return property_value_dispatch<match>
|
||||
::get_value(static_cast<Next&>(p), t, tag);
|
||||
}
|
||||
template <class T, class Tag>
|
||||
inline static const T& const_get_value(const PropertyList& p, T* t, Tag tag) {
|
||||
typedef typename PropertyList::next_type Next;
|
||||
typedef typename Next::tag_type Next_tag;
|
||||
enum { match = same_property<Next_tag,Tag>::value };
|
||||
return property_value_dispatch<match>
|
||||
::const_get_value(static_cast<const Next&>(p), t, tag);
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct property_value_end<no_property> {
|
||||
template <class T> struct result {
|
||||
typedef detail::error_property_not_found type;
|
||||
};
|
||||
|
||||
// Stop the recursion and return error
|
||||
template <class T, class Tag>
|
||||
inline static detail::error_property_not_found&
|
||||
get_value(no_property&, T*, Tag) {
|
||||
static error_property_not_found s_prop_not_found;
|
||||
return s_prop_not_found;
|
||||
}
|
||||
template <class T, class Tag>
|
||||
inline static const detail::error_property_not_found&
|
||||
const_get_value(const no_property&, T*, Tag) {
|
||||
static error_property_not_found s_prop_not_found;
|
||||
return s_prop_not_found;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct property_value_dispatch<0> {
|
||||
template <class PropertyList, class T, class Tag>
|
||||
inline static typename property_value_end<PropertyList>::template result<T>::type&
|
||||
get_value(PropertyList& p, T* t, Tag tag) {
|
||||
return property_value_end<PropertyList>::get_value(p, t, tag);
|
||||
}
|
||||
template <class PropertyList, class T, class Tag>
|
||||
inline static const typename property_value_end<PropertyList>::template result<T>::type&
|
||||
const_get_value(const PropertyList& p, T* t, Tag tag) {
|
||||
return property_value_end<PropertyList>::const_get_value(p, t, tag);
|
||||
}
|
||||
};
|
||||
|
||||
template <class PropertyList>
|
||||
struct build_property_tag_value_alist
|
||||
{
|
||||
typedef typename PropertyList::next_type NextProperty;
|
||||
typedef typename PropertyList::value_type Value;
|
||||
typedef typename PropertyList::tag_type Tag;
|
||||
typedef typename build_property_tag_value_alist<NextProperty>::type Next;
|
||||
typedef std::pair< std::pair<Tag,Value>, Next> type;
|
||||
};
|
||||
template <>
|
||||
struct build_property_tag_value_alist<no_property>
|
||||
{
|
||||
typedef no_property type;
|
||||
};
|
||||
|
||||
#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class TagValueAList, class Tag>
|
||||
struct extract_value {
|
||||
typedef error_property_not_found type;
|
||||
};
|
||||
template <class Value, class Tag1, class Tag2, class Rest>
|
||||
struct extract_value< std::pair<std::pair<Tag1,Value>,Rest>, Tag2> {
|
||||
typedef typename extract_value<Rest,Tag2>::type type;
|
||||
};
|
||||
template <class Value, class Tag, class Rest>
|
||||
struct extract_value< std::pair<std::pair<Tag,Value>,Rest>, Tag> {
|
||||
typedef Value type;
|
||||
};
|
||||
#else
|
||||
// VC++ workaround:
|
||||
// The main idea here is to replace partial specialization with
|
||||
// nested template member classes. Of course there is the
|
||||
// further complication that the outer class of the nested
|
||||
// template class cannot itself be a template class.
|
||||
// Hence the need for the ev_selector. -JGS
|
||||
|
||||
struct recursive_extract;
|
||||
struct end_extract;
|
||||
|
||||
template <class TagValueAList>
|
||||
struct ev_selector { typedef recursive_extract type; };
|
||||
template <>
|
||||
struct ev_selector<no_property> { typedef end_extract type; };
|
||||
|
||||
struct recursive_extract {
|
||||
template <class TagValueAList, class Tag1>
|
||||
struct bind_ {
|
||||
typedef typename TagValueAList::first_type AListFirst;
|
||||
typedef typename AListFirst::first_type Tag2;
|
||||
typedef typename AListFirst::second_type Value;
|
||||
enum { match = same_property<Tag1,Tag2>::value };
|
||||
typedef typename TagValueAList::second_type Next;
|
||||
typedef typename ev_selector<Next>::type Extractor;
|
||||
typedef typename boost::ct_if< match, Value,
|
||||
typename Extractor::template bind_<Next,Tag1>::type
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
struct end_extract {
|
||||
template <class AList, class Tag1>
|
||||
struct bind_ {
|
||||
typedef error_property_not_found type;
|
||||
};
|
||||
};
|
||||
#endif //!defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_PROPERTY_HPP
|
||||
Reference in New Issue
Block a user