44template <
typename... Tp>
45struct source_location_constant_char;
48struct source_location_constant_char<>
50 static constexpr bool value =
true;
54struct source_location_constant_char<const char*>
56 static constexpr bool value =
true;
60struct source_location_constant_char<Tp>
62 static constexpr bool value = std::is_same<Tp, const char*>::value;
65template <
typename Tp,
typename Up,
typename... Tail>
66struct source_location_constant_char<Tp, Up, Tail...>
68 static constexpr bool value = source_location_constant_char<Tp>::value &&
69 source_location_constant_char<Up>::value &&
70 source_location_constant_char<Tail...>::value;
85 template <
typename... Tp>
86 static constexpr bool is_constant_char()
88 return impl::source_location_constant_char<decay_t<Tp>...>::value;
116 : m_result(
std::move(_result))
125 template <
typename... ArgsT,
enable_if_t<(
sizeof...(ArgsT) > 0),
int> = 0>
156 template <
typename... ArgsT,
enable_if_t<
sizeof...(ArgsT) == 0,
int> = 0>
172 template <
typename... ArgsT>
174 const char* _fname, ArgsT&&...
_args)
177 std::forward<ArgsT>(
_args)... };
178 return _loc.get_captured(std::forward<ArgsT>(
_args)...);
188 template <
typename... ArgsT,
enable_if_t<!is_constant_char<ArgsT...>(),
int> = 0>
207 template <
typename... ArgsT,
enable_if_t<is_constant_char<ArgsT...>(),
int> = 0>
218 auto&& _label = _arg;
226 auto&& _label = _join(_arg.c_str());
236 auto&& _label = _join(_arg.c_str());
260 void compute_data(
const char* _func,
int _line,
const char* _fname,
bool shorten)
262#if defined(TIMEMORY_WINDOWS)
263 static const char delim =
'\\';
265 static const char delim =
'/';
270 if(_filename.find(delim) != std::string::npos)
271 _filename = _filename.substr(_filename.find_last_of(delim) + 1);
276 if(_filename.length() > 0)
287 if(_filename.length() > 0)
303 enable_if_t<(
sizeof...(ArgsT) > 0) && !is_constant_char<ArgsT...>(),
int> = 0>
306 return m_captured.set(*
this, std::forward<ArgsT>(
_args)...);
317 enable_if_t<(
sizeof...(ArgsT) > 0) && is_constant_char<ArgsT...>(),
int> = 0>
331 return (strcmp(_arg,
"") == 0) ? m_prefix
342template <size_t, size_t,
typename... Args>
344get_static_source_location(Args&&... args)
346 static source_location _instance{ std::forward<Args>(args)... };
357template <
size_t LineN,
size_t CountN,
typename... Args>
359get_static_source_location(Args&&... args)
361 return internal::get_static_source_location<LineN, CountN>(
362 std::forward<Args>(args)...);
Provides source location information and variadic joining of source location tags.
static captured get_captured_inline(const mode &_mode, const char *_func, int _line, const char *_fname, ArgsT &&... _args)
source_location(const source_location &)=delete
source_location(source_location &&)=default
source_location & operator=(source_location &&)=default
mpl::apply< std::string > join_type
void compute_data(const char *_func, int _line, const char *_fname, bool shorten)
void compute_data(const char *_func)
~source_location()=default
const captured & get_captured() const
const captured & get_captured(ArgsT &&... _args)
std::tuple< std::string, size_t > result_type
source_location & operator=(const source_location &)=delete
source_location(const mode &_mode, const char *_func, int _line, const char *_fname, ArgsT &&... _args)
source_location(const mode &_mode, const char *_func, int _line, const char *_fname, ArgsT &&...)
const captured & get_captured(ArgsT &&...)
hash_value_t add_hash_id(hash_map_ptr_t &_hash_map, string_view_cref_t _prefix)
add an string to the given hash-map (if it doesn't already exist) and return the hash
auto join(const char *sep, Arg &&arg, Args &&... args)
std::array< char *, 4 > _args
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
tim::mpl::apply< std::string > string
void consume_parameters(ArgsT &&...)
char const std::string const std::string & _suffix
const std::string & get_id() const
const hash_value_t & get_hash() const
friend class source_location
const result_type & get() const
captured(result_type _result)