mirror of
https://github.com/topjohnwu/cxx.git
synced 2024-11-27 22:00:33 +00:00
Switch demo code to using std::make_unique
This commit is contained in:
parent
9808ef177c
commit
c13ad23d9c
@ -1,6 +1,7 @@
|
||||
cxx_library(
|
||||
name = "demo-cxx",
|
||||
srcs = ["demo.cc"],
|
||||
compiler_flags = ["-std=c++14"],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":include",
|
||||
|
@ -1,6 +1,7 @@
|
||||
cc_library(
|
||||
name = "demo-cxx",
|
||||
srcs = ["demo.cc"],
|
||||
copts = ["-std=c++14"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":include",
|
||||
|
@ -10,7 +10,7 @@ ThingC::ThingC(std::string appname) : appname(std::move(appname)) {}
|
||||
ThingC::~ThingC() { std::cout << "done with ThingC" << std::endl; }
|
||||
|
||||
std::unique_ptr<ThingC> make_demo(rust::Str appname) {
|
||||
return std::unique_ptr<ThingC>(new ThingC(std::string(appname)));
|
||||
return std::make_unique<ThingC>(std::string(appname));
|
||||
}
|
||||
|
||||
const std::string &get_name(const ThingC &thing) { return thing.appname; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
fn main() {
|
||||
cxx_build::bridge("src/main.rs")
|
||||
.file("../demo-cxx/demo.cc")
|
||||
.flag_if_supported("-std=c++11")
|
||||
.flag_if_supported("-std=c++14")
|
||||
.compile("cxxbridge-demo");
|
||||
|
||||
println!("cargo:rerun-if-changed=src/main.rs");
|
||||
|
Loading…
Reference in New Issue
Block a user