From 7a7b8ba432977282a90567c77822a72645d2a5c8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 9 Apr 2016 07:48:02 +0200 Subject: Add abs_dir_path type, auto-complete if initialized from names --- build2/types | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'build2/types') diff --git a/build2/types b/build2/types index 166f47a..d3930ba 100644 --- a/build2/types +++ b/build2/types @@ -8,7 +8,7 @@ #include #include #include // unique_ptr, shared_ptr -#include // pair +#include // pair, move() #include // size_t, nullptr_t #include // uint{8,16,32,64}_t #include @@ -77,6 +77,22 @@ namespace build2 using butl::basic_path; using butl::invalid_path; + // Absolute directory path. Note that for now we don't do any checking that + // the path is in fact absolute. + // + // The idea is to have a different type that we automatically complete when + // a (variable) value of this type gets initialized from untyped names. See + // value_type for details. + // + struct abs_dir_path: dir_path + { + using dir_path::dir_path; + + explicit + abs_dir_path (dir_path d): dir_path (std::move (d).string (), false) {} + abs_dir_path () = default; + }; + using paths = std::vector; using dir_paths = std::vector; -- cgit v1.1