我在网上寻找@Pharo 中运算符的含义,但找不到任何内容。
Pharo@运算符的含义是什么?例如,为什么25@50被评估为:"(25@50)"?
为什么以下代码会给我一个分段错误:
#include<iostream>
#include<thread>
#include<vector>
using namespace std;
double f(double a, double b, double* c) {
*c = a + b;
}
int main() {
vector<double> a ={1,2,3,4,5,6,7,8};
vector<double> b ={2,1,3,4,5,2,8,2};
int size = a.size();
vector<double> c(size);
vector<thread*> threads(size);
for (int i = 0; i < size; ++i) {
thread* t = new thread(f, a[i], b[i], &c[i]);
threads.push_back(t);
}
for (vector<thread*>::iterator it = threads.begin(); it != threads.end(); it++) {
(*it)->join();
}
cout << "Vector c is: ";
for (int i =0; …Run Code Online (Sandbox Code Playgroud)