type-only-instantiation.dhover×118all
#!/usr/bin/env dub
/+ dub.sdl:
    name "property_tree_type_only_instantiation"
    targetPath "build"
    dflags "-preview=in" "-preview=dip1000"
    buildType "checked" {
        buildOptions "optimize" "inline" "debugInfo"
    }
+/
/// [`type-only-instantiation.d`](./type-only-instantiation.d) — is the CTFE limit about RECURSION, or about PATH-PARAMETERISED
/// INSTANTIATION? Same walk, type-only template parameters, evaluated at CTFE.
module 
(module) property_tree_type_only_instantiation

type-only-instantiation.d — is the CTFE limit about RECURSION, or about PATH-PARAMETERISED INSTANTIATION? Same walk, type-only template parameters, evaluated at CTFE.

property_tree_type_only_instantiation
;
import
(package) std
std
.
(module) std.traits

Templates which extract information about types and symbols at compile time.

Category Templates
Symbol Name traits fullyQualifiedName mangledName moduleName packageName
Function traits isFunction arity functionAttributes hasFunctionAttributes functionLinkage FunctionTypeOf isSafe isUnsafe isFinal ParameterDefaults ParameterIdentifierTuple ParameterStorageClassTuple Parameters ReturnType SetFunctionAttributes variadicFunctionStyle
Aggregate Type traits BaseClassesTuple BaseTypeTuple classInstanceAlignment EnumMembers FieldNameTuple Fields hasAliasing hasElaborateAssign hasElaborateCopyConstructor hasElaborateDestructor hasElaborateMove hasIndirections hasMember hasStaticMember hasNested hasUnsharedAliasing InterfacesTuple isInnerClass isNested MemberFunctionsTuple RepresentationTypeTuple TemplateArgsOf TemplateOf TransitiveBaseTypeTuple
Type Conversion CommonType AllImplicitConversionTargets ImplicitConversionTargets CopyTypeQualifiers CopyConstness isAssignable isCovariantWith isImplicitlyConvertible isQualifierConvertible
Type Constructors InoutOf ConstOf SharedOf SharedInoutOf SharedConstOf SharedConstInoutOf ImmutableOf QualifierOf
Categories of types allSameType ifTestable isType isAggregateType isArray isAssociativeArray isAutodecodableString isBasicType isBoolean isBuiltinType isCopyable isDynamicArray isEqualityComparable isFloatingPoint isIntegral isNarrowString isConvertibleToString isNumeric isOrderingComparable isPointer isScalarType isSigned isSIMDVector isSomeChar isSomeString isStaticArray isUnsigned
Type behaviours isAbstractClass isAbstractFunction isCallable isDelegate isExpressions isFinalClass isFinalFunction isFunctionPointer isInstanceOf isIterable isMutable isSomeFunction isTypeTuple
General Types ForeachType KeyType Largest mostNegative OriginalType PointerTarget Signed Unconst Unshared Unqual Unsigned ValueType Promoted
Misc lvalueOf rvalueOf Select select
User-Defined Attributes hasUDA getUDAs getSymbolsByUDA

Source

std/traits.d

@copyrightCopyright The D Language Foundation 2005 - 2009.@licenseBoost License 1.0.@authorsWalter Bright, Tomasz Stachowiak (isExpressions), Andrei Alexandrescu, Shin Fujishiro, Robert Clipsham, David Nadlinger, Kenji Hara, Shoichi Kato
traits
:
(alias template) property_tree_type_only_instantiation.FieldNameTuple = std.traits.FieldNameTuple(T)

Get as an expression tuple the names of the fields of a struct, class, or union. This consists of the fields that take up memory space, excluding the hidden fields like the virtual function table pointer or a context pointer for nested types. Inherited fields (for classes) are not included. If T isn't a struct, class, interface or union, an expression tuple with an empty string is returned.

@history
  • Returned AliasSeq!"" for interfaces prior to 2.097

FieldNameTuple
,
(alias template) property_tree_type_only_instantiation.Fields = std.traits.Fields(T)

Get as a tuple the types of the fields of a struct, class, or union. This consists of the fields that take up memory space, excluding the hidden fields like the virtual function table pointer or a context pointer for nested types. If T isn't a struct, class, interface or union returns a tuple with one element T.

@history
  • Returned AliasSeq!(Interface) for interfaces prior to 2.097

Fields
,
(alias template) property_tree_type_only_instantiation.isAggregateType = std.traits.isAggregateType(T)

Detect whether type T is an aggregate type.

isAggregateType
,
(alias template) property_tree_type_only_instantiation.isPointer = std.traits.isPointer(T)

Detect whether type T is a pointer.

isPointer
,
(alias template) property_tree_type_only_instantiation.isSomeString = std.traits.isSomeString(T)

Detect whether T is one of the built-in string types.

