Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2008-07-05 08:33:51


Author: asutton
Date: 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
New Revision: 47107
URL: http://svn.boost.org/trac/boost/changeset/47107

Log:
Shuffling some code around for a big rewrite of the graph library.

Added:
   sandbox/SOC/2008/graphs/trunk/boost/none.hpp
      - copied unchanged from r46767, /sandbox/SOC/2008/graphs/trunk/boost/graphs/none.hpp
   sandbox/SOC/2008/graphs/trunk/boost/triple.hpp
      - copied, changed from r46767, /sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp
Removed:
   sandbox/SOC/2008/graphs/trunk/boost/graphs/none.hpp
   sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp
Text files modified:
   sandbox/SOC/2008/graphs/trunk/boost/containers.hpp | 123 +--------------------------------------
   sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp | 2
   sandbox/SOC/2008/graphs/trunk/boost/triple.hpp | 13 ++++
   3 files changed, 17 insertions(+), 121 deletions(-)

Modified: sandbox/SOC/2008/graphs/trunk/boost/containers.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/containers.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/containers.hpp 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
@@ -1,8 +1,8 @@
 // (C) Copyright 2004 Jeremy Siek
-// (C) Copyright 2008 Andrew Sutton
-// 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)
+// (C) Copyright 2008 Andrew Sutton
+//
+// 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 CONTAINERS_HPP
 #define CONTAINERS_HPP
@@ -253,119 +253,4 @@
 erase(Container& c, typename Container::iterator i)
 { return dispatch::erase(c, i, container_category(c)); }
 
-#if 0
-
- //===========================================================================
- // Generalized Container Functions
-
-
- // Erase
- template <class Sequence, class T>
- void erase_dispatch(Sequence& c, const T& x,
- sequence_tag)
- {
- c.erase(std::remove(c.begin(), c.end(), x), c.end());
- }
-
- template <class AssociativeContainer, class T>
- void erase_dispatch(AssociativeContainer& c, const T& x,
- associative_container_tag)
- {
- c.erase(x);
- }
- template <class Container, class T>
- void erase(Container& c, const T& x)
- {
- erase_dispatch(c, x, container_category(c));
- }
-
- // Erase If
- template <class Sequence, class Predicate, class IteratorStability>
- void erase_if_dispatch(Sequence& c, Predicate p,
- sequence_tag, IteratorStability)
- {
-#if 0
- c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
-#else
- if (! c.empty())
- c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
-#endif
- }
- template <class AssociativeContainer, class Predicate>
- void erase_if_dispatch(AssociativeContainer& c, Predicate p,
- associative_container_tag, stable_tag)
- {
- typename AssociativeContainer::iterator i, next;
- for (i = next = c.begin(); next != c.end(); i = next) {
- ++next;
- if (p(*i))
- c.erase(i);
- }
- }
- template <class AssociativeContainer, class Predicate>
- void erase_if_dispatch(AssociativeContainer& c, Predicate p,
- associative_container_tag, unstable_tag)
- {
- // This method is really slow, so hopefully we won't have any
- // associative containers with unstable iterators!
- // Is there a better way to do this?
- typename AssociativeContainer::iterator i;
- typename AssociativeContainer::size_type n = c.size();
- while (n--)
- for (i = c.begin(); i != c.end(); ++i)
- if (p(*i)) {
- c.erase(i);
- break;
- }
- }
- template <class Container, class Predicate>
- void erase_if(Container& c, Predicate p)
- {
- erase_if_dispatch(c, p, container_category(c), iterator_stability(c));
- }
-
- // Push
- template <class Container, class T>
- std::pair<typename Container::iterator, bool>
- push_dispatch(Container& c, const T& v, back_insertion_sequence_tag)
- {
- c.push_back(v);
- return std::make_pair(boost::prior(c.end()), true);
- }
-
- template <class Container, class T>
- std::pair<typename Container::iterator, bool>
- push_dispatch(Container& c, const T& v, front_insertion_sequence_tag)
- {
- c.push_front(v);
- return std::make_pair(c.begin(), true);
- }
-
- template <class AssociativeContainer, class T>
- std::pair<typename AssociativeContainer::iterator, bool>
- push_dispatch(AssociativeContainer& c, const T& v,
- unique_associative_container_tag)
- {
- return c.insert(v);
- }
-
- template <class AssociativeContainer, class T>
- std::pair<typename AssociativeContainer::iterator, bool>
- push_dispatch(AssociativeContainer& c, const T& v,
- multiple_associative_container_tag)
- {
- return std::make_pair(c.insert(v), true);
- }
-
- template <class Container, class T>
- std::pair<typename Container::iterator,bool>
- push(Container& c, const T& v)
- {
- return push_dispatch(c, v, container_category(c));
- }
-
-}} // namespace boost::graph_detail
-
-#endif
-
 #endif

