Skip to content

Commit

Permalink
msvc type fix 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dakka committed Jun 7, 2024
1 parent fbe047b commit 181b330
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/srcloctest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int main(int argc, char **argv)
"7. types in named and anonymous namespaces",
conjure_type<Foo>::tpeek(),
conjure_type<Namespace::Namespace_Foo>::tpeek(),
conjure_type<Anon_Foo>::tpeek(),
conjure_type<Anon_Foo>::tpeek(), "",
"8. other types",
conjure_type<int>::tpeek(),
conjure_type<std::string_view>::tpeek(),
Expand Down
17 changes: 9 additions & 8 deletions include/fix8/conjure_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class cs
{ "e = ", ';', "<unnamed>", '<' }, { "T = ", ']', "{anonymous}", '{' },
#elif defined _MSC_VER
{ "epeek<", '>', "`anonymous-namespace'", '`' }, { "::tpeek", '<', "`anonymous-namespace'::", '`' },
{ "", '\0', "enum ", '\0' }, { "", '\0', "class ", '\0' },
{ "", '\0', "enum ", '\0' }, { "", '\0', "class ", '\0' }, { "", '\0', "struct ", '\0' },
//{ "epeek<", '>', "`anonymous-namespace'", '`' }, { "enum ", '>', "enum `anonymous-namespace'", '`' }, { "class ", '>', "", 0 },
#else
# error "conjure_enum not supported by your compiler"
Expand All @@ -113,7 +113,7 @@ class cs
cs(cs&&) = delete;
cs& operator=(cs&&) = delete;

enum class stype { enum_t, type_t, extype_t0, extype_t1 };
enum class stype { enum_t, type_t, extype_t0, extype_t1, extype_t2 };
enum class sval { start, end, anon_str, anon_start };

template<sval N, stype V> // can't have constexpr decompositions! (but why not?)
Expand Down Expand Up @@ -749,12 +749,13 @@ class conjure_type
if constexpr (constexpr auto lc { from.find_first_of(cs::get_spec<sval::end,stype::type_t>()) }; lc != std::string_view::npos)
{
constexpr std::string_view e1 { from.substr(lc, ep - lc - 1) };
if constexpr (constexpr auto ep1 { e1.find(cs::get_spec<sval::anon_str,stype::type_t>()) }; ep1 != std::string_view::npos)
return e1.substr(ep1 + cs::get_spec<sval::anon_str,stype::type_t>().size(), e1.size() - ep1 - cs::get_spec<sval::anon_str,stype::type_t>().size());
if constexpr (constexpr auto ep1 { e1.find(cs::get_spec<sval::anon_str,stype::extype_t0>()) }; ep1 != std::string_view::npos)
return e1.substr(ep1 + cs::get_spec<sval::anon_str,stype::extype_t0>().size(), e1.size() - ep1 - cs::get_spec<sval::anon_str,stype::extype_t0>().size());
if constexpr (constexpr auto ep1 { e1.find(cs::get_spec<sval::anon_str,stype::extype_t1>()) }; ep1 != std::string_view::npos)
return e1.substr(ep1 + cs::get_spec<sval::anon_str,stype::extype_t1>().size(), e1.size() - ep1 - cs::get_spec<sval::anon_str,stype::extype_t1>().size());
#define _chkstr(x) \
if constexpr (constexpr auto ep1 { e1.find(cs::get_spec<sval::anon_str,stype::x>()) }; ep1 != std::string_view::npos) \
return e1.substr(ep1 + cs::get_spec<sval::anon_str,stype::x>().size(), e1.size() - ep1 - cs::get_spec<sval::anon_str,stype::x>().size())
_chkstr(type_t);
_chkstr(extype_t0);
_chkstr(extype_t1);
_chkstr(extype_t2);
}
return {};
}
Expand Down

0 comments on commit 181b330

Please sign in to comment.