The built-in string types are Char[], where Char is any of char, wchar or dchar, with or without qualifiers.

Static arrays of characters (like char[80]) are not considered built-in string types.

isSomeString
,
(alias template) property_tree_type_only_instantiation.PointerTarget = std.traits.PointerTarget(T : T*)

Returns the target type of a pointer.

PointerTarget
;
struct
(struct) property_tree_type_only_instantiation.Row
Row
{
(alias) object.string = string
string
(field) string property_tree_type_only_instantiation.Row.path
path
;
(alias) object.string = string
string
(field) string property_tree_type_only_instantiation.Row.type
type
; int
(field) int property_tree_type_only_instantiation.Row.depth
depth
; bool
(field) bool property_tree_type_only_instantiation.Row.cut
cut
; }
/// Type-only template parameter; depth/prefix are RUNTIME (hence CTFE) values.
(struct) property_tree_type_only_instantiation.Row
Row
[]
property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node)(string prefix, int depth, int maxDepth) pure nothrow @safe

Type-only template parameter; depth/prefix are RUNTIME (hence CTFE) values.

plan
(T)(
(alias) object.string = string
string
(parameter) string prefix
prefix
, int
(parameter) int depth
depth
, int
(parameter) int maxDepth
maxDepth
) pure nothrow
{
(struct) property_tree_type_only_instantiation.Row
Row
[]
(local variable) property_tree_type_only_instantiation.Row[] rows
rows
;
static foreach (i, name;
(constant) string property_tree_type_only_instantiation.Node.fun!(label).NameOf = "label"
FieldNameTuple
!T)
{{ alias
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).F = string
F
=
(alias) std.traits.Fields!(property_tree_type_only_instantiation.Node) = (string, property_tree_type_only_instantiation.Vec2, property_tree_type_only_instantiation.Material, property_tree_type_only_instantiation.Node*)

Get as a tuple the types of the fields of a struct, class, or union. This consists of the fields that take up memory space, excluding the hidden fields like the virtual function table pointer or a context pointer for nested types. If T isn't a struct, class, interface or union returns a tuple with one element T.

Examples

import std.meta : AliasSeq;
struct S { int x; float y; }
static assert(is(Fields!S == AliasSeq!(int, float)));
@history
  • Returned AliasSeq!(Interface) for interfaces prior to 2.097

Fields
!
(alias) T = property_tree_type_only_instantiation.Node
T
[
(constant) ulong property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).i = 0LU
i
];
static if (
(template instance) std.traits.isPointer!string
isPointer
!
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).F = string
F
&&
(template instance) isAggregateType!(PointerTarget!F)
isAggregateType
!(
(alias) T = property_tree_type_only_instantiation.Node
PointerTarget
!
(unresolved type) F
F
))
alias
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).Target = property_tree_type_only_instantiation.Node
Target
=
(alias) T = property_tree_type_only_instantiation.Node
PointerTarget
!
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).F = property_tree_type_only_instantiation.Node*
F
;
else alias
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).Target = string
Target
=
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).F = string
F
;
enum
(constant) bool property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).leaf = true
leaf
=
(template instance) std.traits.isSomeString!string
isSomeString
!
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).Target = string
Target
|| !
(template instance) isAggregateType!Target
isAggregateType
!
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).Target = property_tree_type_only_instantiation.Vec2
Target
;
const
(local variable) const(string) path
path
=
(parameter) string prefix
prefix
.
(field) ulong string.length
length
?
(parameter) string prefix
prefix
~ "." ~ name :
(constant) string property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).name = "label"
name
;
static if (leaf)
(local variable) property_tree_type_only_instantiation.Row[] rows
rows
~=
(struct) property_tree_type_only_instantiation.Row
Row
(
(local variable) const(string) path
path
,
(darray) string
F
.
(constant) string string.stringof = "string"
stringof
,
(parameter) int depth
depth
, false);
else { const
(local variable) const(bool) cut
cut
=
(parameter) int depth
depth
+ 1 >=
(parameter) int maxDepth
maxDepth
;
(local variable) property_tree_type_only_instantiation.Row[] rows
rows
~=
(struct) property_tree_type_only_instantiation.Row
Row
(
(local variable) const(string) path
path
,
(struct) property_tree_type_only_instantiation.Vec2
F
.
(constant) string property_tree_type_only_instantiation.Vec2.stringof = "Vec2"
stringof
,
(parameter) int depth
depth
,
(local variable) const(bool) cut
cut
);
if (!
(local variable) const(bool) cut
cut
)
(local variable) property_tree_type_only_instantiation.Row[] rows
rows
~=
property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Vec2)(string prefix, int depth, int maxDepth) pure nothrow @safe

Type-only template parameter; depth/prefix are RUNTIME (hence CTFE) values.

