在C ++中,什么是“命名空间别名”? [英] In C++, what is a "namespace alias"?

查看:106
本文介绍了在C ++中,什么是“命名空间别名”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++中的命名空间别名是什么?如何使用它?

What is a "namespace alias" in C++? How is it used?

推荐答案

命名空间别名是通过不同的更短名称。

A namespace alias is a convenient way of referring to a long namespace name by a different, shorter name.

例如,假设你想使用Boost的uBLAS的数值向量,而不使用 using namespace 指令。每次说明完整的命名空间是麻烦的:

As an example, say you wanted to use the numeric vectors from Boost's uBLAS without a using namespace directive. Stating the full namespace every time is cumbersome:

boost::numeric::ublas::vector<double> v;


$ b < :

namespace ublas = boost::numeric::ublas;


ublas::vector<double> v;

这篇关于在C ++中,什么是“命名空间别名”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