Hi Basile,
Thank you for your code, it allowed me to grasp a little bit more
about how to do things in D.
Vincent
On Monday, 7 November 2016 at 23:03:32 UTC, Picaud Vincent wrote:
I need:
1/ a way to detect compile-time constant vs "dynamic" values
/**
* Indicates if something is a value known at compile time.
*
* Params:
* V = The value to test.
* T = Optional, the expected value type.
On Monday, 7 November 2016 at 23:07:27 UTC, Picaud Vincent wrote:
typo...
auto capacity = max(0,(size_-1)*stride_+1);
To be more correct I have something like:
alias IntergralConstant!(int,0) Zero_c;
alias IntergralConstant!(int,1) One_c;
auto capacity =
On Monday, 7 November 2016 at 22:18:56 UTC, Jerry wrote:
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent
wrote:
static if ( isIntegralConstant!(typeof(required_capacity())
)
{
}
else
{
}
}
Premature post send by error sorry Well something like:
static if (
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent wrote:
static if ( isIntegralConstant!(typeof(required_capacity()) )
{
}
else
{
}
}
Premature post send by error sorry Well something like:
static if ( isIntegralConstant!(typeof(required_capacity()) )
On Monday, 7 November 2016 at 21:23:37 UTC, Picaud Vincent wrote:
On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote:
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent
wrote:
template isIntegralConstant(ANY)
{
enum bool
On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote:
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent
wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant";
}
A bit more elegant way of doing that would be:
enum
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant";
}
A bit more elegant way of doing that would be:
enum isIntegralConstant(T) = is(T : IntegralConstant!U, U...);