What other than a pointer can be converted implicitly to const(char)*?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Dec 21 09:03:00 PST 2015
On 21.12.2015 17:02, Shriramana Sharma wrote:
> The `static if` condition here says if something is a pointer and if it is
> implicitly convertible to const(char)*. The isPointer! part seems
> superfluous. Is there something that is not a pointer yet implicitly
> convertible to const(char)*?
A struct/class with an `alias this` to a `const(char)*`:
import std.traits: isPointer;
alias ptr this;
static assert(!isPointer!S && is(S : const(char)*)); /* passes */
More information about the Digitalmars-d-learn