百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dyno

> 编程语言
开源

正确实现运行时多态

1.0K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

正确实现运行时多态

Dyno: 正确实现运行时多态化

免责声明

目前,该库是实验性的,它纯粹是一种好奇心。不保证接口的稳定性或实现的质量。请自行承担风险使用。

Dyno 是对以下内容的纯库实现: [Rust 特性对象][], [Go 接口][], [Haskell 类型类][], 和 [虚拟概念][]。在底层,它使用了称为 [类型消除][] 的 C++ 技术,这是 [std::any][], [std::function] 和许多其他有用类型背后的思想。

cmake --build build --target examples # 编译并运行示例 cmake --build build --target tests # 编译并运行单元测试 cmake --build build --target check # 运行示例和测试 cmake --build build --target benchmarks # 编译并运行基准测试


## Introduction
In programming, the need for manipulating objects with a common interface but
with a different dynamic type arises very frequently. C++ solves this with
inheritance:

c++ struct Drawable { virtual void draw(std::ostream& out) const = 0; }; struct Square : Drawable { virtual void draw(std::ostream& out) const override final { ... } }; struct Circle : Drawable { virtual void draw(std::ostream& out) const override final { ... } }; void f(Drawable const* drawable) { drawable->draw(std::cout); }

…

c++ #include 使用命名空间 dyno::literals;

struct Drawable: decltype(dyno::requires_( "draw"_s = dyno::method )) { };

这个定义

![Travis status][badge.Travis]

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++cppcpp11cpp14cpp17

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言