Where are the standard containers?

Where's the hashmap, the BST, etc

Attached: The_C_Programming_Language_logo.svg.png (1200x1276, 77K)

Other urls found in this thread:

github.com/nothings/stb
github.com/facebook/folly
probablydance.com/2017/02/26/i-wrote-the-fastest-hashtable/
lmgtfy.com/?q=hashmap in C.
raw.githubusercontent.com/nothings/stb/master/stretchy_buffer.h
pastebin.com/urMbarCn
pastebin.com/NRc0ux3C
twitter.com/SFWRedditVideos

No generics lol

If you can't make these yourself, you're not a "programmer".

He's a coder

Haha okay but seriously, what do I import?

Use c++

Uhhmm lol

a lib

write it yourself, fagit.

There are no containers are there...

There's languages with training wheels, and there's C. Now go and crawl back to Pythonland or wherever it is you came from. You don't deserve to write in C.

What the f*ck guys do you just make a buggy underperforming container every time?

>self-censoring on 4channlel

>every time
No, we copy and paste them from previous projects

Attached: quakeguy.jpg (249x202, 8K)

still faster than python :^)

Speak for yourself.

Yeah guys I don't think I like C anymore haha

C does have generics

Of course I can. I'm just not interested in writing my own implementation every single time. I have better stuff to write.

include a library that implements them

It doesn't. Void* is a hack

>every single time
what an absolutely brainlet thing to post

There are none. As it should be. You wouldn't want the C++ situation where they fool you to use things like unordered_map or set and they're actually shit because of implementation requirements.
Vector too, doesn't even have SBO.
If you're just looking for something decent for rapid prototyping try
github.com/nothings/stb
They're high quality libraries.
And I highly recommend sprintf if you have any sort of pressure on it. They're shit in the standard.

meanwhile, in a bug approved language:

Attached: k8S00sM_d.jpg (750x411, 51K)

#include "data_types_to_worck.h"
#include "whole_generic_algoritm_you_need.h"

OR use the PHP as preprocessor

Or writing one for every type.
Or making my codebase look like an aborted fetus by trying to emulate templates with macros.
Etc. C is just not a good language for programming in.

If it's just SBO, you can inherit the vector class and do what you want to do.
Everything else is just fine. What implementation requirements do you not like

IF you're using C, you don't want to use prefab datastrucutres. You want datastructures which are optimized for your particular use case.

>Or writing one for every type
stop, my IQ can only drop so low

What use case these are just containers

Or abusing void* and losing all type safety and type specific optimisations.
You can't justify this.

Oh so you should use slow ass void*?

>just containers

Attached: MEMORY_ALLOC.png (699x701, 269K)

I literally want a hashmap and there are none in C.

#include "data_types_to_work_wich.h"
#include "whole_generic_algoritm_you_need.h"

>what implementation requirements don't you like
I'm not gonna go through the standard and complain about everything for you.
A good start if you want to learn is to look at libraries like github.com/facebook/folly and find why they've replaced the standard containers. I don't think that gets you straight to what part of the standard makes the standard containers insufficient. But you'll at least get the problems with them from a point of view.
Every big company have their replacements.
For the nitty-gritty on specific containers you would have to look deeply.
probablydance.com/2017/02/26/i-wrote-the-fastest-hashtable/
Is an excellent blog post.

See and

lmgtfy.com/?q=hashmap in C.

>tfw you're too much of a brainlet to implement this yourself

std::unordered_map is fine if you use emplace

just include 2 files
1 for datatypes
2 for generic algoritm

I dunno man I don't care about 5% perf boosts or something just quick and easy containers

See

I can and have made my own hash maps. Just I don't think for a moment you and I can make something faster than std::unorsered_map

Oh so let's close our eyes to void* it's just in somebody else's code

>5%
Oh if only it were that little.
And if you're op there's plenty of containers to choose from.
You've had plenty of people point you to great alternatives.

why the fuck would you even bother using 40 year old language that didn't progress at all since?

>if only
How much is it?

How do I know these are quality containers? I mean, std ones have zero bugs.

Unordered_map is slower than many of the naive implementations.
You'll probably struggle the most in the hash algorithm.

Because everything that matters still uses it.

sort(abstract_type * list)
{
abstract_type * a;
abstract_type * b;
abstct_split(list, a,b);
abstract_join(a,b,list);
}

>how do you know these are bug free
user stop writing code. You'll create bugs. I'm confident they're not because their implementation is something you could read trivially and I've used them and never had trouble.
>std ones have zero bugs
Depends on the platform. It's not a high bar for something like this really.
>how much performance loss is there
Depends on your use case. Read the blog post.

