Why is D unpopular, redux.

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat May 28 18:15:10 UTC 2022


On Saturday, 28 May 2022 at 17:32:04 UTC, IGotD- wrote:
> Folding in C++ is perhaps "powerful" but at the same time 
> unreadable.

I find it to be quite limited, but also confusing for the reader:

```
template<typename T, T... ints>
void f(std::integer_sequence<T, ints...> seq){
     std::cout << (ints - ...) << std::endl; // prints 3
     std::cout << (... - ints) << std::endl; // prints -5
     std::cout << (0 - ... - ints) << std::endl; // prints -7
     ((std::cout << ints), ...); // prints 124
}

int main()
{
     f(std::integer_sequence<int,1,2,4>{});
     return 0;
}

```





More information about the Digitalmars-d mailing list