Static_cast tempplate changes and correct the condition check in all C++...

...AMP routines