コード例 #1
0
int main() {
  copy_directly();
  copy_with_back_inserter();

  move_integers();
  move_strings();

  unary_transform();
  binary_transform();
}
コード例 #2
0
std::vector<std::shared_ptr<sarray<flexible_type>>> 
vertex_apply(sgraph& g,
             std::vector<std::shared_ptr<sarray<T>>> & other,
             flex_type_enum result_type,
             Fn fn) {
  ASSERT_EQ(g.get_num_partitions(), other.size());
  std::vector<std::shared_ptr<sarray<flexible_type>>> ret(g.get_num_partitions());
  // get all the vertex partitions.
  const std::vector<sframe>& vdata = g.vertex_group();
  parallel_for((size_t)(0), (size_t)g.get_num_partitions(), [&](size_t i) {
    std::shared_ptr<sarray<flexible_type>> ret_partition = std::make_shared<sarray<flexible_type>>();
    ret_partition->open_for_write(1);
    ret_partition->set_type(result_type);
    binary_transform(vdata[i], *other[i], *ret_partition, fn);
    ret_partition->close();
    ret[i] = ret_partition;
  });
  return ret;
}