octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53650] build: clang-6.0 compiler warnings


From: Rik
Subject: [Octave-bug-tracker] [bug #53650] build: clang-6.0 compiler warnings
Date: Sun, 15 Apr 2018 00:59:15 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #5, bug #53650 (project octave):

What I was trying to do was call the empty constructor of T just once and
therefore I did it outside the call to std::count_if.  I also used const just
to emphasize that 'zero' is really a constant value that needs to be compared
to each elem.

For std::count_if, the lamda function should be inlined, so no function
calling overhead, but it will still be called nel times.  I don't want to call
the constructor of T nel times.  Now, since this is a matrix class it is
likely that T is a POD type in which case the constructor is trivial.  But
maybe T is a complex number for which there is still some overhead in calling
the constructor.

If anything, it might be better to define the capture as capture by reference
with


[&zero]


Currently it is passing zero via a copy mechanism which might be calling the
copy constructor of T which seems like unnecessary work.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53650>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]