On Tuesday, 19 December 2017 at 15:52:57 UTC, Dgame wrote:
On Tuesday, 19 December 2017 at 15:19:53 UTC, Marc wrote:
[...]
template FirstOf(T...) {
template otherwise(D) {
static if (T.length == 0) {
enum otherwise = D.init;
} else {
enum otherwise
On Tuesday, 19 December 2017 at 15:19:53 UTC, Marc wrote:
On Tuesday, 19 December 2017 at 00:01:00 UTC, Ali Çehreli wrote:
On 12/18/2017 03:54 PM, Ali Çehreli wrote:
On 12/18/2017 02:58 PM, Marc wrote:
Here's another experiment:
template FirstOf(T...) {
template otherwise(D) {
On Tuesday, 19 December 2017 at 00:01:00 UTC, Ali Çehreli wrote:
On 12/18/2017 03:54 PM, Ali Çehreli wrote:
On 12/18/2017 02:58 PM, Marc wrote:
Here's another experiment:
template FirstOf(T...) {
template otherwise(D) {
static if (T.length == 0) {
enum otherwise =
On 12/18/2017 03:54 PM, Ali Çehreli wrote:
On 12/18/2017 02:58 PM, Marc wrote:
Here's another experiment:
template FirstOf(T...) {
template otherwise(D) {
static if (T.length == 0) {
enum otherwise = D.init;
} else {
enum otherwise = T[0];
}
On 12/18/2017 02:58 PM, Marc wrote:
Imaginary code:
int index = FirstOrDefault!(int)(__traits(getAttributes, C.a));
In that case, if the tuple is empty, the value is the int's type default
value.
The method is defined as following:
template FirstOrDefault(X)(T...) {
static
Imaginary code:
int index = FirstOrDefault!(int)(__traits(getAttributes, C.a));
In that case, if the tuple is empty, the value is the int's type
default value.
The method is defined as following:
template FirstOrDefault(X)(T...) {
static if(T.length > 0) {
enum