Problem is that copy initialization is less permissive than direct initialization:
> In addition, the implicit conversion in copy-initialization must produce T
directly from the initializer, while, e.g. direct-initialization expects
an implicit conversion from the initializer to an argument of T's constructor.
as initialization from int
requires 2 conversions (from int
to Row<int>
and from Row<int>
to Row<Row<int>>
), direct initialization allows it but copy initialization does not. You can see it in documentation example as well:
struct S { S(std::string) {} }; // implicitly convertible from std::string
S s("abc"); // OK: conversion from const char[4] to std::string
S s = "abc"; // Error: no conversion from const char[4] to S
S s = "abc"s; // OK: conversion from std::string to S
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…