STIR  6.2.0
Namespaces
assign.h File Reference

defines the stir::assign function to assign values to different data types More...

#include "stir/VectorWithOffset.h"
#include "stir/Array.h"
#include "stir/BasicCoordinate.h"
#include <vector>

Go to the source code of this file.

Namespaces

 stir
 Namespace for the STIR library (and some/most of its applications)
 

Functions

templated functions for assigning values

When writing templated code, it is sometimes not possible to use operator=() for assignment, e.g. when the classes do not support that operator. The assign template tries to alleviate this problem by providing several overloads when the first argument is a (STIR) container.

Usage
assign(x,y); // logically equivalent to x=y;
Design consideration
We could have overloaded operator=() instead, but that would probably lead to surprising conversions.
template<class T , class T2 >
void stir::assign (T &x, const T2 &y)
 
template<class T , class T2 >
void stir::assign (std::vector< T > &v, const T2 &y)
 
template<int num_dimensions, class T , class T2 >
void stir::assign (BasicCoordinate< num_dimensions, T > &v, const T2 &y)
 
template<class T , class T2 >
void stir::assign (VectorWithOffset< T > &v, const T2 &y)
 
template<int num_dimensions, class T , class T2 >
void stir::assign (Array< num_dimensions, T > &v, const T2 &y)
 
void stir::assign (double &x, const int y)
 
void stir::assign (float &x, const int y)
 

Detailed Description

defines the stir::assign function to assign values to different data types

Author
Kris Thielemans