emitMakeShared()

in src/langs/cpp/combinator.js [484:501]


  emitMakeShared(type, data, need_cast = false) {
    let type_str = typeof (type) === 'string' ? type : this.emitType(type);
    if (type_str === 'nullptr') {
      return 'nullptr';
    }
    let data_str;
    if (typeof (data) === 'string') {
      data_str = data;
    } else {
      const emit = new Emitter(this.config);
      this.grammer(emit, data, false, false);
      data_str = emit.output;
    }
    if (need_cast) {
      return `make_shared<${type_str}>(boost::any_cast<${type_str}>(${data_str}))`;
    }
    return `make_shared<${type_str}>(${data_str})`;
  }