C++类名冲突

扫码查看
本文介绍了C++类名冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在处理一个需要集成两个子项目的项目.

I am now working on a project that needs the integration of two sub-projects.

项目 A 是用 C++ 编写的,项目 B 是用 C 编写的.一个问题是,在项目 B 中,有一个名为 vector 的结构体,它是由其作者创建的,在项目 A 中,使用STL 中的std::vector.因为后期可能会更新项目B,所以不想改B的vector类的名字.

Project A is written in C++ and project B is written in C. One problem is that in project B, there is a struct called vector which is created by its author and in project A, the std::vector in STL is used. Because project B may be updated later, I don't want to change the name of B's vector class.

有没有办法处理这种情况?

Is there a way to deal with such a case?

推荐答案

它们已经是不同的名称,分别是 vectorstd::vector.您无需更改任何内容.

They're already different names, vector and std::vector respectively. You don't have to change anything.

这篇关于C++类名冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 15:09
查看更多