Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译报错 #8

Open
epic-hans opened this issue May 22, 2021 · 1 comment
Open

编译报错 #8

epic-hans opened this issue May 22, 2021 · 1 comment

Comments

@epic-hans
Copy link

template<typename Command, typename T>
inline void bind_field(Command& command, size_t index, T& value)
{
bind_field(command, index, std::forward(value));
}
template<typename Command, typename T>
inline void bind_field(Command& command, const char* name, T& value)
{
size_t index=command.find_field(name);
if(index==-1)
value=T();
else
bind_field(command, index, std::forward(value));
}

//! 下面编译报错,编译器不知道该使用上面哪个模板进行实例化!
template<>
inline void bind_record<qtl::mysql::statement, TestMysqlRecord>(qtl::mysql::statement& command, TestMysqlRecord&& v)
{
qtl::bind_field(command, 0, v.id);
}

@znone
Copy link
Owner

znone commented May 22, 2021

这样写:

qtl::bind_field(command, size_t(0), v.id);

0可能会被当作整数或指针。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants