repr 0.1
Reconstructable string representations and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
repr
Go to the documentation of this file.
#pragma once
#include <string>
#include <librepr/visit.h>
namespace librepr {
struct ReprWrapper {
template <typename T>
std::string operator()(T const& obj, Options options = {}) const {
// TODO this could be static once msvc supports it
auto visitor = ReprVisitor{options};
return visitor.result.extract();
}
};
enum class Language { CPP, Python };
template <typename T, Language language = Language::CPP>
if constexpr (language == Language::Python) {
return visitor.result.extract();
}
return visitor.result.extract();
}
template <typename T>
} // namespace librepr
inline constexpr ::librepr::ReprWrapper
repr{};
template <typename T>
inline constexpr ::librepr::TypeName<T> nameof{};