View source code Display the source code in std/conv.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.conv.to_impl - multiple declarations

Function toImpl

Convert a value that is implicitly convertible to the enum base type into an Enum value. If the value does not match any enum member values a ConvException is thrown. Enums with floating-point or string base types are not supported.

Prototype

T toImpl(T, S)(
  S value
)
if (is(T == enum) && !is(S == enum) && is(typeof(value == OriginalType!T.init)) && !isFloatingPoint!(OriginalType!T) && !isSomeString!(OriginalType!T));

Function toImpl

String to non-string conversion runs parsing.

Prototypes

T toImpl(T, S)(
  S value
)
if (isExactSomeString!S && isDynamicArray!S && !isExactSomeString!T && is(typeof(parse!T(value))));

T toImpl(T, S)(
  S value,
  uint radix
)
if (isExactSomeString!S && isDynamicArray!S && !isExactSomeString!T && is(typeof(parse!T(value, radix))));

Function toImpl

Associative array to associative array conversion converts each key and each value in turn.

Prototype

T toImpl(T, S)(
  S value
)
if (isAssociativeArray!S && isAssociativeArray!T && !is(T == enum));

Function toImpl

Array-to-array conversion (except when target is a string type) converts each element in turn by using to.

Prototype

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && !isSomeString!S && isDynamicArray!S && !isExactSomeString!T && isArray!T);

Function toImpl

Narrowing numeric-numeric conversions throw when the value does not fit in the narrower type.

Prototype

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && (isNumeric!S || isSomeChar!S || isBoolean!S) && (isNumeric!T || isSomeChar!T || isBoolean!T) && !is(T == enum));

Function toImpl

Stringize conversion from all types is supported.

Prototypes

T toImpl(T, S)(
  S value
)
if (!(isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) && !isNullToStr!(S, T)) && !isInfinite!S && isExactSomeString!T);

T toImpl(T, S)(
  S value,
  uint radix,
  LetterCase letterCase = LetterCase.upper
) pure @trusted
if (isIntegral!S && isExactSomeString!T);

Function toImpl

Object-to-object conversions by dynamic casting throw exception when the source is non-null and the target is null.

Prototype

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && (is(S == class) || is(S == interface)) && !is(typeof(value.opCast!T()) : T) && (is(T == class) || is(T == interface)) && !is(typeof(new T(value))));

Function toImpl

When target type supports 'converting construction', it is used.

Prototypes

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && is(T == struct) && is(typeof(T(value))));

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && is(T == class) && is(typeof(new T(value))));

Function toImpl

When source type supports member template function opCast, it is used.

Prototype

T toImpl(T, S)(
  S value
)
if (!isImplicitlyConvertible!(S, T) && is(typeof(S.init.opCast!T()) : T) && !isExactSomeString!T && !is(typeof(T(value))));

Function toImpl

If the source type is implicitly convertible to the target type, to simply performs the implicit conversion.

Prototype

T toImpl(T, S)(
  S value
)
if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) && !isNullToStr!(S, T));

Authors

Walter Bright, Andrei Alexandrescu, Shin Fujishiro, Adam D. Ruppe, Kenji Hara

License

Boost License 1.0.

Comments