[英]Visual Studio 2015 Community - Immediate Window
I learnt quite a lot about the Immediate Window but I still have some questions that I cant seem to find any answer for. 我对“即时窗口”学到了很多东西,但仍然有一些问题似乎无法找到答案。
How do I write multiple lines of code in the Immediate Window ? 如何在立即窗口中编写多行代码? For example my code has the variable heap which is the boost::fibonacci heap and I want to see all its nodes.
例如,我的代码包含变量boost :: fibonacci堆,我想查看其所有节点。
for (auto it = heap.begin(); it != heap.end(); it++) cout << it->a << " " << it->b << " " << it->distance;
How do I create and assign new variables ? 如何创建和分配新变量? For example, suppose my heap is of type
vector<int> heap;
例如,假设我的堆是
vector<int> heap;
类型vector<int> heap;
But typing vector<int> a = heap;
但是输入
vector<int> a = heap;
gives me the error message identifier "vector<int>" is undefined
给我错误消息
identifier "vector<int>" is undefined
If the immediate window was not meant to provide such support, are there any other alternatives within visual studio ? 如果立即窗口不是要提供这种支持,Visual Studio中是否还有其他选择? It would be nice if the syntax is similar to C++.
如果语法类似于C ++,那就太好了。
C++ is a compiled language, not an interpreted language. C ++是一种编译语言,而不是解释性语言。 The Immediate Window appears to blur the distinction, but as you note it's limited.
立即窗口似乎使区分变得模糊,但是如您所知,它是有限的。 New variables, such as
auto it =
or vector<int> heap =
are too complex. 新变量(例如
auto it =
或vector<int> heap =
太复杂了。 The Immediate Window is using the expression evaluation functionality in the IDE, but what you'd need are definitions. 立即窗口正在使用IDE中的表达式求值功能,但是您需要的是定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.