plan
!
(alias) property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node).Target = property_tree_type_only_instantiation.Vec2
Target
(
(local variable) const(string) path
path
,
(parameter) int depth
depth
+ 1,
(parameter) int maxDepth
maxDepth
);
} }} return
(local variable) property_tree_type_only_instantiation.Row[] rows
rows
;
} struct
(struct) property_tree_type_only_instantiation.Vec2
Vec2
{ float
(field) float property_tree_type_only_instantiation.Vec2.x
x
= 0,
(field) float property_tree_type_only_instantiation.Vec2.y
y
= 0; }
struct
(struct) property_tree_type_only_instantiation.Material
Material
{
(alias) object.string = string
string
(field) string property_tree_type_only_instantiation.Material.name
name
;
(struct) property_tree_type_only_instantiation.Vec2
Vec2
(field) property_tree_type_only_instantiation.Vec2 property_tree_type_only_instantiation.Material.offset
offset
; }
struct
(struct) property_tree_type_only_instantiation.Node
Node
{
(alias) object.string = string
string
(field) string property_tree_type_only_instantiation.Node.label
label
;
(struct) property_tree_type_only_instantiation.Vec2
Vec2
(field) property_tree_type_only_instantiation.Vec2 property_tree_type_only_instantiation.Node.position
position
;
(struct) property_tree_type_only_instantiation.Material
Material
(field) property_tree_type_only_instantiation.Material property_tree_type_only_instantiation.Node.material
material
;
(struct) property_tree_type_only_instantiation.Node
Node
*
(field) property_tree_type_only_instantiation.Node* property_tree_type_only_instantiation.Node.parent
parent
; }
enum
(constant) property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.manifest = [Row("label", "string", 0, false), Row("position", "Vec2", 0, false), Row("position.x", "float", 1, false), Row("position.y", "float", 1, false), Row("material", "Material", 0, false), Row("material.name", "string", 1, false), Row("material.offset", "Vec2", 1, false), Row("material.offset.x", "float", 2, false), Row("material.offset.y", "float", 2, false), Row("parent", "Node*", 0, false), Row("parent.label", "string", 1, false), Row("parent.position", "Vec2", 1, false), Row("parent.position.x", "float", 2, false), Row("parent.position.y", "float", 2, false), Row("parent.material", "Material", 1, false), Row("parent.material.name", "string", 2, false), Row("parent.material.offset", "Vec2", 2, true), Row("parent.parent", "Node*", 1, false), Row("parent.parent.label", "string", 2, false), Row("parent.parent.position", "Vec2", 2, true), Row("parent.parent.material", "Material", 2, true), Row("parent.parent.parent", "Node*", 2, true)]
manifest
=
property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.plan!(property_tree_type_only_instantiation.Node)(string prefix, int depth, int maxDepth) pure nothrow @safe

Type-only template parameter; depth/prefix are RUNTIME (hence CTFE) values.

