C++ API bool is* functions

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

C++ API bool is* functions

Andreas Weber-6
Dear all,

I wanted to create a cheat cheet for all the "bool is* (void)" functions
from octave_value derived classes:

This is the current result for the default branch (aka 4.3.0):

https://josoansi.de/files/check_type.pdf

(I've removed deprecated, "function" and "classdef" to fit it onto one page)

While creating the table I found out that "is_true" throws an error for
Cell inputs. Is this wanted? And if yes, why is "is_true" the only one?

-- Andy

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: C++ API bool is* functions

siko1056
Andreas Weber-6 wrote
> [...] I found out that "is_true" throws an error for Cell inputs. Is this
> wanted? And if yes, why is "is_true" the only one?
>
> -- Andy

Dear Andy,

I am afraid, that this behavior is wanted, see [1]:

bool
octave_cell::is_true (void) const
{
   error ("invalid conversion from cell array to logical value");
}

The reason for this is not obvious to me.  To my knowledge implicit
conversion might happen in C++ with constructors only [2]?

Best,
Kai

[1]
https://www.octave.space/latest/doxygen/d7/ded/ov-cell_8cc_source.html#l00537
[2] http://en.cppreference.com/w/cpp/language/explicit



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave