Download presentation
Presentation is loading. Please wait.
Published byEustace Collins Modified over 9 years ago
5
C++
17
+ r1 r2 r3 add r3, r1, r2 SCALAR (1 operation) v1 v2 v3 + vector length vadd v3, v1, v2 VECTOR (N operations)
18
// STL – pointers everywhere; not even a loop counter variable void transform1(int const* first1, int const* last1, int const* first2, int* result) { while (first1 != last1) { //converted to integer *result++ = *first1++ + *first2++; // make these array references } // DirectX – no loops here! Vectorize operations on adjacent memory cells XMVECTOR four_vector_example(XMVECTOR V) { XMVECTOR Result; Result.vector4_f32[0] = 1.f / V.vector4_f32[0]; Result.vector4_f32[1] = 1.f / V.vector4_f32[1]; Result.vector4_f32[2] = 1.f / V.vector4_f32[2]; Result.vector4_f32[3] = 1.f / V.vector4_f32[3]; return Result; } // Machine Vision Library void machine_vision_filter_example (int* A, int boxStart) { for (int i = 0; i < 100; i++) A[boxStart + i] = A[boxStart + i] + 1; }
20
#include "amp.h" using namespace concurrency; void square_array(float* arr, int n) { // Create a view over the data on the CPU array_view dataView(n, &arr[0]); // Run code on the GPU parallel_for_each(dataView.extent, [=](index idx) restrict(amp) { dataView[idx] = dataView[idx] * dataView[idx]; }); // Copy data from GPU to CPU dataView.synchronize(); }
23
C++
24
High confidence Med confidence VC++ CTP.next (upcoming)
25
int main() { std::map m { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } }; }
26
void f() { char* p = "\"Hello, world!\""; char* q = R"("Hello, world!")"; char* r = R"("Hello, """""""" world!")"; char* s = R"("Hello, \ \ \ \ \ world!")"; char* p = R"("Hello, many-lined world!")"; }
27
void f() { int x = 0; int y(0); int z{0}; }
28
class NonCopyable { public: NonCopyable() { /*... */ } NonCopyable(NonCopyable const&) = delete; NonCopyable& operator=(NonCopyable const&) = delete; };
29
class C { public: C(int x) { /*... */ } C() = default; };
30
typedef struct S { int x; int y; int z; } S; void f() { S a = {.x = 1,.y = 2,.z = 3 }; }
31
int f() { int x = foo(); if (x != 0) return -1; int y = bar(); if (y != 0) return -1; return 0; }
36
std::sort(v.begin(), v.end()); std::experimental::parallel::sort(par, v.begin(), v.end());
41
C++
43
No need to scroll away to see matches!
47
Switching configurations in the property pages makes this weird glitch happen :( Crashes on empty project C++ when IntelliSense should come up... ****ing C++ lang, that is bugging me all the time Thanks for amazing tool to write c++ apps! std::vector v = { "a", "b", "c" }; initializer for std collections Thanks a lot, xoxoxo Error C2227 is not in the help files, off or online.
49
C++
55
Having a friend buy your coffee? Yea, it’s kind of like that. MSDN Subscribers get up to $150/mo in Azure credits. Stop by the Developer Platform and Tools booth and visit the MSDN Subscriptions station to activate your benefits and receive a gift! http://aka.ms/msdn_teched 3 Steps to New Gear! With Application Insights
56
Microsoft Engineering Stories Visual Studio Industry Partner Program Visual Studio | Integrate http://www.visualstudio.com
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.