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 = max(Zero_c,(size_-One_c)*stride_+One_c
typo...
auto capacity = max(0,(size_-1)*stride_+1);
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 ( isIntegralCons
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()) )
ElementType[requir
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
isIntegralConstant=__traits(identifier,ANY)=="IntegralCo
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...);
Hi all,
I have ~15y of C++ and now I want to test D, because it seems
really intersting and "cleaner" than C++.
As an exercice I m trying to implement something equivalent to
the C++ std::integral_constant in D.
In D:
struct IntegralConstant(T, T VALUE) {
...
}
But I do not know how to w
10 matches
Mail list logo