Hi,
Is there an easy way to pretty-print a struct which also includes
arrays?
pretty_array does a very good job for arrays.
ZZ
On Wednesday, 30 March 2022 at 12:46:07 UTC, Vijay Nayar wrote:
Consider the following code example:
```d
import std.stdio;
void main()
{
alias DelegateT = string delegate();
// An array of delegates, each has their own scope.
DelegateT[] funcs;
foreach (i; ["ham", "cheese"]) {
//
On Wednesday, 30 March 2022 at 04:15:24 UTC, Paul Backus wrote:
Probably the easiest way is to split it into two functions
```d
void f()
{
version (foo)
fVersionFoo();
else
fDefault();
}
void fVersionFoo()
{
/* ... */
}
void fDefault()
{
/* ... */
}
```
Then yo
On Wednesday, 30 March 2022 at 12:56:39 UTC, Vijay Nayar wrote:
On Wednesday, 30 March 2022 at 12:53:10 UTC, vit wrote:
use two delegates :)
```d
(){
// Deliberately create a copy to keep in delegate scope.
string myStr = i.dup;
// The
On Wednesday, 30 March 2022 at 12:53:10 UTC, vit wrote:
use two delegates :)
```d
(){
// Deliberately create a copy to keep in delegate scope.
string myStr = i.dup;
// The delegate will hopefully carry this copy around in its
own scope.
On Wednesday, 30 March 2022 at 12:46:07 UTC, Vijay Nayar wrote:
Consider the following code example:
```d
import std.stdio;
void main()
{
alias DelegateT = string delegate();
// An array of delegates, each has their own scope.
DelegateT[] funcs;
foreach (i; ["ham", "cheese"]) {
//
Consider the following code example:
```d
import std.stdio;
void main()
{
alias DelegateT = string delegate();
// An array of delegates, each has their own scope.
DelegateT[] funcs;
foreach (i; ["ham", "cheese"]) {
// Deliberately create a copy to keep in delegate scope.
string