Description

tools for wrapping and unwrapping storage classes such as ref

Package Information

Version0.1.1 (2014-Sep-30)
Repositoryhttps://github.com/John-Colvin/StorageClassUtils
LicenseBSL-1.0
AuthorsJohn Colvin
Registered byJohn Colvin
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

StorageClassUtils

Storage classes are irritating to work with in D. This might help.

Use it like this:

void f(ref int a, lazy double e, S s) {}
alias wrappedParams = SCWrappedParameterTypeTuple!f;

// pass around and manipulate that parameter list however you like,
// the storage classes aren't going anywhere.

//fish out the base type from a wrapped param
alias secondArgsT = wrappedParams[1].base;

// to get the unwrapped list back again:
alias unwrapped = UnwrapStorageClasses!(wrappedParams);
// which should be identical to what you would get from
// std.traits.ParameterTypeTuple

A use case:

struct S(TL ...)
{
    void f(UnwrapStorageClasses!TL p){}
}

S!(RefSC!int, float, ScopeSC!FD) s;

//s.f takes parameters (ref int, float, scope FD)

Available versions

0.1.1 ~master