From bbeef185dc79a335c983fdd3b503ae10e590458e Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 23 Feb 2024 18:50:24 +0100 Subject: TmpDir: Getter should return const ref ... and prohibit moves and move assignments. --- src/utils/cpp/tmp_dir.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/utils/cpp/tmp_dir.hpp') diff --git a/src/utils/cpp/tmp_dir.hpp b/src/utils/cpp/tmp_dir.hpp index b0dd5e5e..3801e7a0 100644 --- a/src/utils/cpp/tmp_dir.hpp +++ b/src/utils/cpp/tmp_dir.hpp @@ -33,13 +33,15 @@ class TmpDir { /// \brief Destroy the TmpDir object. It tries to remove the tmp folder. ~TmpDir() noexcept; - // no copies, only moves + // no copies, no moves TmpDir(TmpDir const&) = delete; - TmpDir(TmpDir&& other) noexcept = default; + TmpDir(TmpDir&& other) noexcept = delete; auto operator=(TmpDir const&) = delete; - auto operator=(TmpDir&& other) noexcept -> TmpDir& = default; + auto operator=(TmpDir&& other) noexcept -> TmpDir& = delete; - [[nodiscard]] auto GetPath() const noexcept -> std::filesystem::path; + [[nodiscard]] auto GetPath() const& noexcept + -> std::filesystem::path const&; + [[nodiscard]] auto GetPath() && = delete; /// \brief Creates a completely unique directory in a given prefix path. [[nodiscard]] static auto Create( @@ -51,4 +53,4 @@ class TmpDir { std::filesystem::path tmp_dir_{}; }; -#endif // INCLUDED_SRC_OTHER_TOOLS_TMP_DIR_HPP \ No newline at end of file +#endif // INCLUDED_SRC_OTHER_TOOLS_TMP_DIR_HPP -- cgit v1.2.3