[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
conversion of octave_int<short int> to int?
From: |
Eric Chassande-Mottin |
Subject: |
conversion of octave_int<short int> to int? |
Date: |
Mon, 12 Nov 2007 13:16:33 -0500 |
hi,
----------------------------------------------------------------------------------------------------
int16NDArray arcs=myArcs(startNode).int16_array_value();
[...]
int arcIndex = (int) arcs(k) - 1;
[...]
----------------------------------------------------------------------------------------------------
with the above code, I get the following error at compilation:
csp.cc:83: note: candidate 2: operator-(float, int) <built-in>
csp.cc:83: error: conversion from 'octave_int<short int>' to 'int' is ambiguous
/usr/include/octave-2.9.14/octave/oct-inttypes.h:260: note: candidates
are: octave_int<T>::operator float() const [with T = short int]
/usr/include/octave-2.9.14/octave/oct-inttypes.h:258: note:
octave_int<T>::operator double() const [with T = short int]
/usr/include/octave-2.9.14/octave/oct-inttypes.h:256: note:
octave_int<T>::operator char() const [with T = short int]
/usr/include/octave-2.9.14/octave/oct-inttypes.h:254: note:
octave_int<T>::operator bool() const [with T = short int]
while with the change
double arcIndex = (double) arcs(k) - 1;
the code does compile. Why is the conversion to int disabled?
thanks,
eric
- conversion of octave_int<short int> to int?,
Eric Chassande-Mottin <=