visual c++ - task<...> construction vs create_task -
according asynchronous programming in c++ (windows store apps):
// explicit construction. (not recommended) // pass iasyncoperation task constructor. // task<deviceinformationcollection^> deviceenumtask(deviceop); // recommended: auto deviceenumtask = create_task(deviceop);
why assignment (create_task
) preferred on construction?
i think you're bound either way. you're bound class you're constructing factory interface may using , subject maintaining compatibility whatever changes made public interfaces utilitized in implementation. disruptive changes possible in either location. microsoft's answer question comes create_task() documentation: create_task() convenience function allows use of 'auto' keyword while creating tasks. http://msdn.microsoft.com/en-us/library/vstudio/hh913025.aspx
Comments
Post a Comment