Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to Program C++/CX Room metro Tokyo #3 2014/1/18 Sat Sao Haruka.

Similar presentations


Presentation on theme: "How to Program C++/CX Room metro Tokyo #3 2014/1/18 Sat Sao Haruka."— Presentation transcript:

1 How to Program C++/CX Room metro Tokyo #3 2014/1/18 Sat Sao Haruka

2 @hr_sao Community – Osaka Japan Room metro Reading Community - C++ Templates: The Complete Guide Microsoft MVP for Client Development [(Jan,2010 -)Jan, Dec,2014] About me

3 How to program? Windows Store Apps for C++/CX

4 OS process Dev Env WindowsStoreApps(UI XAML) Windows Kernel Services Windows RuntimeWin32 and COM CRT STLPPL App container ( package manifest ) UI controls ( XAML ) App-defined ref classes for cross- language interop Implimentation class (C++ native) VS Project Template C++/CX Do not mix. Hazardous.

5 Use lambda expression #include "stdafx.h" #include int _tmain(int argc, _TCHAR* argv[]) { [ ]( std::string const &str ) // argument { std::cout << str << std::endl; } // define function ( “Hello World!“ ); // call function return 0; } []: lambda-capture (): argument {}: function - source code (): call function Use lambda to PPL task, STL and so on

6 Use smart pointers 変数名 Windows Runtime variable ^ (hat) COM cariable Microsoft::WRL::ComPtr the others std::shared_ptr / std::unique_ptr

7 Automatic type deduction Use return value auto decoder = make_shared (nullptr); And Use data collection for (auto file : files) { auto photo = ref new Photo(file, ……); }

8 Be aware of overhead for type conversion ref class via Platform/Windows namespace For exsample You use as a Windows::Foundation::Collections::Vector^ std::vector vector vec_a; b = ref new Vector (std::move( vec_a )); for move semantics

9 to understand your app's.winmd output ref class -> on the premise of public ->.winmd that contains metadata for all the public ref types -> beyond the ABI permeter! Don’t expose to unnecessary class To use the ref class for cross-language interop

10 and so on…

11 Add C++11 Add C++14 Add C++17(?) WinVista/7/8/8.1 Visual C++ CompilerNovember 2013 CTP

12 Take care Let’s C++/CX Life


Download ppt "How to Program C++/CX Room metro Tokyo #3 2014/1/18 Sat Sao Haruka."

Similar presentations


Ads by Google