On 2019-09-06 11:14, Andrew Edwards wrote:
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d) {
a = _a;
b = _b;
c = _c;
d = _d;
}
float operator[
On Saturday, 7 September 2019 at 11:22:09 UTC, Maximillian wrote:
Please could you tell what "goto case;" do here?
I see now "fall-through" [1].
To be honest I like this feature in C and I was sad it didn't
work in D, at least now I know how to solve it. :)
Max.
[1] https://dlang.org/spec/
On Friday, 6 September 2019 at 18:31:29 UTC, Ali Çehreli wrote:
...
void enforceMemberWiseEquality(Demo d, const(float)[] values)
{
switch (values.length) {
case 4:
assert(d.d == values[3]);
goto case;
case 3:
assert(d.c == values[2]);
goto case;
case
On Friday, 6 September 2019 at 18:31:29 UTC, Ali Çehreli wrote:
On 09/06/2019 02:14 AM, Andrew Edwards wrote:
> I'm seeking some pointers on how to define these in D
Here is my attempt:
Ali, this is awesome. It solves all 4 problems in on shot. I
definitely don't intend on using the undefin
On Friday, 6 September 2019 at 18:39:47 UTC, Andrew Edwards wrote:
also probably u can do https://run.dlang.io/is/WMQE93
Ended up using this since it provides for named access and
solves the overloading requirement.
Thanks,
Andrew
You can also use std.typecons.Tuple for this, since it prov
On Friday, 6 September 2019 at 11:35:59 UTC, a11e99z wrote:
https://dlang.org/spec/simd.html
This didn't work two well because I wont be able to access the
members by name as C++ library expects. Will consider during
refactoring.
also probably u can do https://run.dlang.io/is/WMQE93
End
On 09/06/2019 02:14 AM, Andrew Edwards wrote:
> I'm seeking some pointers on how to define these in D
Here is my attempt:
struct Demo {
// NOTE: The types and number of elements can be templatized and
mixed-in like
// mixin (makeMembers!T(N));
float a = 0;
float b = 0;
float c = 0;
On Friday, 6 September 2019 at 09:28:57 UTC, Andrew Edwards wrote:
This is my thought on how to accomplish op overloading:
struct Test
{
float a, b, c, d;
float opIndex(size_t i)
in(i >= 0 && i <= 3)
{
final switch(i)
{
case 0: return a;
ca
On Friday, 6 September 2019 at 09:14:31 UTC, Andrew Edwards wrote:
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d) {
a = _a;
b = _b;
On Friday, 6 September 2019 at 09:49:33 UTC, Johan Engelen wrote:
On Friday, 6 September 2019 at 09:14:31 UTC, Andrew Edwards
wrote:
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d
On Friday, 6 September 2019 at 09:14:31 UTC, Andrew Edwards wrote:
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d) {
a = _a;
b = _b;
On Friday, 6 September 2019 at 09:14:31 UTC, Andrew Edwards wrote:
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d) {
a = _a;
b = _b;
C++ allows the for following:
struct Demo
{
float a, b, c, d;
Demo() { a = b = c = d = 0.0f; }
Demo(float _a, float _b, float _c, float _d) {
a = _a;
b = _b;
c = _c;
d = _d;
}
float operator[]
13 matches
Mail list logo