Skip to content

Commit 3a1c20a

Browse files
committed
Make directory::path and directory::operator/ inline
1 parent 9f9a862 commit 3a1c20a

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

include/tmp/directory

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,22 @@ public:
5151

5252
/// Returns the path of this directory
5353
/// @returns The full path of this directory
54-
operator const std::filesystem::path&() const noexcept;
54+
operator const std::filesystem::path&() const noexcept {
55+
return pathobject;
56+
}
5557

5658
/// Returns the path of this directory
5759
/// @returns The full path of this directory
58-
const std::filesystem::path& path() const noexcept;
60+
const std::filesystem::path& path() const noexcept {
61+
return pathobject;
62+
}
5963

6064
/// Concatenates this directory path with a given path name
6165
/// @param source A path name
6266
/// @returns The result of path concatenation
63-
std::filesystem::path operator/(const std::filesystem::path& source) const;
67+
std::filesystem::path operator/(const std::filesystem::path& source) const {
68+
return path() / source;
69+
}
6470

6571
/// Deletes this directory recursively
6672
~directory() noexcept;

src/directory.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,6 @@ void remove_directory(const directory& directory) noexcept {
116116
directory::directory(std::string_view prefix)
117117
: pathobject(create_directory(prefix)) {}
118118

119-
directory::operator const fs::path&() const noexcept {
120-
return pathobject;
121-
}
122-
123-
const fs::path& directory::path() const noexcept {
124-
return pathobject;
125-
}
126-
127-
fs::path directory::operator/(const fs::path& source) const {
128-
return path() / source;
129-
}
130-
131119
directory::~directory() noexcept {
132120
(void)handle; // Old compilers do not want to accept `[[maybe_unused]]`
133121
remove_directory(*this);

0 commit comments

Comments
 (0)