On 6/15/25 9:06 AM, Steven Schveighoffer wrote:
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote:
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
A ref cannot be a member of a type. But ref can be returned by
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote:
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
```d
// Represents our Backtester engine
struct Engine
{
// It STORES a pointer to its data source. This is
On 6/9/25 11:16 PM, monkyyy wrote:
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote:
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
The hard part is the `foreach` the simple answer is throw a ref before
`v
On 6/10/25 2:17 AM, Ali Çehreli wrote:
On 6/9/25 12:24 AM, confuzzled wrote:
> Is it possible to accomplish the following using ref instead of
> pointers?
Your example is a good case for a pointer. Was there a reason why a
reference should be used?
Just exploring the realm of possibilities
On 6/9/25 12:24 AM, confuzzled wrote:
> Is it possible to accomplish the following using ref instead of
> pointers?
Your example is a good case for a pointer. Was there a reason why a
reference should be used?
Having said that, you can even drop the pointer and use a DataSource as-is:
struct
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote:
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
import std.stdio;
// Represents our large, external data source (like TimeSeries)
struct DataSource
{
int[3
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
import std.stdio;
// Represents our large, external data source (like TimeSeries)
struct DataSource
{
int[3] data;
}
// Represents our Backtester engine
struct Engin