#Parameter packs and non-deducible template parameters.

18 messages · Page 1 of 1 (latest)

calm willowBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

void raven
#

Idk where to even look on cpp reference for this, any explanation is aprecaited

#

Here's a proper MRE

enum class Level
    {
        Trace,
        Debug,
        Log,
        Warn,
        Fatal
    };

    void logFormatted(Level, const std::source_location&, std::string);

    template<Level L, class... T>
    struct betterLogger
    {
        betterLogger(
            fmt::format_string<T...> fmt,
            T&&... args,
            const std::source_location location =
                std::source_location::current()
        )
        {
            logFormatted(
                L, location, fmt::vformat(fmt, fmt::make_format_args(args...))
            );
        }
    };
    template<Level L, class... T>
    betterLogger(fmt::format_string<T...>, T&&...) -> betterLogger<L, T...>;
error: deduction guide template contains a template parameter that cannot be deduced
    betterLogger(fmt::format_string<T...>, T&&...) -> betterLogger<L, T...>;
    ^
note: non-deducible template parameter 'L'
    template<Level L, class... T>
                   ^
calm willowBOT
#

@void raven

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

void raven
#

hopefully its obvious what I'm trying to do here, however I'm stuck

#

@snow zodiac

I tried to do the think you mentioned and I'm not sure how to get the parameter packs working

snow zodiac
#

I will be online after ~3 hours

void raven
#

thanks,

#

also I figured it out

#

this is partial template specification and C++ doesnt have it

#

so my origonaly sketchy ~30 line macro was the best way to do it 😄

calm willowBOT
#

@void raven Has your question been resolved? If so, run !solved :)

void raven
#

!solved

calm willowBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

void raven
#

how the fuck does wheately know when questions are solved

#

its kinda creepy ngl

snow zodiac
#

it's ez - the author of the thread is the last message in the thread, X minutes pass, no other users respond , and thus the bot dumps the message

#

at least I assume