last-svn-commit-912-gaea0fc0 Add a missing conversion routine for object ids.

* mln/convert/from_to.hxx, * mln/util/object_id.hh: Here. --- milena/ChangeLog | 7 ++++++ milena/mln/convert/from_to.hxx | 7 +++++- milena/mln/util/object_id.hh | 41 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 8ea11b0..47dbff5 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,10 @@ +2011-06-07 Guillaume Lazzara <z@lrde.epita.fr> + + Add a missing conversion routine for object ids. + + * mln/convert/from_to.hxx, + * mln/util/object_id.hh: Here. + 2011-05-26 Guillaume Lazzara <z@lrde.epita.fr> * mln/draw/site_set.hh: new. diff --git a/milena/mln/convert/from_to.hxx b/milena/mln/convert/from_to.hxx index cc7cc15..7891e9a 100644 --- a/milena/mln/convert/from_to.hxx +++ b/milena/mln/convert/from_to.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2008, 2009, 2010 EPITA Research and Development +// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development // Laboratory (LRDE) // // This file is part of Olena. @@ -84,6 +84,7 @@ namespace mln namespace util { template <typename T> class array; + template <typename Tag, typename V> class object_id; } namespace value { @@ -473,6 +474,10 @@ namespace mln from_to(from.second(), to.second()); } + // util::object_id<Tag,V> -> V. + template <typename Tag, typename V> + void from_to_(const util::object_id<Tag,V>& from, V& to_); + } // end of namespace mln::convert::over_load } // end of namespace mln::convert diff --git a/milena/mln/util/object_id.hh b/milena/mln/util/object_id.hh index d7db929..794abc4 100644 --- a/milena/mln/util/object_id.hh +++ b/milena/mln/util/object_id.hh @@ -38,6 +38,24 @@ namespace mln { + // Forward declaration + namespace util { template <typename Tag, typename V> class object_id; } + + namespace convert + { + + namespace over_load + { + + // object_id<Tag,V> -> V. + template <typename Tag, typename V> + void from_to_(const util::object_id<Tag,V>& from, V& to_); + + } // end of namespace mln::convert::over_load + + } // end of namespace mln::convert + + namespace util { @@ -90,9 +108,12 @@ namespace mln bool operator<(const object_id<Tag,V>& lhs, const object_id<Tag,V>& rhs); + } // end of namespace mln::util # ifndef MLN_INCLUDE_ONLY + namespace util + { template <typename Tag, typename V> inline @@ -205,10 +226,26 @@ namespace mln return lhs.value() < rhs.value(); } + } // end of namespace mln::util -# endif // ! MLN_INCLUDE_ONLY + namespace convert + { - } // end of namespace mln::util + namespace over_load + { + + // object_id<Tag,V> -> V. + template <typename Tag, typename V> + void from_to_(const util::object_id<Tag,V>& from, V& to_) + { + to_ = from.value(); + } + + } // end of namespace mln::convert::over_load + + } // end of namespace mln::convert + +# endif // ! MLN_INCLUDE_ONLY } // end of namespace mln -- 1.5.6.5
participants (1)
-
Guillaume Lazzara