This forum has been archived. All content is frozen. Please use KDE Discuss instead.

casting fixed size array genreated error

Tags: None
(comma "," separated)
richardedwards
Registered Member
Posts
1
Karma
0
I am trying to cast a fixed size array to another type in a templated function and I am getting an error.

Code: Select all
template<int n>
int fcn()
{
    Array<int,n,1> a;
    a.cast<float>();
    return 0;
}


This generates the following error.
Code: Select all
||=== Build: Debug in trial (compiler: GNU GCC Compiler) ===|
C:\Users\redwards\workspace\trial\main.cpp||In function 'int fcn()':|
C:\Users\redwards\workspace\trial\main.cpp|95|error: expected primary-expression before 'float'|
C:\Users\redwards\workspace\trial\main.cpp|95|error: expected ';' before 'float'|
C:\Users\redwards\workspace\trial\main.cpp||In instantiation of 'Split<nports>::Split(const Eigen::Array<double, 2, 1>&, const Eigen::Array<double, (nports - 1), 1>&, const Eigen::Array<unsigned int, nports, 1>&, ftype, ftype) [with unsigned int nports = 2u; ftype = double]':|
C:\Users\redwards\workspace\trial\main.cpp|112|required from here|


if I comment out the line
Code: Select all
template<int n>
int fcn()
{
    Array<int,n,1> a;
//    a.cast<float>();
    return 0;
}

then it compiles fine. With dynamic sized arrays it compiles fine. Any insight would be greatly appreciated.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]