r/cpp11 • u/AdeptKingu • Feb 15 '24
What is this type of image output called?
ASCII art? GAN? Abstract Art? Are there example sample code I can run say in c++ to produce it?
r/cpp11 • u/AdeptKingu • Feb 15 '24
ASCII art? GAN? Abstract Art? Are there example sample code I can run say in c++ to produce it?
r/cpp11 • u/ovidiucucu • May 10 '14
r/cpp11 • u/YouFeedTheFish • Feb 03 '13
r/cpp11 • u/YouFeedTheFish • Feb 03 '13
r/cpp11 • u/YouFeedTheFish • Apr 02 '13
r/cpp11 • u/YouFeedTheFish • Feb 03 '13
r/cpp11 • u/YouFeedTheFish • Feb 03 '13
Perhaps the standard committee wanted a means of creating a method that would be useful when using type identifier as keys in containers such as map. The problem I have with hash_code() is that:
1.) It requires RTTI to be enabled, which seems like a waste if there is no other reason to enable RTTI, since run-type info will be generated for everything.
2.) It is not guaranteed to be unique, so type_info has to be checked to prevent collisions. Although implementations are free to make hash_codes unique, it is not guaranteed.
3.) It is not guaranteed to be compatible across compilers.
4.) Implementing a solution to fix all of the issues above seems trivial.
The following code will generate a unique id per type, which is cross-compiler compatible and doesn't require RTTI:
// TypeIdentifier.h
long assignInternal();
template<typename T>
class TypeIdentifier{
public:
static long getTypeId();
private:
static long _typeId;
};
template<typename T>
long TypeIdentifier<T>::_typeId = assignInternal();
template<typename T>
long TypeIdentifier<T>::getTypeId(){
return _typeId;
}// TypeIdentifier.cpp
#include "TypeIdentifier.h"
#include <atomic>
namespace{
std::atomic_long typeIdCounter = ATOMIC_VAR_INIT(0L);
}
long assignInternal(){
return std::atomic_fetch_add(&typeIdCounter, 1L);
}The code above can be used like this: TypeIdentifier<MyType>::getTypeId()
I read (somewhere) that the committee defined hash_code() to eliminate the endless variations on the theme above, but to me, it seems like the shortcomings of the standard implementation are too great.. Thoughts?
[edit: grammar]
r/cpp11 • u/[deleted] • Jan 27 '24
Hi there, I would like to show you a framework called Nodepp. This is a project I've been working on for a while, making this idea into reality.
In summary, this framework will let us create C++ code asynchronously, with a syntax similar to NodeJS or Javascript.
I have to point out that this framework is compatible with C++11 | C++14 | C++17
If you're interested, let me know what do you think about it 👍.
with Nodepp, you can create:
TCP | TLS | UDP Servers & Clients
HTTP | HTTPS Servers & Clients
WS | WSS Servers & Clients
Poll | Epoll | Kqueue Support
File Streams
zlib streams
Generators
Coroutines
Observers
Promises
Timers
Events
And so on. Here is a simple example of a WebSocket server created with Nodepp:
server: https://github.com/NodeppOficial/nodepp/blob/main/examples/WSServer.cpp
client: https://github.com/NodeppOficial/nodepp/blob/main/examples/WSClient.cpp
Here's another example of an HTTP Server created with Nodepp
server: https://github.com/NodeppOficial/nodepp/blob/main/examples/HTTPServer.cpp
client: https://github.com/NodeppOficial/nodepp/blob/main/examples/HTTPRequest.cpp
If you’re interested in Nodepp, Here is the Github repository:
Windows | Linux | Mac: https://github.com/NodeppOficial/nodepp
r/cpp11 • u/bhavaniab • Feb 26 '18
r/cpp11 • u/YouFeedTheFish • Jun 29 '13