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