Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(NOT_SUBPROJECT TRUE)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Initialize CPM.cmake
include(cmake/CPM.cmake)

Expand Down
3 changes: 2 additions & 1 deletion include/errors/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>

namespace errors {
Expand All @@ -27,7 +28,7 @@ class Error {
* std::cout << err << std::endl;
* @endcode
*/
std::string message() const;
std::string_view message() const;

friend Error make(const std::string& msg);

Expand Down
2 changes: 1 addition & 1 deletion src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace errors {

Error::Error(const std::shared_ptr<const std::string>& message_ptr) : message_ptr(message_ptr) {}

std::string Error::message() const {
std::string_view Error::message() const {
if (!message_ptr) return "no error";
return *message_ptr;
}
Expand Down