how to program c ++/ cx

12

Click here to load reader

Upload: holly

Post on 23-Mar-2016

18 views

Category:

Documents


0 download

DESCRIPTION

How to Program C ++/ CX. Room metro Tokyo #3 2014/1/18 Sat Sao Haruka. About me. @ hr_sao Community – Osaka Japan Room metro Reading Community - C ++ Templates: The Complete Guide Microsoft MVP for Client Development [(Jan,2010 -)Jan,2013 - Dec,2014] . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: How to Program C ++/ CX

How to Program C++/CXRoom metro Tokyo #32014/1/18 Sat

Sao Haruka

Page 2: How to Program C ++/ CX

@hr_saoCommunity – Osaka Japan• Room metro• Reading Community - C++ Templates: The Complete GuideMicrosoft MVP for Client Development  [(Jan,2010 -)Jan,2013 - Dec,2014]

About me

Page 3: How to Program C ++/ CX

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

Page 4: How to Program C ++/ CX

OS process

Dev Env WindowsStoreApps(UI XAML)http://msdn.microsoft.com/ja-jp/library/windows/apps/jj160326.aspx

Windows Kernel ServicesWindows Runtime Win32 and COM CRT STL PPL

App container ( package manifest )

UI controls( XAML )

App-defined ref classes for cross-language interop Implimentation

class(C++ native)VS Project

TemplateC++/CX

Do not mix. Hazardous.

Page 5: How to Program C ++/ CX

Use lambda expression#include "stdafx.h"#include <string>#include <iostream>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

Page 6: How to Program C ++/ CX

Use smart pointers変数名

Windows Runtime variable

^ (hat)

COM cariable Microsoft::WRL::ComPtr

the others std::shared_ptr / std::unique_ptr

Page 7: How to Program C ++/ CX

Automatic type deductionUse return valueauto decoder = make_shared<BitmapDecoder^>(nullptr);

And Use data collectionfor (auto file : files){ auto photo = ref new Photo(file, ……);}

Page 8: How to Program C ++/ CX

Be aware of overhead for type conversionref class  via Platform/Windows namespace

For exsample You use as a Windows::Foundation::Collections::Vector^ std::vectorvector<AAA^> vec_a;b = ref new Vector<AAA^>(std::move( vec_a ));for move semantics

Page 9: How to Program C ++/ CX

to understand your app's .winmd outputref 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 classTo use the ref class for cross-language interop

Page 10: How to Program C ++/ CX

and so on…http://msdn.microsoft.com/ja-jp/library/windows/apps/jj160326.aspx

Page 11: How to Program C ++/ CX

http://www.microsoft.com/en-us/download/details.aspx?id=41151

Add C++11Add C++14Add C++17(?)

WinVista/7/8/8.1

Visual C++ CompilerNovember 2013 CTP

http://hilo.codeplex.com/

Page 12: How to Program C ++/ CX

Take care

Let’s C++/CX Life