axis-group-interface: avoid some cast warnings (issue 583510045 by hanwenn@gmail.com)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

axis-group-interface: avoid some cast warnings (issue 583510045 by hanwenn@gmail.com)

Dev mailing list
Reply | Threaded
Open this post in threaded view
|

Re: axis-group-interface: avoid some cast warnings (issue 583510045 by hanwenn@gmail.com)

nine.fierce.ballads

https://codereview.appspot.com/583510045/diff/559490043/lily/axis-group-interface.cc
File lily/axis-group-interface.cc (right):

https://codereview.appspot.com/583510045/diff/559490043/lily/axis-group-interface.cc#newcode277
lily/axis-group-interface.cc:277: Interval_t<vsize> rank_span
(rank_span_int[LEFT], rank_span_int[RIGHT]);
A constructor would clean this up.  I tried this:

  template <typename T2>
  Interval_t (Interval_t<T2> const &src) : Interval_t (src[LEFT],
src[RIGHT])
  {
  }

Having that, both of the following compiled:

  Interval_t<vsize> rank_span (g->spanned_rank_interval ());

  Interval_t<vsize> rank_span = g->spanned_rank_interval ();

I also tested Interval_t<unsigned char> and the compiler still properly
warns about conversions.

https://codereview.appspot.com/583510045/