lexdene / md-blog Goto Github PK
View Code? Open in Web Editor NEWmy blog by markdown
my blog by markdown
https://github.com/lexdene/md-blog/blob/master/cpp/is_derived_from/is_derived_from.md
在上面链接中,单例模式下仍有问题。
不如学/分析一下 is_base_of。
template <typename B, typename D>
struct Host {
operator B*() const;
operator D*();
};
template <typename B, typename D>
struct is_base_of {
private:
typedef char (&yes)[1];
typedef char (&no)[2];
template <typename T>
static yes check(D*, T);
static no check(B*, int);
public:
static const bool value = sizeof(check(Host<B, D>(), int())) == sizeof(yes);
};
struct Base {};
struct Derived : private Base {};
int main() {
static_assert(is_base_of<Base, Derived>::value, "Error");
is_base_of<Derived, Base>::value;
}
如果真想在Github上寫Blog,可否在Readme.md加個鏈結目錄唄!orz...
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.