cleanup-2008 2812: Supress non-critical std::size_t.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Supress non-critical std::size_t. Mainly replace size_t nsites() by unsigned nsites(). Arguable, but make it compile on 64bits. * mln/topo/complex.hh, * mln/core/site_set/p_complex.hh, * mln/core/site_set/p_line_graph.hh, * mln/core/site_set/p_priority.hh, * mln/core/site_set/p_faces.hh, * mln/core/site_set/p_queue.hh, * mln/core/site_set/p_key.hh, * mln/core/site_set/p_queue_fast.hh, * mln/core/site_set/p_graph.hh, * mln/core/site_set/p_bgraph.hh, * mln/core/site_set/p_run.hh, * mln/core/site_set/p_line2d.hh, * mln/core/site_set/p_array.hh, * mln/core/site_set/p_vertices.hh, * mln/core/site_set/p_edges.hh, * mln/core/site_set/p_set.hh, * mln/core/image/image1d.hh, * mln/core/image/fi_adaptor.hh, * mln/core/concept/box.hh, * mln/core/concept/doc/image.hh, * mln/core/concept/doc/box.hh, * mln/core/concept/doc/image_fastest.hh, * mln/core/concept/image.hh, * mln/core/concept/site_set.hh, * mln/level/paste.spe.hh, * mln/convert/to_image.hh: Supress non-critical size_t. convert/to_image.hh | 8 ++++---- core/concept/box.hh | 6 +++--- core/concept/doc/box.hh | 2 +- core/concept/doc/image.hh | 2 +- core/concept/doc/image_fastest.hh | 2 +- core/concept/image.hh | 4 ++-- core/concept/site_set.hh | 2 +- core/image/fi_adaptor.hh | 4 ++-- core/image/image1d.hh | 4 ++-- core/site_set/p_array.hh | 7 ++++--- core/site_set/p_bgraph.hh | 8 ++++---- core/site_set/p_complex.hh | 10 ++++------ core/site_set/p_edges.hh | 8 ++++---- core/site_set/p_faces.hh | 10 ++++------ core/site_set/p_graph.hh | 14 ++++++-------- core/site_set/p_key.hh | 6 +++--- core/site_set/p_line2d.hh | 4 ++-- core/site_set/p_line_graph.hh | 12 ++++++------ core/site_set/p_priority.hh | 6 +++--- core/site_set/p_queue.hh | 4 ++-- core/site_set/p_queue_fast.hh | 10 +++++----- core/site_set/p_run.hh | 6 +++--- core/site_set/p_set.hh | 4 ++-- core/site_set/p_vertices.hh | 10 ++++------ level/paste.spe.hh | 2 +- topo/complex.hh | 12 ++++++------ 26 files changed, 80 insertions(+), 87 deletions(-) Index: mln/topo/complex.hh --- mln/topo/complex.hh (revision 2811) +++ mln/topo/complex.hh (working copy) @@ -124,11 +124,11 @@ /// \{ /// \brief Return the total number of faces, whatever their /// dimension. - std::size_t nfaces() const; + unsigned nfaces() const; /// \brief Return the number of \p N-faces. template <unsigned N> - std::size_t nfaces() const; + unsigned nfaces() const; /// \} /// \brief Dynamic manipulators. @@ -141,7 +141,7 @@ /// since each n_faces_set is checked (the present implementation /// does not provide a direct access to n_faces_set through a /// dynamic value of the dimension). - std::size_t nfaces(unsigned n) const; + unsigned nfaces(unsigned n) const; /// \} /// Pretty-printing. @@ -578,7 +578,7 @@ template <unsigned D> inline - std::size_t + unsigned complex<D>::nfaces() const { return fold_left_(internal::add_size(), 0); @@ -587,7 +587,7 @@ template <unsigned D> template <unsigned N> inline - std::size_t + unsigned complex<D>::nfaces() const { return data_->internal::faces_set_mixin<N, D>::faces_.size(); @@ -600,7 +600,7 @@ template <unsigned D> inline - std::size_t + unsigned complex<D>::nfaces(unsigned n) const { // Ensure N is compatible with D. Index: mln/core/site_set/p_complex.hh --- mln/core/site_set/p_complex.hh (revision 2811) +++ mln/core/site_set/p_complex.hh (working copy) @@ -147,12 +147,10 @@ /// (Required by the mln::Site_Set concept, since the property /// trait::site_set::nsites::known of this site set is set to /// `known'.) - /* FIXME: Return type should be std::size_t (see - mln/core/concept/site_set.hh). */ - std::size_t nsites() const; + unsigned nsites() const; /// Return The number of faces in the complex. - std::size_t nfaces() const; + unsigned nfaces() const; // FIXME: Add nfaces(unsigned) routines? Yes, if this can // simplify (and lighten) the implementation of piters, psites, @@ -236,7 +234,7 @@ template <unsigned D, typename G> inline - std::size_t + unsigned p_complex<D, G>::nsites() const { return nfaces(); @@ -244,7 +242,7 @@ template <unsigned D, typename G> inline - std::size_t + unsigned p_complex<D, G>::nfaces() const { return cplx_.nfaces(); Index: mln/core/site_set/p_line_graph.hh --- mln/core/site_set/p_line_graph.hh (revision 2811) +++ mln/core/site_set/p_line_graph.hh (working copy) @@ -109,12 +109,12 @@ /// `known'.) /* FIXME: Return type should be std::size_t (see mln/core/concept/site_set.hh). */ - std::size_t nsites() const; + unsigned nsites() const; /// Return The number of vertices in the graph. - std::size_t nvertices() const; + unsigned nvertices() const; /// Return The number of edges in the graph. - std::size_t nedges() const; + unsigned nedges() const; /// Is this site set valid? bool is_valid() const; @@ -196,7 +196,7 @@ template <typename P> inline - std::size_t + unsigned p_line_graph<P>::nsites() const { return nedges(); @@ -204,7 +204,7 @@ template <typename P> inline - std::size_t + unsigned p_line_graph<P>::nvertices() const { return this->gr_->nvertices(); @@ -212,7 +212,7 @@ template <typename P> inline - std::size_t + unsigned p_line_graph<P>::nedges() const { return this->gr_->nedges(); Index: mln/core/site_set/p_priority.hh --- mln/core/site_set/p_priority.hh (revision 2811) +++ mln/core/site_set/p_priority.hh (working copy) @@ -114,7 +114,7 @@ bool is_valid() const; /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Push in the queue with \p priority the element \p e. @@ -181,7 +181,7 @@ util::set<P> p_; q_type_ q_; - std::size_t n_; + unsigned n_; // Run invariance tests and return the result. bool run_() const; @@ -225,7 +225,7 @@ template <typename P, typename Q> inline - std::size_t + unsigned p_priority<P,Q>::nsites() const { mln_invariant(run_()); Index: mln/core/site_set/p_faces.hh --- mln/core/site_set/p_faces.hh (revision 2811) +++ mln/core/site_set/p_faces.hh (working copy) @@ -118,12 +118,10 @@ /// (Required by the mln::Site_Set concept, since the property /// trait::site_set::nsites::known of this site set is set to /// `known'.) - /* FIXME: Return type should be std::size_t (see - mln/core/concept/site_set.hh). */ - std::size_t nsites() const; + unsigned nsites() const; /// Return The number of faces in the complex. - std::size_t nfaces() const; + unsigned nfaces() const; // FIXME: Add nfaces(unsigned) routines? Yes, if this can // simplify (and lighten) the implementation of piters, psites, @@ -212,7 +210,7 @@ template <unsigned N, unsigned D, typename P> inline - std::size_t + unsigned p_faces<N, D, P>::nsites() const { return nfaces(); @@ -220,7 +218,7 @@ template <unsigned N, unsigned D, typename P> inline - std::size_t + unsigned p_faces<N, D, P>::nfaces() const { return cplx_.template nfaces<N>(); Index: mln/core/site_set/p_queue.hh --- mln/core/site_set/p_queue.hh (revision 2811) +++ mln/core/site_set/p_queue.hh (working copy) @@ -108,7 +108,7 @@ /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Push a site \p p in the queue. @@ -195,7 +195,7 @@ template <typename P> inline - std::size_t + unsigned p_queue<P>::nsites() const { return q_.size(); Index: mln/core/site_set/p_key.hh --- mln/core/site_set/p_key.hh (revision 2811) +++ mln/core/site_set/p_key.hh (working copy) @@ -115,7 +115,7 @@ bool is_valid() const; /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Insertion element associated type. @@ -192,7 +192,7 @@ k_t k_; // Number of sites. - std::size_t n_; + unsigned n_; // Run invariance tests and return the result. bool run_() const; @@ -245,7 +245,7 @@ template <typename K, typename P> inline - std::size_t + unsigned p_key<K,P>::nsites() const { mln_invariant(run_()); Index: mln/core/site_set/p_queue_fast.hh --- mln/core/site_set/p_queue_fast.hh (revision 2811) +++ mln/core/site_set/p_queue_fast.hh (working copy) @@ -95,7 +95,7 @@ p_queue_fast(); /// Reserve \p n cells. - void reserve(std::size_t n); + void reserve(typename p_array<P>::size_type n); /// Test if \p p belongs to this site set. bool has(const psite& p) const; @@ -110,7 +110,7 @@ bool compute_has(const P& p) const; /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Push a site \p p in the queue. @@ -175,9 +175,9 @@ template <typename P> inline void - p_queue_fast<P>::reserve(std::size_t n) + p_queue_fast<P>::reserve(typename p_array<P>::size_type n) { - q_.reserve(); + q_.reserve(n); } template <typename P> @@ -236,7 +236,7 @@ template <typename P> inline - std::size_t + unsigned p_queue_fast<P>::nsites() const { mln_invariant(end_ >= begin_); Index: mln/core/site_set/p_graph.hh --- mln/core/site_set/p_graph.hh (revision 2811) +++ mln/core/site_set/p_graph.hh (working copy) @@ -101,14 +101,12 @@ /// the number of \em vertices. /// /// Required by the mln::Point_Set concept. - /* FIXME: Return type should be std::size_t (see - mln/core/concept/site_set.hh). */ - std::size_t nsites() const; + unsigned nsites() const; /// Return The number of vertices in the graph. - std::size_t nvertices() const; + unsigned nvertices() const; /// Return The number of edges in the graph. - std::size_t nedges() const; + unsigned nedges() const; /// Is this site set valid? bool is_valid() const; @@ -207,7 +205,7 @@ template <typename P> inline - std::size_t + unsigned p_graph<P>::nsites() const { return nvertices(); @@ -215,7 +213,7 @@ template <typename P> inline - std::size_t + unsigned p_graph<P>::nvertices() const { return this->gr_->nvertices(); @@ -223,7 +221,7 @@ template <typename P> inline - std::size_t + unsigned p_graph<P>::nedges() const { return this->gr_->nedges(); Index: mln/core/site_set/p_bgraph.hh --- mln/core/site_set/p_bgraph.hh (revision 2811) +++ mln/core/site_set/p_bgraph.hh (working copy) @@ -78,10 +78,10 @@ p_bgraph (graph* gr); /// Return The number of points (i.e., nodes) in the graph. - std::size_t nsites() const; + unsigned nsites() const; /// Return The number of lines (i.e., edges) in the graph. - std::size_t nlines() const; + unsigned nlines() const; /// Give the exact bounding box. const box<P>& bbox() const; @@ -130,7 +130,7 @@ template<typename P> inline - std::size_t + unsigned p_bgraph<P>::nsites() const { return boost::num_vertices(*gr_); @@ -138,7 +138,7 @@ template<typename P> inline - std::size_t + unsigned p_bgraph<P>::nlines() const { return boost::num_edges(gr_->nedges()); Index: mln/core/site_set/p_run.hh --- mln/core/site_set/p_run.hh (revision 2811) +++ mln/core/site_set/p_run.hh (working copy) @@ -128,7 +128,7 @@ bool has_index(unsigned short i) const; /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Give the length of the run. unsigned short length() const; @@ -162,7 +162,7 @@ P start_; /// The length of the run. - std::size_t len_; + unsigned len_; }; @@ -307,7 +307,7 @@ template <typename P> inline - std::size_t + unsigned p_run<P>::nsites() const { mln_precondition(is_valid()); Index: mln/core/site_set/p_line2d.hh --- mln/core/site_set/p_line2d.hh (revision 2811) +++ mln/core/site_set/p_line2d.hh (working copy) @@ -112,7 +112,7 @@ /// Give the number of points. - std::size_t nsites() const; + unsigned nsites() const; /// Give the point that begins the line. const point2d& begin() const; @@ -252,7 +252,7 @@ } inline - std::size_t + unsigned p_line2d::nsites() const { return arr_.nsites(); Index: mln/core/site_set/p_array.hh --- mln/core/site_set/p_array.hh (revision 2811) +++ mln/core/site_set/p_array.hh (working copy) @@ -83,6 +83,7 @@ { typedef p_array<P> self_; public: + typedef typename std::vector<P>::size_type size_type; /// Element associated type. typedef P element; @@ -108,7 +109,7 @@ /// Reserve \p n cells. - void reserve(std::size_t n); + void reserve(size_type n); /// Test is \p p belongs to this site set. @@ -125,7 +126,7 @@ void change(const psite& p, const P& new_p); /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Append a point \p p. @@ -338,7 +339,7 @@ template <typename P> inline void - p_array<P>::reserve(std::size_t n) + p_array<P>::reserve(size_type n) { vect_.reserve(n); } Index: mln/core/site_set/p_vertices.hh --- mln/core/site_set/p_vertices.hh (revision 2811) +++ mln/core/site_set/p_vertices.hh (working copy) @@ -104,12 +104,10 @@ /// the number of \em vertices. /// /// Required by the mln::Point_Set concept. - /* FIXME: Return type should be std::size_t (see - mln/core/concept/site_set.hh). */ - size_t nsites() const; + unsigned nsites() const; /// Return The number of vertices in the graph. - std::size_t nvertices() const; + unsigned nvertices() const; /// Is this site set valid? bool is_valid() const; @@ -191,7 +189,7 @@ template <typename G, typename F> inline - size_t + unsigned p_vertices<G, F>::nsites() const { return nvertices(); @@ -199,7 +197,7 @@ template <typename G, typename F> inline - std::size_t + unsigned p_vertices<G, F>::nvertices() const { return this->g_->v_nmax(); Index: mln/core/site_set/p_edges.hh --- mln/core/site_set/p_edges.hh (revision 2811) +++ mln/core/site_set/p_edges.hh (working copy) @@ -94,10 +94,10 @@ /// \brief Return The number of points (sites) of the set, i.e., /// the number of \em edges. - size_t nsites() const; + unsigned nsites() const; /// Return The number of edges in the graph. - std::size_t nedges() const; + unsigned nedges() const; /// Is this site set valid? bool is_valid() const; @@ -162,7 +162,7 @@ template <typename G, typename F> inline - size_t + unsigned p_edges<G, F>::nsites() const { return nedges(); @@ -170,7 +170,7 @@ template <typename G, typename F> inline - std::size_t + unsigned p_edges<G, F>::nedges() const { return this->g_->e_nmax(); Index: mln/core/site_set/p_set.hh --- mln/core/site_set/p_set.hh (revision 2811) +++ mln/core/site_set/p_set.hh (working copy) @@ -107,7 +107,7 @@ /// Give the number of sites. - std::size_t nsites() const; + unsigned nsites() const; /// Insertion element associated type. @@ -192,7 +192,7 @@ template <typename P> inline - std::size_t + unsigned p_set<P>::nsites() const { return s_.nelements(); Index: mln/core/image/image1d.hh --- mln/core/image/image1d.hh (revision 2811) +++ mln/core/image/image1d.hh (working copy) @@ -213,7 +213,7 @@ T& element(unsigned ind); /// Give the number of cells (points including border ones). - std::size_t nelements() const; + unsigned nelements() const; @@ -389,7 +389,7 @@ template <typename T> inline - std::size_t + unsigned image1d<T>::nelements() const { mln_precondition(this->has_data()); Index: mln/core/image/fi_adaptor.hh --- mln/core/image/fi_adaptor.hh (revision 2811) +++ mln/core/image/fi_adaptor.hh (working copy) @@ -170,7 +170,7 @@ const box2d& domain() const; /// Give the number of cells. - std::size_t nelements() const; + unsigned nelements() const; /// Read-only access to the image value located at point \p p. const T& operator()(const point2d& p) const; @@ -306,7 +306,7 @@ } template <typename I> - std::size_t + unsigned fi_adaptor<I>::nelements() const { mln_precondition(this->has_data()); Index: mln/core/concept/box.hh --- mln/core/concept/box.hh (revision 2811) +++ mln/core/concept/box.hh (working copy) @@ -82,7 +82,7 @@ * * \warning This method is final for all box classes. */ - std::size_t nsites() const; + unsigned nsites() const; protected: Box(); @@ -157,12 +157,12 @@ template <typename E> inline - std::size_t + unsigned Box<E>::nsites() const { if (! exact(this)->is_valid()) return 0; - std::size_t count = 1; + unsigned count = 1; typedef mln_site(E) P; // Helps g++-3.3.5. for (unsigned i = 0; i < P::dim; ++i) count *= exact(this)->len(i); Index: mln/core/concept/doc/image.hh --- mln/core/concept/doc/image.hh (revision 2811) +++ mln/core/concept/doc/image.hh (working copy) @@ -176,7 +176,7 @@ /*! \brief Give the number of points of the image domain. */ - std::size_t nsites() const; + unsigned nsites() const; }; Index: mln/core/concept/doc/box.hh --- mln/core/concept/doc/box.hh (revision 2811) +++ mln/core/concept/doc/box.hh (working copy) @@ -74,7 +74,7 @@ * * \warning This method is final for all box classes. */ - std::size_t nsites() const; + unsigned nsites() const; }; } // end of namespace mln::doc Index: mln/core/concept/doc/image_fastest.hh --- mln/core/concept/doc/image_fastest.hh (revision 2811) +++ mln/core/concept/doc/image_fastest.hh (working copy) @@ -106,7 +106,7 @@ * * \pre The image has to be initialized. */ - std::size_t nelements() const; + unsigned nelements() const; }; } // end of namespace mln::doc Index: mln/core/concept/image.hh --- mln/core/concept/image.hh (revision 2811) +++ mln/core/concept/image.hh (working copy) @@ -86,7 +86,7 @@ typedef bkd_piter; bool has(const psite& p) const; - std::size_t nsites() const; // If relevant. + unsigned nsites() const; // If relevant. bool has_data() const; @@ -194,7 +194,7 @@ m1 = 0; // Only some image types feature the 'nsites' method. -// std::size_t (E::*m2)() const = & E::nsites; +// unsigned (E::*m2)() const = & E::nsites; // m2 = 0; bool (E::*m3)() const = & E::has_data; Index: mln/core/concept/site_set.hh --- mln/core/concept/site_set.hh (revision 2811) +++ mln/core/concept/site_set.hh (working copy) @@ -186,7 +186,7 @@ { static void run() { - std::size_t (E::*m)() const = & E::nsites; + unsigned (E::*m)() const = & E::nsites; m = 0; } }; Index: mln/level/paste.spe.hh --- mln/level/paste.spe.hh (revision 2811) +++ mln/level/paste.spe.hh (working copy) @@ -77,7 +77,7 @@ // { // trace::entering("level::impl::paste_lines_"); // typedef mln_psite(I) P; -// std::size_t n = data.bbox().len(P::dim - 1); +// unsigned n = data.bbox().len(P::dim - 1); // // FIXME: Works only for raw data images // // FIXME: For linear data images, we should get the len for each line... Index: mln/convert/to_image.hh --- mln/convert/to_image.hh (revision 2811) +++ mln/convert/to_image.hh (working copy) @@ -77,9 +77,9 @@ mln_image_from_grid(mln_site(N)::grid, bool) to_image(const Neighborhood<N>& nbh); - /// Convert an histo \p h into an image1d<std::size_t>. + /// Convert an histo \p h into an image1d<unsigned>. template <typename T> - image1d<std::size_t> + image1d<unsigned> to_image(const histo::data<T>& h); @@ -136,12 +136,12 @@ template <typename T> inline - image1d<std::size_t> + image1d<unsigned> to_image(const histo::data<T>& h) { T v_min = h.vset()[0], v_max = h.vset()[h.vset().nvalues() - 1]; - image1d<std::size_t> ima(make::box1d(v_min, v_max)); + image1d<unsigned> ima(make::box1d(v_min, v_max)); for (unsigned i = 0; i < h.vset().nvalues(); ++i) ima(point1d(i)) = h[i]; return ima;
participants (1)
-
Ugo Jardonnet