...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::compute::field
// In header: <boost/compute/functional/field.hpp> template<typename T> class field { public: // types typedef T result_type; // Result type. // construct/copy/destruct field(const std::string &); };
Returns the named field from a value.
The template-type T
specifies the field's value type. Note that the value type must match the actual type of the field otherwise runtime compilation or logic errors may occur.
For example, to access the second
field in a std::pair<int, float>
object:
field<float>("second");
This can also be used with vector types to access individual components as well as perform swizzle operations.
For example, to access the first and third components of an int
vector type (e.g. int4
):
field<int2_>("xz");
See Also: