Skip to content

Error: '<function-style-cast>': cannot convert from 'const std::string' to 'T' #19

@a2nath

Description

@a2nath
struct MyArgs : public argparse::Args
{
    size_t& test = kwarg("-t", "test");
};

What's wrong with this? Why am I forced to use int or unsigned int instead of size_t?

Here's the definition of size_t on Windows

// Definitions of common types
#ifdef _WIN64
    typedef unsigned __int64 size_t;
    typedef __int64          ptrdiff_t;
    typedef __int64          intptr_t;
#else
    typedef unsigned int     size_t;
    typedef int              ptrdiff_t;
    typedef int              intptr_t;
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions