[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: C+somedogshit.png (313 KB, 1755x885)
313 KB PNG
Look how they massacred my boy.
Was a for loop to simple for you to understand?
>>
>>108912693
>Was a for loop to simple for you to understand?
It's in a race to the bottom with Rust.
>>
>Strongly typed language
>Look inside
>auto auto auto auto auto
>>
>>108912704
you would be terrified of ml
>>
>>108912704
i guess there's a danger that it's underparameterised
I like the approach ocaml takes where you can optionally add type annotations and then the language server adds hints for what types it assigns to fiunctions
>>
File: 7.png (224 KB, 1565x793)
224 KB PNG
all you needed was 5 built-in functions: for, if, else, assignment and addition
This code doesn't even need to link stdlib or any headers.
>>
File: not my problem.jpg (253 KB, 1500x1000)
253 KB JPG
>I'm too retarded to understand FP
>>
>>108912693
its interesting how jeets and zoomies shill cpp, C is king
>>
>>108912693
How are you supposed to program anything in a strong typed language?
>>
File: 0.png (180 KB, 524x977)
180 KB PNG
>>108912721
>*bitchslapped from the grave*
>>
>>108912720
>numsSize
>>
>>108912693
It's funny. In any other language, it would be quite readable and natural to write. So much of this is just ceremony.

I really wonder if the compiler has any chance to optimize all the bloat out of it. Probably, but only due to standard library compiler intrinsic magic that is also not guaranteed.

Seriously, just write the loop.
>>
>>108912693
who can look at this and not think it's incomprehensible garbage. i'd rather read rust.
>>
>>108912704
>doesn't understand strongly typed languages
>>
File: jeet.jpg (87 KB, 1357x758)
87 KB JPG
>>108912721
>saaaaar, you don't understand this smart FP!!
Imagine being a FPfag and finding out that's how most brown retards and even just regular procedural normies view your paradigm...
>>
>>108912743
Right here is the most important part
>A typical characteristic of the APL devotee is, for instance, his closeness to an implementation of it.
Take away their libs and what do rust and c++, haskell, lean programmers have? Meanwhile c programmers can write anything anywhere, link it with code written for a distant standard. Yet they still have the foresight and discipline required to make it correct.
>>
>>108912761
>who can look at this and not think it's incomprehensible garbage
Rust users, provided some minor syntactic alterations.
>>
>>108912721
Ok, count the function calls in the OP you have 10 minutes.
>>
>>108912693
Why is the vector<int> passed by copy here?
>>
>>108912693
Honestly, it was always shit, especially when std gets involved.
>>
>>108912807
your mom is an expert on std's
>>
>>108912704
and you need a fucking ide to display type hints...
progress in programming languages is clearly going backward, each new language is reintroducing non-sense like hidden type and/or inverting type declaration and variable name, just because how dude made a blogpost...
dumbfucks... no wonder C is gaining traction again...
>>
Wannabe Rust
>>
>>108913040
What's the dontwannabe rust? I'll use that.
>>
>>108912693
i can see a use for auto in some places but what the fucks the advantage of this vs
int maximum_count(std::vector<int> nums) {
>>
>>108913062
cause std::pair isn't an int
>>
>>108912693
I don't know C++
Why is it better to write auto ... -> int rather than just fucking int?
>>
>>108912780
The delusion is deep with this one
>>
>>108913105
so your shitty code doesn't crash when you get a type error.
>>
>>108912693
(list (length (filter positive? xs))
(length (filter negative? xs)))
>>
>>108912703
>>108912718
today's homework:
static typing (and type inference)
vs
dynamic typing (vs type inference)
vs
weak typing (vs dynamic typing)
vs
niggerlicious language semantics like type coercions in JavaScript
>>
>>108913130
>niggerlicious language semantics like type coercions in JavaScript
That is weak typing, retard. Your homework: do your homework first.
>>
>>108913109
I don't get it
>>
>>108913154
The mistake type tards always make is that they thing program space grows exponentially, rather than polynomially since humans don't write random programs, we write programs that are comprehensible to other humans. Therefore the friction of a type system isn't nearly as valuable as they claim. It's only necessary because they fail to use abstraction to the point that all your code is on a single screen.
>>
>>108912780
>Take away their libs and what do rust and c++, haskell, lean programmers have? Meanwhile c programmers can write anything anywsegmentation fault: core dumped
Duly noted.

>>108913105
It's for consistency. There are some cases where you have to use trailing return (e.g., when return type in a templated function depends on the types of its arguments). So you have to use it in some cases. So for style consistency it's recommended to use it everywhere.
>>
>>108913172
That is exactly correct and I'm sick and tired of sub-0 IQ cargo culting webtards not understanding this simple fact.
>>
>>108913109
"auto" is for runtime and not just for the compiler? Sounds like a good way to bloat your software.
>>
>>108912693
Can anyone explain why this isn't better?
int maximum_count(const std::vector<int>& nums) {
int positive = 0, negative = 0;
for (int num : nums) {
if (num > 0)
positive++;
else if (num < 0)
negative++;
}
return std::max(positive, negative);
}
>>
>>108912704
>>Strongly typed language
>>Look inside
python is a strongly typed language too, retard. strong typing ≠ static typing ≠ explicit typing
>>
File: 1751750064048371.png (447 KB, 627x637)
447 KB PNG
>>108912780
when i was writing avr code in C++ i had an LLM make the missing template libraries for me
>>
>>108913208
>
for (int num : nums)

god i hope this is a typo
>>
File: 1740101117665024.jpg (20 KB, 252x400)
20 KB JPG
>>108912693
I'm sorry Bjarne but I'm just going to keep writing C++11. You can't stop me.
>>
>>108912862
>no wonder C is gaining traction again...
you jest but if you use a debugger the difference is night and day. C just utterly mogs C++ because you can actually keep track of what the fuck is happening
>>
>>108913195
>auto" is for runtime
how could it possibly be for runtime, retard? C++ is a statically typed language. the compiler has to know the full type of every object after it's done going through the turing complete schizophrenic self mutilation that is the template and type inference system
>>
File: 1769731820823119.jpg (90 KB, 1280x720)
90 KB JPG
>>108912693
How did they manage to make it uglier than Rust?
>>
>>108913239
My god stack
go
odin
holy c
amd64
>>
>>108913226
>avr code in C++
you aren't supposed to use C++ stdlib heap junk on embedded systems...
>>
>>108913253
>you aren't supposed to use C++ stdlib heap junk
agree
>>
functional programming is mental illness, change my mind
>>
>>108913231
Some stuff in C++20 is good, like concepts and `if constexpr`. Just stick to a limited subset based on what you need, the problem is people throwing everything at the wall just because they can.
>>
>>108912703
theyre taking all the wrong things from rust
they should start by unfucking modules and build system
>>
>>108913228
what, you figure he should access the integers by reference? he isn't writing back so the machine code would be identical
>>
>>108913239
>C just utterly mogs C++ because you can actually keep track of what the fuck is happening
yeah, this is the most important feature of the language.
yes C isn't that close to the hardware but it does not really matter, most things are explicit so you can keep more things in your head without having to deal with layers of abstractions over a for-loop with gotchas for each layer or some shit.
>>
>>108912743
Is that letter for real?
It's beautiful.
>>
>>108913256
if you're using C++ on PC platforms with proper memory virtualization you might as well use the collections it has.
>>
>>108913295
It's a retarded troll (EWD), APL was taught on chalkboard for years before it entered a computer system.
>>
>>108913290
my biggest pain isn't the language, it's that so much logic is hidden in template soup that is very difficult to debug in practice. in C you just put a breakpoint where you want it and check what you fucked up directly.
>>
>>108912780
if you want to program applications for anything more complex than a microcontroller using C is just 99% reinventing the bicycle 1% actual useful work
>>
>>108913247
"Crash" literally means runtime.
>>
>>108913372
It doesn't "crash" in runtime because you see the error and fix it during compiling
>>
>>108913109
Bad code crashing is a good thing though. It helps you find errors and build better more maintainable software. Code that just carries on when its erroneous only causes bug to propagate and eventually leads to the project becoming unsalvageable. Its pretty concerning if the trend is to make even more languages enable sloppy code.
>>
>>108912790
0 because everything's inline substituted.
>>
>>108913372
the compiler crashes while interpreting a turing complete scripting language (the C++ type system)
>>
No one itt knows how auto works
>>
>>108912693
Who the fuck thought the auto type was a good idea in Sepples, of all languages? If you wanted dynamic typing, you'd use a dynamically typed language.
>>
>>108912704
not only that, it's auto-return type but then they specify it with the secondary arrow syntax
i will never understand modern sepplers
>>
>>108913618
Case in point: >>108913651
>dynamic typing
>>
>>108912720
This is way easier on the eyes than the C++ one
>>
>>108913618
Do you know how auto works?
Explain why decltype(auto) somehow allows "perfect forwarding" where a naked auto does not, explained only using the underlying formal mechanisms by which auto is specified.
>>
>>108913651
C++ is everything and the kitchen sink. Name a feature that C++ doesn't have, and even then it will be implemented in the future.
>>
>>108913452
See, you're thinking like a software developer when you should be thinking like a webshitter/vibecoder.
>>
File: file.png (315 KB, 2766x1114)
315 KB PNG
>>108912693
I have to admit, it's pretty impressive that the compiler is able to remove all the ceremony.
It even auto vectorizes it if allowed.

The code itself is fucking disgusting looking, of course. C++ is a vile monster.
>>
>>108913114
Thanks, senpai. Much more concise.
>>
the advantage of this over a for loop is that it is more composable (at least if it were a template over the input type)
>>
>>108913114
That doesn't do the same thing thoughbeit.
>>
>>108912693
Can someone just invent C with memory safety and classes bolted on for the normalfags so we can stop pretending C++ is good
>>
File: Java-Logo-700x394.png (26 KB, 700x394)
26 KB PNG
>>108914186
Someone did.
>>
>>108912743
>APL, the language that existed as an alternative math notation before being implemented for computers, can't be expressed on paper
Is Dijkstra actually retarded.
>>
>>108912693
sepple was a mistake
>>
>>108913695
This achieves the EXACT same same assembly output:
#include <vector>

int max_count(std::vector<int> nums) {
int pos = 0;
int neg = 0;
for (int num : nums) {
pos += (num > 0);
neg += (num < 0);
}
return std::max(pos, neg);
}

Just write code in a non-branching style.

I despise what you can do with C++. There's obviously a level of knowledge a professional in the industry is can be expected to know off the cuff. Core concepts introduced in C are an absolute. I'd argue concepts like "for each" and slices are also worth the effort of learning, but there's clearly a point at which it goes too far. There's a lot of syntax that solves problems that are too niche or too specific. I don't even fucking recognize C++ anymore. OP's code is niggerlicous.
>>
>>108914440
And actually I should have replaced the std::max function with
return (pos > neg) ? pos : neg;

because that's exactly what the function is actually doing. The standard library is absolutely fucked. Why the fuck would someone want 4 implementations for a function as simple as std::max. It just obfuscates what's actually happening and puts a massive mental burden on anyone who has to read that shit. Everything in the standard library is like that. Why the fuck would I want to spend a single second reading up on the nuances of something like std::accumulate to figure out which one is being called here.

I think overall iterators were a massive mistake and C++ will never recover from trying to implement them. They wanted a foreach syntax but were unable implement it into the language due to backwards compatibility and here we are. They could have just made a C++ 2 electric boogaloo, but no. They had to ruin what was.
>>
>>108914654
>It just obfuscates what's actually happening
Sounds like it computes… max
>>
>>108912693
Does everyone know you don't have to use this? It's an example made on purpose to be horrible. You can do this with literally EVERY language.

The intelligent people in the thread know this:
>>108913208
>>108914440

C++ is still the best language, lets you do everything, just like the English language. You don't have to be retarded, it's a choice.
>>
>>108914706
No, I can write my own compare function and make it compute min if I wanted to. Here's one of the possible implementations for std::max
template< class T, class Compare >
const T& max( const T& a, const T& b, Compare comp );

And yeah, I get it. It's there for more complicated user defined types, but at that point why even use the std::max template? Why not just use my own compare function directly? Why hide it behind a shitty interface? And then, if I remove the shitty interface implementations, why even have a max function in the standard library? Everything is like that in C++. It's all there to obfuscate things into an interface so you can have a one-size-fits-all line of code that "just works". But if the code "just works" and its a critical piece of code, you have to then worry about HOW it "just works". And then remembering how the obfuscation works become's a mental burden you have to carry around with you when it could have just been a simple for loop.
>>
>>108914778
So why not just use the for loop in your code?
>>
>>108914785
Because at the end of the day, I'm not a C extremist. I recognize that there is some value to not re-inventing the wheel. It's a trade-off depending on circumstance. If C++ was absolutely horrible, it wouldn't bother me. I'd just ignore its existence and use C. Unfortunately, not everyone likes to stay stuck in '98 with me and when I look up documentation or examples I have to wade through new-age bullshit.
>>
do people actually understand this kind of code? i don't know how anyone can skim through code that looks like this and know what is happening. imagine having to do that with a whole source file
>>
>>108914785
The goal is to totally get rid of all C keywords.
So we’d use
 std::for_each(v.cbegin(), v.cend(), …
>>
>>108913348
And it turns out our program needed a mountain bicycle good thing we reinvented it while writing the program and didn't just use the city bike that works for 99.9% of cases but can morph into a shity mountain bike if you pass it this massive array of flags and jump through hoops every 15 minutes.
>>
>>108913677
Garbage collection
>>
>>108915085
its technically supposed to make it easier. accumulate is a higher order function which can be used on *any iterable container and always behaves the same.
>>
>>108912693
Rust and C++ are the same language.
>>
>>108912862
are you coding on notepad
>>
>>108914785
NTA, but I do. Others don't.
>>
>>108915285
if you have infinite time and money, sure. roll everything yourself. it's fun.

problem is deadlines and budgets exist.
>>
>>108915458
>>108915285
plus if you want to have code reuse at a high level you'll end up with a niggerlicious bespoke language in your macros
>>
>>108912693
Hello C/C++ fags
Are C/C++ more immune to AI replacement? I'm a webshitter wondering if embedded is safer than fullstack.
>>
>>108913666
>>108914440
okay.
now make it run in parallel and answer the same question.
>>
>>108913651
Yeah, I agree. This is dumb and unreadable.
>auto facBuildCtrl = new FactoryBuilderController();
It needs to be this instead, for readability
>FactoryBuilderController facBuildCtrl = new FactoryBuilderController();
See? Now you know that the FactoryBuilderController will be a FactoryBuilderController, and not something else!
>>
>>108914778
You call std::max(val1,val2) and everyone can see at a glance what it is and what it does.
std::max(obj1,obj2,[](){/*some lambda I'm too tired to write*/) is also pretty god damn clear and a solid workaround for when the values that make the comparison are buried in a class and require access through a getter or something.
If instead you're passing them to myCompare(&obj1,&obj2) well now it's less obvious. Call it computeMax() or whatever, but are you always going to behave yourself and not bury non-max computing behaviour inside that function? Decades of experience tells me that if you're trying to track down bizarre functionality that defies your break points, look into the "simple" functions that you assumed to one small thing with no side effects. Some junior is bound to have put state changing logic in there at some point.

So that's the answer. If you are a good software engineer, no, the std:: functions are unnecessary in many instances. However if you routinely work with many people who come and go in an org, fucking use the std:: functions, they'll save your life.
>>
>>108915381
>are you coding on notepad
I tend to use vim with no fancy shit beyond syntax highlighting. Why? Because every time I use vs code I wind up fighting the auto-complete. It starts popping up helpful information about parameters and possible variable names and now my keys are overtyping shit I didn't want and not doing what I expect them to. IDEs are a necessary crutch when you're dealing with 100 files of OOP bullshit, but god damn is it nicer to not HAVE TO use them.
>>
>>108914186
That's the beauty of C; its lack of multi-paradigm support. Everyone working on a project is forced to work in the same paradigm, which massively helps readability and consistency.

Working on a big, long running, multi-dev project in a (((multi-paradigm))) language is cancer. The code is littered with each dev's OOP-hell phase, then their unreadable minimalism phase, then their unreadable functional bro phase. Every couple of months someone gets a wild hair up their ass and there is a new language construct, library, or framework thrown into the codebase and then abandoned.
>>
>>108915289
boehm gc is old hats
>>
>>108915664
>C
>readability
>consistency
>real project
Lol, lmao even
>>
>>108914725
>It's an example made on purpose to be horrible

Have you ever used the standard library? It's full of this crap. After some experience you can parse and understand everything that is on cppreference, sure, but it doesn't change the fact that it's an extremely convoluted system for no benefit. Simple stuff that should be put into simple APIs takes longer to fully grasp and use.

It's the kind of garbage that academic types would design and masturbate about with zero regard to ergonomics and practicality. And because the standard never makes breaking changes, all the shitty decisions from 3 decades ago pile up. That's why things like std::unordered_map are so bad.

Abusing templates is by far the worst decision the standard has ever made. They should deprecate all of it and rewrite everything without templates. Except data structures. Data structures are the _ONLY_ place where generics are useful.
>>
>>108912693
That's a retarded example. std::accumulate is used for summation of container elements, there's no point in making it do the job of std::for_each.
Also in sepples this is just
int maxCount(const std::vector<int>& nums)
{
return std::max(std::count_if(nums.begin(), nums.end(), [](int a){ return a > 0; }),
std::count_if(nums.begin(), nums.end(), [](int a){ return a < 0; }));
}
>>
>>108912693
>neg
Oy Vey that is racist! Also laurie is getting cuter (as a trans man) because of C++
>>
>>108915650
You know you can just leave the type hints and disable the auto completes, right?
>>
>>108913184
>anywsegmentation fault: core dumped
skill issue
>>
>>108913348
on the other hand, if you don't reinvent the bicycle you're suspectible to (((supply chain attacks))) which is a fatal flaw of shit like js and rust
>>
>>108915610
this but unironically
>>
>>108914186
C# and Java both do that. They also happen to be the uncontested kings of enterprise software.
>>
>>108915965
that's a kike, not a troon. don't get your hopes up.
>>
>>108913105
Semantically because it lets the return be dependent on arguments
Aesthetically because it aligns function names at the start as they tend to get lost with complex returns, and it also auto introduces class scope for the return val in methods
>>
>>108913673
NTA
auto is cvref qualified, so
auto val = functionThatReturnsAReference();

will make a copy because the cvref of the auto overrides the cvref of the return
decltype(auto) is not, it inherits the cvref from the deducted type
>>
File: file.png (18 KB, 833x142)
18 KB PNG
>>108912693
in rust this is just
yes I know I could iter().max() instead too
>>
>>108912720
>++i
rope
>>
>>108912693
They really want to turn C++ into Rust but worse for no good reason. At least the committee does a good job to ensure that the language will finally die by thousands cuts.
>>
>>108916321
Prefix ++ is faster than postfix with objects.
>>
>>108914186
We've got C# and Java already.
>>
>>108916218
>Vec<i32>
>immediately calls into_iter()
wasted memory award

fn max_count(xs: &[i32]) -> i32 {
let (p, n) = xs.iter().fold((0, 0), |(p, n), &x| {
(p + (x > 0) as i32, n + (x < 0) as i32)
});
p.max(n)
}
>>
>>108912693
literally no idea what that code snippet is supposed to be doing.
>>
C++ is just pure mental gymnastics bullshit and if I say this out loud on reddit everyone attacks me like I'm some monster.
>>
>>108915664
>lack of multi-paradigm suppor
everyone can nigger rig their own ghetto version of C++ using macros and they do, meaning that every project is actually a different language
>>
>>108917611
OP takes std::vector by value
>>
File: image.png (72 KB, 674x732)
72 KB PNG
>>108912693
>>108912703
Why are modern programming languages starting to look like those esoteric memelangs like brainfuck
>>
>>108915289
Was added to the specification, not implemented by compilers, then removed after 10 years.
>>
>>108915664
> phases
Lol, yes, I’m working on a 30 year old code base and you can see the phase strata like a geologist:
- everything is a lambda phase
- everything has a multi-return
- everything is a template phase, even with only one instantiation “just in case”
- unnecessarily multithread everything phase
- every function has varargs … phase
- const correctness phase
- getters and setters phase
>>
>>108913172
I like this take, thank you for saying this.
>>
>>108916218
I remember, decades ago, when i.thought().it().was().cool() to chain everything like when you << do << shit << like << this in C++ but it was just an old phase that nobody wants to see in the next 20 years of maintenance after they growup.p
>>
>>108914354
I think its more the people who taught apl are retarded.
>>
>>108917716
honestly I just use it for std::vector
>>
>>108912693
Sepples is the only language where the higher in the abstraction scale you are, the more code you have to write.
>>
>>108919938
I made my own std::vector and hash maps and such in C99 so that I don't have to use C++.
>>
>>108913114
Bloat. Creates two useless lists that are immediately discarded. learn2lisp
(list (count-if #'plusp xs) (count-if #'minusp xs))
>>
>>108912693
In all seriousness, explain
>>
>>108919947
Some of cpp is genuinely abominable in appearance. Since real people of lower iq than me (indians) manage it, I guess I could learn it.
>>
>>108920052
If there is a voice deep down in your heart telling you that C++ is not worth your time, you may actually be much higher IQ than you think.
>>
>>108916640
yeah, in 2002, where it wasn't optimized.
>>
>>108913109
>>108913452
>>108913689
This what the fuck? Since when is an error loudly crashing bad? The only reason it's bad is if you're a fucking jeet webshitter who sweeps them under the rug and keeps going.
>error not fatal saar it is ok we pray to ganesha program work
>>
>>108912704
>templates/generics aren't strongly typed because i don't know the type at compile time
>>
>>108918290
damn unc you've wasted decades without learning the difference between meaningful method chaining slash function composition and sepples' << >> slop?
>>
>>108913248
contract-based programming is simply not something you can bolt on, it needs to be developed in the beginning stages of a language
>>
>>108912693
saar
    private static int MaxCount(int[] nums) {
int pos = 0, neg = 0;
for (int num : nums) {
if ((num & 2147483648l) >> 31 == 0) {
pos++;
} else {
neg++;
}
}
return (pos > neg) ? pos : neg;
}
>>
File: 1779836010244305.jpg (41 KB, 798x644)
41 KB JPG
>>108920445
>if ((num & 2147483648l) >> 31 == 0) {
>>
>>108920607
it's just a decimal way to write the sign bit mask

problem is that it assumes int is 32 bit
>>
>>108921239
Int IS 32 bits on all relevant platforms. If this program fails on your platform, it is not the program's fault, it is your platform's fault.
>>
>>108921239
>>108921258
it isnt the 60's anymore grandpa, you can take that 49 bit word machine to the museum
>>
>>108920286
>there's a fundamental difference between the method chaining syntax sugar and << syntax sugar
>>
>>108912703
this. even if you resist rust, other languages are hellbent on enshittification
>>
>>108915588
what if you don't need to run in parallel?
>>
>>108921574
yep, that's what I said
>>
>>108912693
You know how I create loops?
Claude make me a loop

Always works.
>>
>>108916182
It's kind of crazy how much complexity in this language stems from absolutely insane choices made completely arbitrarily. I've gotten bitten like three times by autistic qualifier rules causing subtle behavioral bugs. Probably my favorite was when some snippet of code boiling down to a copy when it should have been a move due to some autistic edge case, hidden inside 3 layers of template indirection. Tracking that down was probably the lowpoint of my career.
>>
>>108916321
1) i++ (potentially) requires addition storage to stash the intermediate result
2) in you mind, do you think i want to "i increment" or "increment i"?
>>
>>108912693
It's beautiful
>>
>>108912703
>race with rust
No, it’s in a race with every language since 1980. And that’s fine. C++ has decided that they want to keep bolting on instead of making a sequel. In fact, they’ve publicly encouraged others to make a sequel. That was D and everyone ignored it for spurious reasons so here we are.
>>
D is always better than whatever language you're using.

struct Grid(T) {
uint width, height;
T[] array;
this(uint w, uint h) {
width = w;
height = h;
array.length = width * height;
}

static struct Coord { uint x, y; }

auto ref opIndex(int x, int y) {
const n = y * width + x;
return array[n];
}
auto ref opIndex(Coord p) {
const n = p.y * width + p.x;
return array[n];
}

int opApply(scope int delegate(Coord, ref T) dg) {
foreach (y; 0 .. height)
foreach (x; 0 .. width) {
auto ret = dg(
Coord(x, y),
this[x,y]
);
if (ret) return ret;
}
return 0;
}
}

auto grid = Grid!char(64, 32);
foreach (coord, c; grid) {
writefln(i`$(coord.x),$(coord.y): $(c)`);
}
>>
>>108923318
Code not related I presume.
>>
>>108923637
>no argument
I accept your concession.
>>
>>108923642
Onus is on you, you're the one who made the claim. I gave you the benefit of the doubt, but it seems I was wrong to do so. D: by retards for retards.
>>
>>108923682
>can't read the code
>doesn't know what he's doing
>whines
So you're an inferior programmer, what do I get by debasing myself to your level?
>>
>>108923688
Thanks for proving my point. I rest my case.
>>
>>108923702
>completely meaningless words that do nothing but keep it living in squalor
What do I care about your inferiority?
Are you indian? You're indian, aren't you. Good talk.
>>
CPP IS DEPRECATED.

use rust if you're normal or zig if you're a closeted /g/ tranny instead.
>>
>>108923318
name D actually stands for "Dalit", because that's who the language is for.
>>
>>108912704
Strong typing generally means no or few implicit casts. It doesn't mean you can't have type inference, which is what auto is doing. The type of the expression is almost always known by the compiler if the language is also statically typed. There's no reason why you then need to type it out a second time.
>>
File: 381110801919200922.png (434 KB, 976x866)
434 KB PNG
>>108912704
>/g/ - Technology
>Look inside
>trannies trannies jeets jeets jeets



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.