summaryrefslogtreecommitdiff
path: root/src/ctor.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-12-07 16:51:49 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2024-12-07 16:51:49 +0100
commit87997f6285fdba420c00e740d26f98f7e7e06504 (patch)
treed8631c7b7ab2998ff5165ed4c1e163b21b5faaaa /src/ctor.h
parent0008920eed996009068fe9f71512c436577b6220 (diff)
Create sources from string_views instead of const char* and std::strings.develop
Diffstat (limited to 'src/ctor.h')
-rw-r--r--src/ctor.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ctor.h b/src/ctor.h
index 3b64cb5..8204f70 100644
--- a/src/ctor.h
+++ b/src/ctor.h
@@ -54,15 +54,13 @@ enum class arch
struct source
{
- source(const char* file) : file(file) {}
- source(const std::string& file) : file(file) {}
- source(const char* file, ctor::language lang) : file(file), language(lang) {}
- source(const std::string& file, ctor::language lang) : file(file), language(lang) {}
-
- source(const char* file, const char* output) : file(file), output(output) {}
- source(const std::string& file, const std::string& output) : file(file), output(output) {}
- source(const char* file, ctor::language lang, const char* output) : file(file), language(lang), output(output) {}
- source(const std::string& file, ctor::language lang, const std::string& output) : file(file), language(lang), output(output) {}
+ constexpr source(const char* file) : file(file) {} // convenience ctor
+
+ constexpr source(std::string_view file) : source(file, ctor::language::automatic) {}
+ constexpr source(std::string_view file, ctor::language lang) : file(file), language(lang) {}
+
+ constexpr source(std::string_view file, std::string_view output) : file(file), output(output) {}
+ constexpr source(std::string_view file, ctor::language lang, std::string_view output) : file(file), language(lang), output(output) {}
std::string file;
ctor::language language{ctor::language::automatic};