mklimenko / embed Goto Github PK
View Code? Open in Web Editor NEWstd::embed implementation for the poor (C++17)
std::embed implementation for the poor (C++17)
Hi,
thanks for the great work!
C23 added #embed https://en.cppreference.com/w/c/preprocessor/embed do you some benchmark that compares this to your lib? Any insight on when to use yours or #embed?
Best, Johannes
You implement (parts of) the singleton pattern. But your whole class is static except for your convenience function call operator.
So there is not need in making the class a singleton at all. Just remove the private ctors and the singleton method and simply create a default constructed global instance embed
Why I found this: You return a reference from your singleton method but store an instance of it in the global variable. So you make a copy. Looking further I found that the whole singleton pattern makes no sense here.
Hi, congrats for your great work, but it seems that embed.exe stores dupes:
c:\MyDev\test>C:\MyDev\Contribs\embed-master\embed\x64\Release\embed.exe data -o src
embed.exe: saving data\a.txt
embed.exe: saving data\subdir\b.txt
embed.exe: saving data\subdir\c.txt
embed.exe: saving data\subdir\b.txt ... Skipped
embed.exe: saving data\subdir\c.txt ... Skipped
We can see that both subdir files are processed twice (this is the first run). And they appear twice too in the array is generated in resource_holder.hpp:
namespace {
class ResourceHolder {
private:
std::array<Resource, 5> resources {
Resource(resource_3021224534458533622, resource_3021224534458533622_path),
Resource(resource_9734938727009729610, resource_9734938727009729610_path),
Resource(resource_7710364344198624147, resource_7710364344198624147_path),
Resource(resource_9734938727009729610, resource_9734938727009729610_path),
Resource(resource_7710364344198624147, resource_7710364344198624147_path),
};
So there are 5 resources (including 2 dupes) for 3 input files...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.