plan
!
(struct) property_tree_type_only_instantiation.Node
Node
("", 0, 3); // ← evaluated at COMPILE TIME
void
void D main()
main
()
{ import
(package) std
std
.
(module) std.stdio
Category Symbols
File handles _popen File isFileHandle openNetwork stderr stdin stdout
Reading chunks lines readf readfln readln
Writing toFile write writef writefln writeln
Misc KeepTerminator LockType StdioException

Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.

There are three layers of I/O:

  1. The lowest layer is the operating system layer. The two main schemes are Windows and Posix.

  2. C's stdio.h which unifies the two operating system schemes.

  3. std.stdio, this module, unifies the various stdio.h implementations into a high level package for D programs.

Source

std/stdio.d

@copyrightCopyright The D Language Foundation 2007-.@licenseBoost License 1.0.@authorsWalter Bright, Andrei Alexandrescu, Alex Rønne Petersen
stdio
:
(alias template) writefln = std.stdio.writefln(alias fmt, A...)(A args) if (isSomeString!(typeof(fmt)))

Equivalent to $(D writef(fmt, args, '\n')).

writefln
;
void std.stdio.writefln!(char, ulong, int)(in char[] fmt, ulong __param_1, int __param_2) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("CTFE manifest for a CYCLIC type: %s rows, %s cuts",
(constant) property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.manifest = [Row("label", "string", 0, false), Row("position", "Vec2", 0, false), Row("position.x", "float", 1, false), Row("position.y", "float", 1, false), Row("material", "Material", 0, false), Row("material.name", "string", 1, false), Row("material.offset", "Vec2", 1, false), Row("material.offset.x", "float", 2, false), Row("material.offset.y", "float", 2, false), Row("parent", "Node*", 0, false), Row("parent.label", "string", 1, false), Row("parent.position", "Vec2", 1, false), Row("parent.position.x", "float", 2, false), Row("parent.position.y", "float", 2, false), Row("parent.material", "Material", 1, false), Row("parent.material.name", "string", 2, false), Row("parent.material.offset", "Vec2", 2, true), Row("parent.parent", "Node*", 1, false), Row("parent.parent.label", "string", 2, false), Row("parent.parent.position", "Vec2", 2, true), Row("parent.parent.material", "Material", 2, true), Row("parent.parent.parent", "Node*", 2, true)]
manifest
.
(field) ulong [Row("label", "string", 0, false), Row("position", "Vec2", 0, false), Row("position.x", "float", 1, false), Row("position.y", "float", 1, false), Row("material", "Material", 0, false), Row("material.name", "string", 1, false), Row("material.offset", "Vec2", 1, false), Row("material.offset.x", "float", 2, false), Row("material.offset.y", "float", 2, false), Row("parent", "Node*", 0, false), Row("parent.label", "string", 1, false), Row("parent.position", "Vec2", 1, false), Row("parent.position.x", "float", 2, false), Row("parent.position.y", "float", 2, false), Row("parent.material", "Material", 1, false), Row("parent.material.name", "string", 2, false), Row("parent.material.offset", "Vec2", 2, true), Row("parent.parent", "Node*", 1, false), Row("parent.parent.label", "string", 2, false), Row("parent.parent.position", "Vec2", 2, true), Row("parent.parent.material", "Material", 2, true), Row("parent.parent.parent", "Node*", 2, true)].length
length
, () { int
(local variable) int n
n
; foreach (
(parameter) property_tree_type_only_instantiation.Row r
r
;
(constant) property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.manifest = [Row("label", "string", 0, false), Row("position", "Vec2", 0, false), Row("position.x", "float", 1, false), Row("position.y", "float", 1, false), Row("material", "Material", 0, false), Row("material.name", "string", 1, false), Row("material.offset", "Vec2", 1, false), Row("material.offset.x", "float", 2, false), Row("material.offset.y", "float", 2, false), Row("parent", "Node*", 0, false), Row("parent.label", "string", 1, false), Row("parent.position", "Vec2", 1, false), Row("parent.position.x", "float", 2, false), Row("parent.position.y", "float", 2, false), Row("parent.material", "Material", 1, false), Row("parent.material.name", "string", 2, false), Row("parent.material.offset", "Vec2", 2, true), Row("parent.parent", "Node*", 1, false), Row("parent.parent.label", "string", 2, false), Row("parent.parent.position", "Vec2", 2, true), Row("parent.parent.material", "Material", 2, true), Row("parent.parent.parent", "Node*", 2, true)]
manifest
)
(local variable) int n
n
+=
(local variable) property_tree_type_only_instantiation.Row r
r
.
(field) bool property_tree_type_only_instantiation.Row.cut
cut
; return
(local variable) int n
n
; }());
foreach (
(parameter) property_tree_type_only_instantiation.Row r
r
;
(constant) property_tree_type_only_instantiation.Row[] property_tree_type_only_instantiation.manifest = [Row("label", "string", 0, false), Row("position", "Vec2", 0, false), Row("position.x", "float", 1, false), Row("position.y", "float", 1, false), Row("material", "Material", 0, false), Row("material.name", "string", 1, false), Row("material.offset", "Vec2", 1, false), Row("material.offset.x", "float", 2, false), Row("material.offset.y", "float", 2, false), Row("parent", "Node*", 0, false), Row("parent.label", "string", 1, false), Row("parent.position", "Vec2", 1, false), Row("parent.position.x", "float", 2, false), Row("parent.position.y", "float", 2, false), Row("parent.material", "Material", 1, false), Row("parent.material.name", "string", 2, false), Row("parent.material.offset", "Vec2", 2, true), Row("parent.parent", "Node*", 1, false), Row("parent.parent.label", "string", 2, false), Row("parent.parent.position", "Vec2", 2, true), Row("parent.parent.material", "Material", 2, true), Row("parent.parent.parent", "Node*", 2, true)]
manifest
)
void std.stdio.writefln!(char, int, string, string, string, string)(in char[] fmt, int __param_1, string __param_2, string __param_3, string __param_4, string __param_5) @safe

Equivalent to writef(fmt, args, '\n').

writefln
("%*s%s : %s%s",
(local variable) property_tree_type_only_instantiation.Row r
r
.
(field) int property_tree_type_only_instantiation.Row.depth
depth
* 2, "",
(local variable) property_tree_type_only_instantiation.Row r
r
.
(field) string property_tree_type_only_instantiation.Row.path
path
,
(local variable) property_tree_type_only_instantiation.Row r
r
.
(field) string property_tree_type_only_instantiation.Row.type
type
,
(local variable) property_tree_type_only_instantiation.Row r
r
.
(field) bool property_tree_type_only_instantiation.Row.cut
cut
? " ⋯" : "");
}