storageclassutils 0.1.1

tools for wrapping and unwrapping storage classes such as ref


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

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)
Authors:
  • John Colvin
Dependencies:
none
Versions:
0.1.1 2014-Sep-30
~master 2014-Sep-30
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 198 downloads total

Score:
0.7
Short URL:
storageclassutils.dub.pm