我有一个使用ButterKnife注释的RecycleView.ViewHolder类.
我的代码也应该在这个ViewHolder类中unbind()吗?
public class AView extends RecyclerView.ViewHolder
{
@BindView(R.id.a_text_view) TextView aText;
public AView(final View view)
{
super(view);
ButterKnife.bind(this, view); // It returns an Unbinder, but where should I call its unbind()?
}
}
Run Code Online (Sandbox Code Playgroud)
文档(http://jakewharton.github.io/butterknife/)没有讨论这个问题.
android android-layout butterknife android-viewholder android-recyclerview
我已经阅读了std::is_constant_evaluated()
定义,但是我仍然不确定为什么(1)无法在最新的GCC上运行:error: 'x' is not a constant expression
template<auto v>
struct s
{};
constexpr void f(int x)
{
if (std::is_constant_evaluated())
{
// constexpr int z=x; (1)
// s<x> a; (2)
}
}
int main(int argc, char* argv[])
{
f(4);
//f(argc);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
随着分支 std::is_constant_evaluated()
更新
我可以将“解释性”信息“传输”到函数中吗?基本上决定f()
是否使用constexpr
x 进行调用。
UPDATE 关于我要实现的目标的一个更复杂的示例:如果可能,此示例应在编译时对参数进行字符串化。
template<auto v>
struct dummy_stringify
{
static constexpr auto str=v==4 ? "4" : "31"; // this is just …
Run Code Online (Sandbox Code Playgroud)