on github.

If you actually cared about efficiency you would write it yourself, instead of complaining that a general one-size-fits-all implementation doesn't meet your standards for a particular use case.

normalone langiages extend youself trought librares

You can make a linked list without generics, you just have yo know some basic pointer arithmetic. Did you not learn this in uni? I'm doing an OS course right now and the very first thing we learnt was how to make a doubly linked list in C without void* that can store arbitrary data.

Just use this like everyone else :)

Attached: java.png (1200x2195, 116K)

Or I could use templates.

No, we learned a templated C++ linked list which doesn't crash and burn.

>type safety
Why do you presume you have to do without that?
raw.githubusercontent.com/nothings/stb/master/stretchy_buffer.h
Typesafe.

>he can't write secure c code
Everyone has done a datastructures class

Boomer-oriented programming suffers from not-invented-here syndrome.
They don't believe in generics either, and instead rely on shitty code generators.

Me too, just in a sane language. Oh and my linked list runs faster as it's array-based and fits in cache.

>Oh and my linked list runs faster as it's array-based
Source, I need to see this spaghetti.

>source
I passed my data structures 3 years ago.

it's not a linked list, if it's just plain arrays

Sorry, I didn't know you were LARPing.

Zoomers rely on shitty code generators as well.
They call them coders.

Then it's not a linked list, just a regular list. I've done that too, but this thread was about c and I simply said that you don't need generics to make a true linked list, all you need is to know some pointer arithmetic. It's not about wich language is superior (wich is obviously scratch)

Retard

Is this a hybrid datastructure or chunked linked list?
Idiot. You don't know that.

Hybrid. Takes some RAM but it's okay for me

I'm too much of a brainlet to make interleaved deltas, man.

>calls arrays linked lists
>calls others retard

>>calls arrays linked lists
It's a data structure with the public interface and method complexity of a doubly linked list. For all intents and purposes, it's a doubly linked list with pointer to head and tail.
Fuck this, go suck a dick.

You did this in C? I need your source, faggot.

>public interface
>method
>You did this in C?
Bye

haha I knew you were a LARPing faggot.

Cretin

kys tranny piece of shit

>design patterns don't exist in C
TIL

I was the one who wrote a doubly linked list in C, will post code later tonight if I don't forget (phoneposting)

Don't bother dude, he wouldn't even know what he was looking at. His closest experience with linked lists is taking dick at both ends.

>being this butthurt
LOL

People like you are why low level languages shouldn't be in public use. Writing naive and slow ass code.

im actualy using this pastebin.com/urMbarCn abstrac generic doublelinkedlist in C

it uses int`s instead of pointers cose i like to serelise in file it sometimes

Why does Jow Forums larp as embedded devs?

If you have time to waste reinventing the wheel, you are not a programmer.

This is my implementation of a singly linked list. Any pointers or constructive criticism?
pastebin.com/NRc0ux3C

They are doing one hell of a bad job at it too, considering that any triple digit IQ person realized Sepples surpassed C in embedded as well long ago.

I know this is bait but I'll bite:

People who think this shit in real life are insufferable faggots who have 0 concept of how much abstraction there already is between them programming in "real" languages bare metal. The amount of abstraction that's achieved by going from logic gates to C is fucking astronomical, and you could probably never achieve writing a C compiler from bare metal in your entire life if it weren't for the work of hundreds of years of mathematicians working all this shit out for you. Comparatively, the jump from C to Python is minuscule in the grand scheme of things. Sure it might abstract away a few data structures and make things nicer to use, but it's nothing compared to carefully organizing bits of sand together in such a way that they perform actual computation.

Computer science and abstraction are tied together at the hip. Losers who can't understand that the continuous abstraction of mathematics is the very essence of computing are the most obnoxious fucking faggots in the world. The losers who can't understand that it's actually harder to think abstractly are the funniest of them all. Sure you can do the equivalent of hand-holding a modern abacus. You're not accomplishing anything by reinventing the wheel for the thousandth time, you're just doing it because someone needs some retarded shit to be fast, but you're not furthering the field of computer-science. You're not developing new fucking algorithms in C, you're implementing something that someone (far smarter than you) has already thought of in a slightly different flavor just so you can get a paycheck.

Nice pasta

>having no options is better than having options: the post

what the fuck is the point of that identifier

>The amount of abstraction that's achieved by going from logic gates to C is fucking astronomical
lel

>1 time at init
Lol rubbish. Just write a good allocator.

>copies structs instead
Post your solution

>c is not a huge abstraction already

pastebin.com/urMbarCn