# HG changeset patch # User deba # Date 1141219168 0 # Node ID 2115143eceeaa678090b4bb7315697825d9fc3c2 # Parent 6e1b62d42d94b1a689d9742800a1605aab0225ff utility, invalid and traits moved to bits diff -r 6e1b62d42d94 -r 2115143eceea lemon/Makefile.am --- a/lemon/Makefile.am Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/Makefile.am Wed Mar 01 13:19:28 2006 +0000 @@ -45,7 +45,6 @@ graph_utils.h \ graph_to_eps.h \ hypercube_graph.h \ - invalid.h \ iterable_maps.h \ johnson.h \ kruskal.h \ @@ -74,12 +73,10 @@ sub_graph.h \ time_measure.h \ topology.h \ - traits.h \ ugraph_adaptor.h \ unionfind.h \ xy.h \ concept_check.h \ - utility.h \ lemon_reader.h \ lemon_writer.h \ graph_reader.h \ @@ -94,8 +91,11 @@ bits/graph_extender.h \ bits/graph_adaptor_extender.h \ bits/edge_set_extender.h \ + bits/invalid.h \ bits/item_reader.h \ bits/item_writer.h \ + bits/traits.h \ + bits/utility.h \ concept/bpugraph.h \ concept/graph.h \ concept/graph_component.h \ diff -r 6e1b62d42d94 -r 2115143eceea lemon/base.cc --- a/lemon/base.cc Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/base.cc Wed Mar 01 13:19:28 2006 +0000 @@ -20,7 +20,7 @@ ///\brief Some basic non inline function and static global data. #include -#include +#include namespace lemon { float Tolerance::def_epsilon = 1e-4; diff -r 6e1b62d42d94 -r 2115143eceea lemon/bellman_ford.h --- a/lemon/bellman_ford.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bellman_ford.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,7 +25,7 @@ /// #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/bfs.h --- a/lemon/bfs.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bfs.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bits/graph_extender.h Wed Mar 01 13:19:28 2006 +0000 @@ -19,7 +19,7 @@ #ifndef LEMON_GRAPH_EXTENDER_H #define LEMON_GRAPH_EXTENDER_H -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/invalid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/bits/invalid.h Wed Mar 01 13:19:28 2006 +0000 @@ -0,0 +1,54 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_BITS_INVALID_H +#define LEMON_BITS_INVALID_H + +///\file +///\brief Definition of INVALID. + +namespace lemon { + + /// Dummy type to make it easier to make invalid iterators. + + /// See \ref INVALID, how to use it. + + struct Invalid { + public: + bool operator==(Invalid) { return true; } + bool operator!=(Invalid) { return false; } + bool operator< (Invalid) { return false; } + }; + + /// Invalid iterators. + + /// \ref Invalid is a global type that converts to each iterator + /// in such a way that the value of the target iterator will be invalid. + + //const Invalid &INVALID = *(Invalid *)0; + +#ifdef LEMON_ONLY_TEMPLATES + const Invalid INVALID = Invalid(); +#else + extern const Invalid INVALID; +#endif + +} //namespace lemon + +#endif + diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/map_extender.h --- a/lemon/bits/map_extender.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bits/map_extender.h Wed Mar 01 13:19:28 2006 +0000 @@ -21,7 +21,7 @@ #include -#include +#include ///\file ///\brief Extenders for iterable maps. diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/static_map.h --- a/lemon/bits/static_map.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bits/static_map.h Wed Mar 01 13:19:28 2006 +0000 @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/traits.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/bits/traits.h Wed Mar 01 13:19:28 2006 +0000 @@ -0,0 +1,300 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +#ifndef LEMON_BITS_TRAITS_H +#define LEMON_BITS_TRAITS_H + +#include + +///\file +///\brief Traits for graphs and maps +/// + +namespace lemon { + template + class ItemSetTraits {}; + + + template + struct NodeNotifierIndicator { + typedef InvalidType Type; + }; + template + struct NodeNotifierIndicator< + Graph, + typename enable_if::type + > { + typedef typename Graph::NodeNotifier Type; + }; + + template + class ItemSetTraits<_Graph, typename _Graph::Node> { + public: + + typedef _Graph Graph; + + typedef typename Graph::Node Item; + typedef typename Graph::NodeIt ItemIt; + + typedef typename NodeNotifierIndicator::Type ItemNotifier; + + template + class Map : public Graph::template NodeMap<_Value> { + public: + typedef typename Graph::template NodeMap<_Value> Parent; + typedef typename Parent::Value Value; + + Map(const Graph& _graph) : Parent(_graph) {} + Map(const Graph& _graph, const Value& _value) + : Parent(_graph, _value) {} + + }; + + }; + + template + struct EdgeNotifierIndicator { + typedef InvalidType Type; + }; + template + struct EdgeNotifierIndicator< + Graph, + typename enable_if::type + > { + typedef typename Graph::EdgeNotifier Type; + }; + + template + class ItemSetTraits<_Graph, typename _Graph::Edge> { + public: + + typedef _Graph Graph; + + typedef typename Graph::Edge Item; + typedef typename Graph::EdgeIt ItemIt; + + typedef typename EdgeNotifierIndicator::Type ItemNotifier; + + template + class Map : public Graph::template EdgeMap<_Value> { + public: + typedef typename Graph::template EdgeMap<_Value> Parent; + typedef typename Parent::Value Value; + + Map(const Graph& _graph) : Parent(_graph) {} + Map(const Graph& _graph, const Value& _value) + : Parent(_graph, _value) {} + }; + + }; + + template + struct UEdgeNotifierIndicator { + typedef InvalidType Type; + }; + template + struct UEdgeNotifierIndicator< + Graph, + typename enable_if::type + > { + typedef typename Graph::UEdgeNotifier Type; + }; + + template + class ItemSetTraits<_Graph, typename _Graph::UEdge> { + public: + + typedef _Graph Graph; + + typedef typename Graph::UEdge Item; + typedef typename Graph::UEdgeIt ItemIt; + + typedef typename UEdgeNotifierIndicator::Type ItemNotifier; + + template + class Map : public Graph::template UEdgeMap<_Value> { + public: + typedef typename Graph::template UEdgeMap<_Value> Parent; + typedef typename Parent::Value Value; + + Map(const Graph& _graph) : Parent(_graph) {} + Map(const Graph& _graph, const Value& _value) + : Parent(_graph, _value) {} + }; + + }; + + template + struct ANodeNotifierIndicator { + typedef InvalidType Type; + }; + template + struct ANodeNotifierIndicator< + Graph, + typename enable_if::type + > { + typedef typename Graph::ANodeNotifier Type; + }; + + template + class ItemSetTraits<_Graph, typename _Graph::ANode> { + public: + + typedef _Graph Graph; + + typedef typename Graph::ANode Item; + typedef typename Graph::ANodeIt ItemIt; + + typedef typename ANodeNotifierIndicator::Type ItemNotifier; + + template + class Map : public Graph::template ANodeMap<_Value> { + public: + typedef typename Graph::template ANodeMap<_Value> Parent; + typedef typename Parent::Value Value; + + Map(const Graph& _graph) : Parent(_graph) {} + Map(const Graph& _graph, const Value& _value) + : Parent(_graph, _value) {} + }; + + }; + + template + struct BNodeNotifierIndicator { + typedef InvalidType Type; + }; + template + struct BNodeNotifierIndicator< + Graph, + typename enable_if::type + > { + typedef typename Graph::BNodeNotifier Type; + }; + + template + class ItemSetTraits<_Graph, typename _Graph::BNode> { + public: + + typedef _Graph Graph; + + typedef typename Graph::BNode Item; + typedef typename Graph::BNodeIt ItemIt; + + typedef typename BNodeNotifierIndicator::Type ItemNotifier; + + template + class Map : public Graph::template BNodeMap<_Value> { + public: + typedef typename Graph::template BNodeMap<_Value> Parent; + typedef typename Parent::Value Value; + + Map(const Graph& _graph) : Parent(_graph) {} + Map(const Graph& _graph, const Value& _value) + : Parent(_graph, _value) {} + }; + + }; + + + template + struct MapTraits { + typedef False ReferenceMapTag; + + typedef typename Map::Key Key; + typedef typename Map::Value Value; + + typedef const Value ConstReturnValue; + typedef const Value ReturnValue; + }; + + template + struct MapTraits< + Map, typename enable_if::type > + { + typedef True ReferenceMapTag; + + typedef typename Map::Key Key; + typedef typename Map::Value Value; + + typedef typename Map::ConstReference ConstReturnValue; + typedef typename Map::Reference ReturnValue; + + typedef typename Map::ConstReference ConstReference; + typedef typename Map::Reference Reference; + }; + + // Indicators for the tags + + template + struct NodeNumTagIndicator { + static const bool value = false; + }; + + template + struct NodeNumTagIndicator< + Graph, + typename enable_if::type + > { + static const bool value = true; + }; + + template + struct EdgeNumTagIndicator { + static const bool value = false; + }; + + template + struct EdgeNumTagIndicator< + Graph, + typename enable_if::type + > { + static const bool value = true; + }; + + template + struct FindEdgeTagIndicator { + static const bool value = false; + }; + + template + struct FindEdgeTagIndicator< + Graph, + typename enable_if::type + > { + static const bool value = true; + }; + + template + struct UndirectedTagIndicator { + static const bool value = false; + }; + + template + struct UndirectedTagIndicator< + Graph, + typename enable_if::type + > { + static const bool value = true; + }; + + + +} + +#endif // LEMON_MAPS_H diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/utility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lemon/bits/utility.h Wed Mar 01 13:19:28 2006 +0000 @@ -0,0 +1,137 @@ +/* -*- C++ -*- + * + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * (Egervary Research Group on Combinatorial Optimization, EGRES). + * + * Permission to use, modify and distribute this software is granted + * provided that this copyright notice appears in all copies. For + * precise terms see the accompanying LICENSE file. + * + * This software is provided "AS IS" with no warranty of any kind, + * express or implied, and with no claim as to its suitability for any + * purpose. + * + */ + +// This file contains a modified version of the enable_if library from BOOST. +// See the appropriate copyright notice below. + +// Boost enable_if library + +// Copyright 2003 © The Trustees of Indiana University. + +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) +// Jeremiah Willcock (jewillco at osl.iu.edu) +// Andrew Lumsdaine (lums at osl.iu.edu) + + +#ifndef LEMON_BITS_UTILITY_H +#define LEMON_BITS_UTILITY_H + +///\file +///\brief Miscellaneous basic utilities +/// +///\todo Please rethink the organisation of the basic files like this. +///E.g. this file might be merged with invalid.h. + + +namespace lemon +{ + + /// Basic type for defining "tags". A "YES" condition for \c enable_if. + + /// Basic type for defining "tags". A "YES" condition for \c enable_if. + /// + ///\sa False + /// + /// \todo This should go to a separate "basic_types.h" (or something) + /// file. + struct True { + ///\e + static const bool value = true; + }; + + /// Basic type for defining "tags". A "NO" condition for \c enable_if. + + /// Basic type for defining "tags". A "NO" condition for \c enable_if. + /// + ///\sa True + struct False { + ///\e + static const bool value = false; + }; + + + class InvalidType { + private: + InvalidType(); + }; + + + template + struct Wrap { + const T &value; + Wrap(const T &t) : value(t) {} + }; + + /**************** dummy class to avoid ambiguity ****************/ + + template struct dummy { dummy(int) {} }; + + /**************** enable_if from BOOST ****************/ + + template + struct enable_if_c { + typedef T type; + }; + + template + struct enable_if_c {}; + + template + struct enable_if : public enable_if_c {}; + + template + struct lazy_enable_if_c { + typedef typename T::type type; + }; + + template + struct lazy_enable_if_c {}; + + template + struct lazy_enable_if : public lazy_enable_if_c {}; + + + template + struct disable_if_c { + typedef T type; + }; + + template + struct disable_if_c {}; + + template + struct disable_if : public disable_if_c {}; + + template + struct lazy_disable_if_c { + typedef typename T::type type; + }; + + template + struct lazy_disable_if_c {}; + + template + struct lazy_disable_if : public lazy_disable_if_c {}; + +} // namespace lemon + +#endif diff -r 6e1b62d42d94 -r 2115143eceea lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/bits/vector_map.h Wed Mar 01 13:19:28 2006 +0000 @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/color.h --- a/lemon/color.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/color.h Wed Mar 01 13:19:28 2006 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/bpugraph.h --- a/lemon/concept/bpugraph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/bpugraph.h Wed Mar 01 13:19:28 2006 +0000 @@ -29,7 +29,7 @@ #include #include -#include +#include namespace lemon { namespace concept { diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/graph.h --- a/lemon/concept/graph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/graph.h Wed Mar 01 13:19:28 2006 +0000 @@ -23,8 +23,8 @@ ///\file ///\brief Declaration of Graph. -#include -#include +#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/graph_component.h --- a/lemon/concept/graph_component.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/graph_component.h Wed Mar 01 13:19:28 2006 +0000 @@ -24,7 +24,7 @@ #ifndef LEMON_CONCEPT_GRAPH_COMPONENT_H #define LEMON_CONCEPT_GRAPH_COMPONENT_H -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/heap.h --- a/lemon/concept/heap.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/heap.h Wed Mar 01 13:19:28 2006 +0000 @@ -24,7 +24,7 @@ #ifndef LEMON_CONCEPT_HEAP_H #define LEMON_CONCEPT_HEAP_H -#include +#include namespace lemon { namespace concept { diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/maps.h --- a/lemon/concept/maps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/maps.h Wed Mar 01 13:19:28 2006 +0000 @@ -19,7 +19,7 @@ #ifndef LEMON_CONCEPT_MAPS_H #define LEMON_CONCEPT_MAPS_H -#include +#include #include ///\ingroup concept diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/matrix_maps.h --- a/lemon/concept/matrix_maps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/matrix_maps.h Wed Mar 01 13:19:28 2006 +0000 @@ -19,7 +19,7 @@ #ifndef LEMON_CONCEPT_MATRIX_MAPS_H #define LEMON_CONCEPT_MATRIX_MAPS_H -#include +#include #include ///\ingroup concept diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/path.h --- a/lemon/concept/path.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/path.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,7 +25,7 @@ #ifndef LEMON_CONCEPT_PATH_H #define LEMON_CONCEPT_PATH_H -#include +#include #include namespace lemon { diff -r 6e1b62d42d94 -r 2115143eceea lemon/concept/ugraph.h --- a/lemon/concept/ugraph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/concept/ugraph.h Wed Mar 01 13:19:28 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include namespace lemon { namespace concept { diff -r 6e1b62d42d94 -r 2115143eceea lemon/dag_shortest_path.h --- a/lemon/dag_shortest_path.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/dag_shortest_path.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,7 +25,7 @@ /// #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/dfs.h --- a/lemon/dfs.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/dfs.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/dijkstra.h --- a/lemon/dijkstra.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/dijkstra.h Wed Mar 01 13:19:28 2006 +0000 @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/dimacs.h --- a/lemon/dimacs.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/dimacs.h Wed Mar 01 13:19:28 2006 +0000 @@ -23,7 +23,7 @@ #include #include #include -#include +#include /// \ingroup dimacs_group /// \file diff -r 6e1b62d42d94 -r 2115143eceea lemon/euler.h --- a/lemon/euler.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/euler.h Wed Mar 01 13:19:28 2006 +0000 @@ -16,7 +16,7 @@ * */ -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/floyd_warshall.h --- a/lemon/floyd_warshall.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/floyd_warshall.h Wed Mar 01 13:19:28 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/fredman_tarjan.h --- a/lemon/fredman_tarjan.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/fredman_tarjan.h Wed Mar 01 13:19:28 2006 +0000 @@ -30,10 +30,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/full_graph.h --- a/lemon/full_graph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/full_graph.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,8 +25,8 @@ #include -#include -#include +#include +#include ///\ingroup graphs diff -r 6e1b62d42d94 -r 2115143eceea lemon/graph_adaptor.h --- a/lemon/graph_adaptor.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/graph_adaptor.h Wed Mar 01 13:19:28 2006 +0000 @@ -27,7 +27,7 @@ /// ///\author Marton Makai -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/graph_to_eps.h --- a/lemon/graph_to_eps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/graph_to_eps.h Wed Mar 01 13:19:28 2006 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/graph_utils.h --- a/lemon/graph_utils.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/graph_utils.h Wed Mar 01 13:19:28 2006 +0000 @@ -24,10 +24,10 @@ #include #include -#include -#include +#include +#include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/grid_ugraph.h --- a/lemon/grid_ugraph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/grid_ugraph.h Wed Mar 01 13:19:28 2006 +0000 @@ -20,8 +20,8 @@ #define GRID_UGRAPH_H #include -#include -#include +#include +#include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/hypercube_graph.h --- a/lemon/hypercube_graph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/hypercube_graph.h Wed Mar 01 13:19:28 2006 +0000 @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/invalid.h --- a/lemon/invalid.h Wed Mar 01 12:46:52 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_INVALID_H -#define LEMON_INVALID_H - -///\file -///\brief Definition of INVALID. - -namespace lemon { - - /// Dummy type to make it easier to make invalid iterators. - - /// See \ref INVALID, how to use it. - - struct Invalid { - public: - bool operator==(Invalid) { return true; } - bool operator!=(Invalid) { return false; } - bool operator< (Invalid) { return false; } - }; - - /// Invalid iterators. - - /// \ref Invalid is a global type that converts to each iterator - /// in such a way that the value of the target iterator will be invalid. - - //const Invalid &INVALID = *(Invalid *)0; - -#ifdef LEMON_ONLY_TEMPLATES - const Invalid INVALID = Invalid(); -#else - extern const Invalid INVALID; -#endif - -} //namespace lemon - -#endif - diff -r 6e1b62d42d94 -r 2115143eceea lemon/iterable_maps.h --- a/lemon/iterable_maps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/iterable_maps.h Wed Mar 01 13:19:28 2006 +0000 @@ -16,8 +16,8 @@ * */ -#include -#include +#include +#include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/johnson.h --- a/lemon/johnson.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/johnson.h Wed Mar 01 13:19:28 2006 +0000 @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/kruskal.h --- a/lemon/kruskal.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/kruskal.h Wed Mar 01 13:19:28 2006 +0000 @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include /** @defgroup spantree Minimum Cost Spanning Tree Algorithms diff -r 6e1b62d42d94 -r 2115143eceea lemon/lemon_reader.h --- a/lemon/lemon_reader.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/lemon_reader.h Wed Mar 01 13:19:28 2006 +0000 @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/lemon_writer.h --- a/lemon/lemon_writer.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/lemon_writer.h Wed Mar 01 13:19:28 2006 +0000 @@ -32,10 +32,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/lp_base.h --- a/lemon/lp_base.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/lp_base.h Wed Mar 01 13:19:28 2006 +0000 @@ -24,9 +24,9 @@ #include #include -#include +#include #include -#include +#include ///\file ///\brief The interface of the LP solver interface. diff -r 6e1b62d42d94 -r 2115143eceea lemon/map_iterator.h --- a/lemon/map_iterator.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/map_iterator.h Wed Mar 01 13:19:28 2006 +0000 @@ -19,8 +19,8 @@ #ifndef LEMON_MAP_ITERATOR_H #define LEMON_MAP_ITERATOR_H -#include -#include +#include +#include /// \ingroup gutils /// \file diff -r 6e1b62d42d94 -r 2115143eceea lemon/maps.h --- a/lemon/maps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/maps.h Wed Mar 01 13:19:28 2006 +0000 @@ -21,8 +21,8 @@ #include -#include -#include +#include +#include ///\file ///\ingroup maps diff -r 6e1b62d42d94 -r 2115143eceea lemon/matrix_maps.h --- a/lemon/matrix_maps.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/matrix_maps.h Wed Mar 01 13:19:28 2006 +0000 @@ -21,7 +21,7 @@ #include -#include +#include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/max_matching.h --- a/lemon/max_matching.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/max_matching.h Wed Mar 01 13:19:28 2006 +0000 @@ -20,7 +20,7 @@ #define LEMON_MAX_MATCHING_H #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/min_cut.h --- a/lemon/min_cut.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/min_cut.h Wed Mar 01 13:19:28 2006 +0000 @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/path.h --- a/lemon/path.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/path.h Wed Mar 01 13:19:28 2006 +0000 @@ -45,7 +45,7 @@ #include #include -#include +#include namespace lemon { diff -r 6e1b62d42d94 -r 2115143eceea lemon/preflow.h --- a/lemon/preflow.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/preflow.h Wed Mar 01 13:19:28 2006 +0000 @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/prim.h --- a/lemon/prim.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/prim.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,10 +25,10 @@ #include #include -#include +#include #include #include -#include +#include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/smart_graph.h --- a/lemon/smart_graph.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/smart_graph.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,11 +25,11 @@ #include -#include +#include #include -#include +#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/traits.h --- a/lemon/traits.h Wed Mar 01 12:46:52 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -#ifndef LEMON_TRAITS_H -#define LEMON_TRAITS_H - -#include - -///\file -///\brief Traits for graphs and maps -/// - -namespace lemon { - template - class ItemSetTraits {}; - - - template - struct NodeNotifierIndicator { - typedef InvalidType Type; - }; - template - struct NodeNotifierIndicator< - Graph, - typename enable_if::type - > { - typedef typename Graph::NodeNotifier Type; - }; - - template - class ItemSetTraits<_Graph, typename _Graph::Node> { - public: - - typedef _Graph Graph; - - typedef typename Graph::Node Item; - typedef typename Graph::NodeIt ItemIt; - - typedef typename NodeNotifierIndicator::Type ItemNotifier; - - template - class Map : public Graph::template NodeMap<_Value> { - public: - typedef typename Graph::template NodeMap<_Value> Parent; - typedef typename Parent::Value Value; - - Map(const Graph& _graph) : Parent(_graph) {} - Map(const Graph& _graph, const Value& _value) - : Parent(_graph, _value) {} - - }; - - }; - - template - struct EdgeNotifierIndicator { - typedef InvalidType Type; - }; - template - struct EdgeNotifierIndicator< - Graph, - typename enable_if::type - > { - typedef typename Graph::EdgeNotifier Type; - }; - - template - class ItemSetTraits<_Graph, typename _Graph::Edge> { - public: - - typedef _Graph Graph; - - typedef typename Graph::Edge Item; - typedef typename Graph::EdgeIt ItemIt; - - typedef typename EdgeNotifierIndicator::Type ItemNotifier; - - template - class Map : public Graph::template EdgeMap<_Value> { - public: - typedef typename Graph::template EdgeMap<_Value> Parent; - typedef typename Parent::Value Value; - - Map(const Graph& _graph) : Parent(_graph) {} - Map(const Graph& _graph, const Value& _value) - : Parent(_graph, _value) {} - }; - - }; - - template - struct UEdgeNotifierIndicator { - typedef InvalidType Type; - }; - template - struct UEdgeNotifierIndicator< - Graph, - typename enable_if::type - > { - typedef typename Graph::UEdgeNotifier Type; - }; - - template - class ItemSetTraits<_Graph, typename _Graph::UEdge> { - public: - - typedef _Graph Graph; - - typedef typename Graph::UEdge Item; - typedef typename Graph::UEdgeIt ItemIt; - - typedef typename UEdgeNotifierIndicator::Type ItemNotifier; - - template - class Map : public Graph::template UEdgeMap<_Value> { - public: - typedef typename Graph::template UEdgeMap<_Value> Parent; - typedef typename Parent::Value Value; - - Map(const Graph& _graph) : Parent(_graph) {} - Map(const Graph& _graph, const Value& _value) - : Parent(_graph, _value) {} - }; - - }; - - template - struct ANodeNotifierIndicator { - typedef InvalidType Type; - }; - template - struct ANodeNotifierIndicator< - Graph, - typename enable_if::type - > { - typedef typename Graph::ANodeNotifier Type; - }; - - template - class ItemSetTraits<_Graph, typename _Graph::ANode> { - public: - - typedef _Graph Graph; - - typedef typename Graph::ANode Item; - typedef typename Graph::ANodeIt ItemIt; - - typedef typename ANodeNotifierIndicator::Type ItemNotifier; - - template - class Map : public Graph::template ANodeMap<_Value> { - public: - typedef typename Graph::template ANodeMap<_Value> Parent; - typedef typename Parent::Value Value; - - Map(const Graph& _graph) : Parent(_graph) {} - Map(const Graph& _graph, const Value& _value) - : Parent(_graph, _value) {} - }; - - }; - - template - struct BNodeNotifierIndicator { - typedef InvalidType Type; - }; - template - struct BNodeNotifierIndicator< - Graph, - typename enable_if::type - > { - typedef typename Graph::BNodeNotifier Type; - }; - - template - class ItemSetTraits<_Graph, typename _Graph::BNode> { - public: - - typedef _Graph Graph; - - typedef typename Graph::BNode Item; - typedef typename Graph::BNodeIt ItemIt; - - typedef typename BNodeNotifierIndicator::Type ItemNotifier; - - template - class Map : public Graph::template BNodeMap<_Value> { - public: - typedef typename Graph::template BNodeMap<_Value> Parent; - typedef typename Parent::Value Value; - - Map(const Graph& _graph) : Parent(_graph) {} - Map(const Graph& _graph, const Value& _value) - : Parent(_graph, _value) {} - }; - - }; - - - template - struct MapTraits { - typedef False ReferenceMapTag; - - typedef typename Map::Key Key; - typedef typename Map::Value Value; - - typedef const Value ConstReturnValue; - typedef const Value ReturnValue; - }; - - template - struct MapTraits< - Map, typename enable_if::type > - { - typedef True ReferenceMapTag; - - typedef typename Map::Key Key; - typedef typename Map::Value Value; - - typedef typename Map::ConstReference ConstReturnValue; - typedef typename Map::Reference ReturnValue; - - typedef typename Map::ConstReference ConstReference; - typedef typename Map::Reference Reference; - }; - - // Indicators for the tags - - template - struct NodeNumTagIndicator { - static const bool value = false; - }; - - template - struct NodeNumTagIndicator< - Graph, - typename enable_if::type - > { - static const bool value = true; - }; - - template - struct EdgeNumTagIndicator { - static const bool value = false; - }; - - template - struct EdgeNumTagIndicator< - Graph, - typename enable_if::type - > { - static const bool value = true; - }; - - template - struct FindEdgeTagIndicator { - static const bool value = false; - }; - - template - struct FindEdgeTagIndicator< - Graph, - typename enable_if::type - > { - static const bool value = true; - }; - - template - struct UndirectedTagIndicator { - static const bool value = false; - }; - - template - struct UndirectedTagIndicator< - Graph, - typename enable_if::type - > { - static const bool value = true; - }; - - - -} - -#endif // LEMON_MAPS_H diff -r 6e1b62d42d94 -r 2115143eceea lemon/ugraph_adaptor.h --- a/lemon/ugraph_adaptor.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/ugraph_adaptor.h Wed Mar 01 13:19:28 2006 +0000 @@ -27,12 +27,12 @@ /// ///\author Balazs Dezso -#include +#include #include #include -#include +#include #include diff -r 6e1b62d42d94 -r 2115143eceea lemon/unionfind.h --- a/lemon/unionfind.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/unionfind.h Wed Mar 01 13:19:28 2006 +0000 @@ -29,7 +29,7 @@ #include #include -#include +#include namespace lemon { diff -r 6e1b62d42d94 -r 2115143eceea lemon/utility.h --- a/lemon/utility.h Wed Mar 01 12:46:52 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -*- C++ -*- - * - * This file is a part of LEMON, a generic C++ optimization library - * - * Copyright (C) 2003-2006 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport - * (Egervary Research Group on Combinatorial Optimization, EGRES). - * - * Permission to use, modify and distribute this software is granted - * provided that this copyright notice appears in all copies. For - * precise terms see the accompanying LICENSE file. - * - * This software is provided "AS IS" with no warranty of any kind, - * express or implied, and with no claim as to its suitability for any - * purpose. - * - */ - -// This file contains a modified version of the enable_if library from BOOST. -// See the appropriate copyright notice below. - -// Boost enable_if library - -// Copyright 2003 © The Trustees of Indiana University. - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Authors: Jaakko Järvi (jajarvi at osl.iu.edu) -// Jeremiah Willcock (jewillco at osl.iu.edu) -// Andrew Lumsdaine (lums at osl.iu.edu) - - -#ifndef LEMON_UTILITY_H -#define LEMON_UTILITY_H - -///\file -///\brief Miscellaneous basic utilities -/// -///\todo Please rethink the organisation of the basic files like this. -///E.g. this file might be merged with invalid.h. - - -namespace lemon -{ - - /// Basic type for defining "tags". A "YES" condition for \c enable_if. - - /// Basic type for defining "tags". A "YES" condition for \c enable_if. - /// - ///\sa False - /// - /// \todo This should go to a separate "basic_types.h" (or something) - /// file. - struct True { - ///\e - static const bool value = true; - }; - - /// Basic type for defining "tags". A "NO" condition for \c enable_if. - - /// Basic type for defining "tags". A "NO" condition for \c enable_if. - /// - ///\sa True - struct False { - ///\e - static const bool value = false; - }; - - - class InvalidType { - private: - InvalidType(); - }; - - - template - struct Wrap { - const T &value; - Wrap(const T &t) : value(t) {} - }; - - /**************** dummy class to avoid ambiguity ****************/ - - template struct dummy { dummy(int) {} }; - - /**************** enable_if from BOOST ****************/ - - template - struct enable_if_c { - typedef T type; - }; - - template - struct enable_if_c {}; - - template - struct enable_if : public enable_if_c {}; - - template - struct lazy_enable_if_c { - typedef typename T::type type; - }; - - template - struct lazy_enable_if_c {}; - - template - struct lazy_enable_if : public lazy_enable_if_c {}; - - - template - struct disable_if_c { - typedef T type; - }; - - template - struct disable_if_c {}; - - template - struct disable_if : public disable_if_c {}; - - template - struct lazy_disable_if_c { - typedef typename T::type type; - }; - - template - struct lazy_disable_if_c {}; - - template - struct lazy_disable_if : public lazy_disable_if_c {}; - -} // namespace lemon - -#endif diff -r 6e1b62d42d94 -r 2115143eceea lemon/xy.h --- a/lemon/xy.h Wed Mar 01 12:46:52 2006 +0000 +++ b/lemon/xy.h Wed Mar 01 13:19:28 2006 +0000 @@ -20,7 +20,7 @@ #define LEMON_XY_H #include -#include +#include ///\ingroup misc ///\file diff -r 6e1b62d42d94 -r 2115143eceea test/max_matching_test.cc --- a/test/max_matching_test.cc Wed Mar 01 12:46:52 2006 +0000 +++ b/test/max_matching_test.cc Wed Mar 01 13:19:28 2006 +0000 @@ -23,7 +23,6 @@ #include #include "test_tools.h" -#include #include #include diff -r 6e1b62d42d94 -r 2115143eceea test/test_tools.h --- a/test/test_tools.h Wed Mar 01 12:46:52 2006 +0000 +++ b/test/test_tools.h Wed Mar 01 13:19:28 2006 +0000 @@ -25,8 +25,8 @@ #include #include -#include #include +#include using namespace lemon;