remove_volatile
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function Usage
Removes the volatile qualifier from the input template parameter type during program compilation. This API can be used for type conversion during compilation.
Prototype
1 2 | template <typename Tp> struct remove_volatile; |
Parameters
Parameter |
Description |
|---|---|
Tp |
Types to be processed, including basic types (such as int and float), composite types (such as array, pointer, and reference), user-defined types (such as class and struct), and volatile-qualified types. |
Restrictions
None
Returns
remove_volatile is a struct that provides a nested type, representing the type after the volatile qualifier is removed. This type can be accessed through remove_volatile<Tp>::type.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 | // Test non-volatile type ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<int>::type, int>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<double>::type, double>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<char>::type, char>)); // Test volatile type ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<volatile int>::type, int>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<volatile double>::type, double>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile<volatile char>::type, char>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile_t<int>, int>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile_t<double>, double>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile_t<volatile int>, int>)); ascendc_assert((AscendC::Std::is_same_v<AscendC::Std::remove_volatile_t<volatile double>, double>)); |