Comments (2)
It works if we store the EbmlDocVersion
as a pointer and have an actual instance of the version kept in memory. Maybe we can store it as a reference but we can't initialize it the ways we do not. Or maybe it needs a copy constructor in EbmlDocVersion
and MatroskaProfile
?
from libmatroska.
The code above doesn't work because the MatroskaProfile
passed to the constructor is a temporary value. The object is destroyed after the initialization (in the static + global variables). The references point to a dead/reused memory location.
Example with this:
class A {
public:
constexpr A(bool i) : toto(i?1:0) {}
const int toto;
};
class B : public A {
public:
constexpr B(bool o, bool i) : A(o), titi(i) {}
const bool titi;
};
class holder {
public:
constexpr holder(const A & ref)
:myref(ref)
{}
const A & myref;
};
const holder holder_local(B(true, false));
constexpr const holder holder_local_expr(B{true, false});
The second constructor fails to compile because the constructor is a temporary value.
So we need to make the MatroskaProfile
passed to the EbmlCallbacks
constructor actual object instances kept in memory. If we can manage to turn the global EbmlCallbacks
instances constexpr
, it should generate build failure when not used properly, as in the example above.
from libmatroska.
Related Issues (20)
- Linking against libmatroska.dll (lib) fails HOT 1
- set libebml without sudo HOT 2
- Add simple examples HOT 3
- Drop MATROSKA_VERSION define HOT 6
- Version not updated in 1.6.1 HOT 1
- can it be compiled for MIPS architecture? HOT 1
- Document C++11 requirement HOT 1
- pkg-config file is broken when CMAKE_INSTALL_{INCLUDE,LIB}DIR is absolute
- new release soon? HOT 8
- Fix -DEbml_DIR=/path/to/libebml in the README HOT 2
- new release 1.7.1 fixing ABI breakage HOT 5
- A suggested addition
- Better Write EBML lacing signed VINT
- Critical issue with the "French" language flag HOT 3
- rename functions & classes with `Timecode` in their names HOT 2
- querying valid values for enums HOT 5
- Some tests do not build, some crash on 1.7.1 and latest 1.x HOT 1
- mkclean porting issues
- reduce number of classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libmatroska.