-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmisc.hpp
More file actions
41 lines (33 loc) · 761 Bytes
/
misc.hpp
File metadata and controls
41 lines (33 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <concepts>
#include <stdexcept>
#include <string>
#include <seqan/sequence.h>
template <typename in_t>
std::string to_str(in_t && in)
{
return std::to_string(std::forward<in_t>(in));
}
template <typename in_t>
std::string to_str(in_t && in) requires std::constructible_from<std::string, in_t>
{
return std::string(std::forward<in_t>(in));
}
inline std::string to_str(char in)
{
return std::string{in};
}
inline std::string to_str(std::string in)
{
return in;
}
inline std::string to_str(seqan::CharString && in)
{
return seqan::toCString(in);
}
struct error : public std::runtime_error
{
template <typename... ts>
error(ts... what) : std::runtime_error{(to_str(std::forward<ts>(what)) + ...)}
{}
};