Deleted: sandbox/SOC/2008/graphs/trunk/boost/graphs/none.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/none.hpp 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
+++ (empty file)
@@ -1,27 +0,0 @@
-
-#ifndef NONE_HPP
-#define NONE_HPP
-
-#include <boost/utility.hpp>
-
-/** The canonical none type. */
-struct none { };
-
-/** Like none, but not. */
-struct unused { };
-
-// Traits for the none type
-template <typename T>
-struct is_none { BOOST_STATIC_CONSTANT(bool, value = false); };
-
-template <>
-struct is_none<none> { BOOST_STATIC_CONSTANT(bool, value = true); };
-
-template <typename T>
-struct is_not_none { BOOST_STATIC_CONSTANT(bool, value = !is_none<T>::value); };
-
-template <>
-struct is_not_none<none> { BOOST_STATIC_CONSTANT(bool, value = !is_none<none>::value); };
-
-#endif
-

Deleted: sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
+++ (empty file)
@@ -1,79 +0,0 @@
-
-#ifndef TRIPLE_HPP
-#define TRIPLE_HPP
-
-/**
- * Like a pair, but with three elements. This gets around having to use the
- * Boost.Tuple library and generating exceedingly long type names in compiler
- * errors.
- */
-template <typename First, typename Second, typename Third>
-struct triple
-{
- typedef First first_type;
- typedef Second second_type;
- typedef Third third_type;
-
- triple()
- : first(), second(), third()
- { }
-
- triple(first_type const& f, second_type const& s, third_type const& t)
- : first(f), second(s), third(t)
- { }
-
- first_type first;
- second_type second;
- third_type third;
-};
-
-template <typename F, typename S, typename T>
-inline bool
-operator==(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{ return (a.first == b.first) && (a.second == b.second) && (a.third == b.third); }
-
-template <typename F, typename S, typename T>
-inline bool
-operator!=(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{ return !(a == b); }
-
-template <typename F, typename S, typename T>
-inline bool
-operator<(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{
- // TODO There is definitely a prettier way to write this, but I'm too lazy
- // to figure it out right now.
- if(a.first == b.first) {
- if(a.second == b.second) {
- return a.third < b.third;
- }
- else {
- return a.second < b.second;
- }
- }
- else {
- return a.first < b.first;
- }
-}
-
-template <typename F, typename S, typename T>
-inline bool
-operator>(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{ return b < a; }
-
-template <typename F, typename S, typename T>
-inline bool
-operator<=(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{ return !(b < a); }
-
-template <typename F, typename S, typename T>
-inline bool
-operator>=(triple<F,S,T> const& a, triple<F,S,T> const& b)
-{ return !(a < b); }
-
-template <typename F, typename S, typename T>
-inline triple<F,S,T>
-make_triple(F const& f, S const& s, T const& t)
-{ return triple<F,S,T>(f, s, t); }
-
-#endif

Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/undirected_graph.hpp 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
@@ -3,8 +3,6 @@
 #define UNDIRECTED_GRAPH_HPP
 
 #include "none.hpp"
-#include "descriptor.hpp"
-#include "placeholder.hpp"
 
 #include "undirected_vertex.hpp"
 #include "vertex_vector.hpp"

Copied: sandbox/SOC/2008/graphs/trunk/boost/triple.hpp (from r46767, /sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/trunk/boost/graphs/triple.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/triple.hpp 2008-07-05 08:33:50 EDT (Sat, 05 Jul 2008)
@@ -22,6 +22,19 @@
         : first(f), second(s), third(t)
     { }
 
+ template <typename T, typename U, typename V>
+ triple(triple<T, U, V> const& x)
+ : first(x.first), second(x.second), third(x.third)
+ { }
+
+ void swap(triple& x)
+ {
+ using std::swap;
+ swap(first, x.first);
+ swap(second, x.second);
+ swap(third, x.third);
+ }
+
     first_type first;
     second_type second;
     third_type third;


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