xeus-cling icon indicating copy to clipboard operation
xeus-cling copied to clipboard

Function cannot return type vector<T>. Limitation or bug?

Open hyiyang opened this issue 6 years ago • 5 comments
trafficstars

Reproduced in Binder:

#include <iostream>
#include <vector>

std::cout << "some output" << std::endl;

std::vector<int> test() {
    std::vector<int> result;
    return result;
}

input_line_8:3:25: error: function definition is not allowed here std::vector test() { ^ Interpreter Error:

hyiyang avatar Mar 20 '19 08:03 hyiyang

It should work if you define the function in a dedicated cell.

JohanMabille avatar Mar 20 '19 09:03 JohanMabille

Yes it is a parsing issue in cling. The next version should come with a fix for this after cling 0.6 is out.

SylvainCorlay avatar Mar 20 '19 09:03 SylvainCorlay

I just saw cling 0.6 released 4 days ago...

sean-parent avatar Aug 20 '19 00:08 sean-parent

Yes, I've been working on the conda recipe since yesterday.

JohanMabille avatar Aug 20 '19 06:08 JohanMabille

@SylvainCorlay I want to know how to upgrade the cling on Ubuntu... I have updated all of my packages with conda yesterday, but the cling --version is still 0.5...

leoyinhaiqing avatar Sep 23 '19 01:09 leoyinhaiqing