用于c++的IoC和Factory -用于c#的Microsoft Unity的替代品
IoC and Factory for C++ - Alternative to Microsoft Unity for c#
什么是c++最常用的健壮的nugetpackage/library/framework,它与微软的c#库Unity做得差不多:http://unity.codeplex.com/?
最终结果将看起来像这样:
class IProjectRepository
{
public:
vector<Project> GetProjects() = 0;
}
class XMLProjectRepository : IProjectRepository
{
public:
vector<Project> GetProjects()
{
return // implementation
}
}
class Application
{
public:
Application( shared_ptr<IProjectRepository> projectRepository )
// Or however this would look...
// projectRepository would be an instance of whatever i have registered (see below)
{
auto projects = this.projectRepository.GetProjects();
}
}
在某些启动区域,我可以这样绑定:
BinderFramework::Register<IProjectRepository, XMLProjectRepository>();What is the most common use sturdy nuget package/library for C++ that does pretty much the same as the C# library by Microsoft called Unity: http://unity.codeplex.com/
我一直在寻找一段时间,但没有找到一个很好的完整和简单的解决方案。
我的想法是使用一个众所周知的框架,而不是编写我自己的蹩脚代码。
我可能来晚了一点,但你应该看看皮下注射公司。
它只是标头,它带有一个非常酷的Dsl,而且它已经在生产环境中使用了多年。
相关文章:
- 1d 智能指针不适用于语法 (*)++
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 用于访问容器<T>数据成员的正确 API
- 重载操作程序时出错>>用于类中的字符串 memebr
- 如何防止 c++ 在从浮点型转换为双精度型(不适用于 IO)时添加额外的小数?
- C++中的cin.ignore()函数不适用于整个流
- 没有用于初始化C++中的变量模板的匹配构造函数
- 用于C++中带有数组和指针的循环
- 为什么它不适用于Visual 2019的原因
- 使用在用于SFINAE的void_t中具有参数的方法
- 在createdialog创建的窗口中捕获用于编辑控件的OnMouseMove消息
- 重载==不适用于二进制树
- Insert函数不适用于2 if语句C++
- 用于矢量处理的多个线程
- Microsoft C++ 用于图形 API 的 Rest SDK
- 编译后的.lib文件可互换用于不同版本的Microsoft Visual c++
- 用于c++的IoC和Factory -用于c#的Microsoft Unity的替代品
- std::iterator_traits用于Microsoft标准库中的积分类型
- 适用于Microsoft Visual C++2008和R2007b的Mex类型
- visual studio -在哪里可以获得神话般的Microsoft msgtool,用于c++序列化