Standard Template Library
As part of the added support in Visual Studio 11 Developer Preview for the C++11 specification, the Standard Template Library (STL) support in Visual Studio is extended to provide the additional programming constructs that specification requires. Highlights include the following:
Support for new headers <atomic>, <chrono>, <condition_variable>, <filesystem>, <future>, <mutex>, <ratio>, and <thread>.
To optimize memory resource usage, all containers are now smaller given their current representations. For example, in x86 release mode with default settings, std::vector has shrunk from 16 bytes in Visual C++ 2010 to 12 bytes in Visual C++ in Visual Studio 11 Developer Preview, and std::map has shrunk from 16 bytes in Visual C++ 2010 to 8 bytes in Visual C++ in Visual Studio 11 Developer Preview.
Other C++11 Enhancements
SCARY iterators: As permitted but not required by the C++11 Standard, SCARY iterators have been implemented. For more information, see the PDF document SCARY Iterator Assignment and Initialization.
Stateless lambdas, which is code beginning with an empty lambda-introducer  and capturing no local variables, are now implicitly convertible to function pointers as required by the C++11 Standard.
Scoped enumerations support. The C++ enum class enum-key is now supported.
Auto-vectorizer. One of the biggest potential performance gains is doing things in parallel instead of sequentially. Visual Studio 11 Developer Preview provides not only parallelism on the task level, but also at the loop level, automatically. The C++ compiler will automatically vectorize loops if it is possible. Vectorization reorganizes a loop, for example, a summation loop, so that the CPU can execute multiple iterations at the same time. By using auto-vectorization, loops can be up to 8 times faster when executed on CPUs that support SIMD instructions. For example, most modern processors support SSE2 instructions, which allow the compiler to instruct the processor to do math operations on 4 numbers at a time.
Because the compiler recognizes loops that can be vectorized when you compile your code, this occurs automatically. Note that this differs from parallelization, which is described in the next list item.
Auto-parallelizer. Visual Studio 11 Developer Preview is improving the way you can take advantage of multiprocessor and multi-core hardware. With the the auto-parallelizer, a loop is reorganized so that it can be executed on multiple threads at the same time. This means that your application can take advantage of multi-core CPUs and multiprocessors to distribute chunks of the work to all available processors. The parallelizer automatically reorganizes loops and executes multiple tasks, all without the need for you to add any new code to your application. You can tell the compiler which loops to parallelize with the #pragma parallelize directive.
There are some key differences between auto-vectorization and auto-parallelization. First, auto-vectorization is always on and requires no user interaction, while auto-parallelization requires the programmer to decide which loops will be parallelized. Also, vectorization improves the performance of loops on single-core CPUs that support SIMD instructions, while parallelization improves the performance of the loop on multiple CPUs and multi-core CPUs. The two features can work together so that a vectorized loop is then parallelized across multiple processors.
C++ Accelerated Massive Parallelism (AMP) Support. C++ AMP accelerates the execution of your C++ code by taking advantage of the data parallel hardware that is ordinarily present as a GPU on a discrete graphics card. The C++ AMP programming model includes multidimensional arrays, indexing, memory transfer, tiling, and a mathematical function library. C++ AMP language extensions and compiler restrictions enable you to control how data is moved from the CPU to the GPU and back. For more information, see C++ Accelerated Massive Parallelism (C++ AMP).
Parallel Programming Improvements
With hardware moving to multi-core and many-core architectures, developers can no longer rely on ever-increasing clock speeds of single cores to enhance application performance. The parallel programming support in the C++ concurrency namespace enables developers to take advantage of these new architectures.
In Visual Studio 2010, we saw the introduction of powerful C++ parallelization libraries such as the Parallel Patterns Library. We also introduced concepts to take advantage of concurrency by expressing sophisticated dataflow pipelines. In Visual Studio 11 Developer Preview, these libraries have been extended to provide better performance, more control, and richer support for the parallel patterns developers need most. The breadth of the offering now includes:
Parallel patterns library, which supports fork-join parallelism (parallel_for, parallel_for with affinity, parallel_for_each, parallel_sort, parallel_reduce, parallel_transform).
A rich task-based programming model that supports asynchrony and continuations.
Agents and Messaging, which lets developers express dataflow pipelines that naturally decompose into concurrent units.
Concurrency-safe containers package, which provides thread-safe versions of std:: data structures such as priority_queue, queue, vector and map.
Customizable scheduler and resource manager to facilitate the smooth composition of the previously-listed patterns.
In Visual C++ in Visual Studio 11 Developer Preview, the integrated development environment (IDE) has significant improvements in tools to help you be more productive coding in C++. For more information about other IDE enhancements, see Product Highlights for Visual Studio 11 Developer Preview.
Visual Studio Templates support. You can now author C++ project and item templates using the Visual Studio Templates technology. This was previously unsupported for C++.
C++/CLI IntelliSense. C++/CLI now has full IntelliSense support. All the IntelliSense features such as Quick Info, Parameter Help, List Members, and Auto Completion now work for C++/CLI. In addition, the new IntelliSense and IDE enhancements listed in this topic also work for C++/CLI.
C++ Code Snippets. Skeleton code is available for basic code constructs, such as switch, if-else, and for loop, among others, in the List Members drop-down. Select a code snippet from the list to insert it into your code and then fill in the required logic. You can also create your own custom code snippets for use in the editor. For more information, see Code Snippets.
List Members Enhancements. The List Members drop-down appears automatically as you type code into the code editor. Results are filtered, so that only relevant members are displayed as you type. You can control the type of filtering logic used by the Member List in the Options dialog box under Text Editor, C/C++, Advanced. For more information, see Using IntelliSense.
Semantic Colorization. Additional C++ tokens, such as types, enumerations, and macros, among others, now have colorization. By default, this colorization is enabled. Parameters appear in italic. You can specify additional token colorizations in the Options dialog box under Environment, Fonts and Colors. For more information, see Code and Text Editor.
Reference Highlighting. Placing your pointer on a symbol now highlights all instances of the symbol in the current file. Press CTRL + SHIFT + UP ARROW or CTRL + SHIFT + DOWN ARROW to move among the highlighted references. You can turn this feature off in the Options dialog box under Text Editor, C/C++, Advanced.
In addition to the Parallel Tasks window and Parallel Stacks window available in Visual Studio 2010, Visual Studio 11 Developer Preview offers a new Parallel Watch window that lets you observe the values of an expression across all threads and processes, perform sorting and filtering on the result, and extend the window with your own visualizers. You will also be able to take advantage of the new multi-process support across all tool windows.
C++ Accelerated Massive Parallelism (AMP) Debugging and Profiling
Debugging. For applications that use C++ AMP to target the GPU, the familiar CPU debugging experience of Visual Studio is offered. This includes the new parallel debugging additions previously mentioned. Debugging C++ AMP apps is just like debugging any C++ app.
Profiling. There is now profiling support for GPU activity supporting C++ AMP and other Direct3D-based programming models.
Static Code Analysis
Static analysis for C++ has been updated to provide richer error context information, more analysis rules and better analysis results in the new Code Analysis window. In this window, you can now filter messages by keyword, project, and severity. Selecting a message in the window highlights the line in the source code editor where the message was triggered. For certain C++ warnings, the message will list source lines to show you the execution path that led to the warning.
Other code analysis enhancements include the following:
New concurrency warnings to help you make sure that the correct locking disciplines in multithreaded C/C++ programs. The analyzer detects several concurrency bugs. These include potential race conditions, lock order inversions, caller/callee locking contract violations, and mismatched synchronization operations.
You can specify the C++ analysis rules that you want to apply to code analysis runs by creating or using rule sets.
In the Code Analysis window, you can insert a pragma into the source code that suppresses a selected warning.
For more information, see Analyzing Application Quality by Using Code Analysis Tools.
Updated Unit Test Framework
Use the new C++ unit test framework in Visual Studio to write C++ unit tests. Add a new unit test project to your existing C++ solution by locating the C++ Unit Test Project template under the Visual C++ category in the New Project dialog box. Start writing your unit tests in the generated TEST_METHOD code stub in the Unittest1.cpp file. Once the test code is written, you can discover tests automatically as follows: Build the solution, and then open a Unit Test Explorer Window by clicking View->Other Windows->Unit Test Explorer. Run the tests by right-clicking the test case in Unit Test Explorer, and select Run selected test. You can then view test results and additional stack trace information in the same window after the test run finishes.
Architecture Dependency Graphs
To understand your code better, you can now generate dependency graphs for binary, class, namespace, and include files in your C++ solution or projects. Open menu Architecture->Generate Dependency Graph->Project or Solution to generate a dependency graph for your whole solution or a selected project. Once the graph generation is complete, you can explore the diagram by expanding each node, learn dependency relationships by moving between nodes, and browse source code by right-clicking the node and selecting View Content. To generate a dependency graph for include files, right-click a *.cpp source code file or *.h header file and select Generate Graph of Include Files.
Use layer diagrams to validate architecture design against implementation code written in C++. Create a new layer diagram by selecting menu Architecture->New Diagram->Layer Diagram. Start drawing the architecture by dragging and dropping shapes from the Toolbox window and then link projects, or by dragging and dropping existing projects from Solution Explorer onto the diagram directly. Once the architecture diagram is finished, right-click the diagram and select Validate Architecture to run validation against code. View results in theError List window (open from View menu). You can also generate dependencies with a right-click on the diagram and select Generate Dependencies. You can then visualize the actual code dependency on the layer diagram.
The architecture explorer lets you explore the assets in your C++ solution, projects, or files. Find architecture explorer from the menu Architecture -> Windows -> Architecture Explorer. Click on nodes you are interested in; for example, Class View. Then the tool window will be expanded on the right side with a list of all namespaces. Continue by selecting one namespace and a new column will be created on the right side to show a list of the classes, structs, and enums in this namespace. Continue to explore the assets by selecting nodes, or go back to the column on the far left to restart the query.
Code coverage has been updated to dynamically instrument binaries at runtime, which gives you lower configuration overhead and provides better performance. You can also collect code coverage data from unit tests for C++ applications within Visual Studio. Please see Unit Test Framework section of this topic to learn more about how to create and run unit tests. Once you have created C++ unit tests, you can use Unit Test Explorer to discover tests in your solution automatically. In Unit Test Explorer, select Analyze Code Coverage, which will run the unit tests and collect code coverage data for these tests. View the code coverage results in the Code Coverage Results window (Test->Windows->Code Coverage Results).