Tool Classes
[lite array - A C++ Multidimensional Array Library]

Classes

class  lite::constant< type_, value_ >
 This class can be used to encapsulate an element of a lite::pack as a constant element. More...
class  lite::pack< type0_..., typeN_ >
 This is a general tuple class that can pack together elements of different types. Furthermore, individual elements can be marked as constant so that they won't occupy memory in the pack object. More...
class  lite::sub_pack< pack_type_, keep0_..., keepN_ >
 This class can be used to define and extract a subset of element of a pack as another pack. More...
struct  lite::get_type< index_, type_ >
 This class can be used to retrieve the type of the elements of a pack type. More...

Functions

template<int index_, typename type_ >
get_type< index_, type_ >::type lite::get (const type_ &a)
template<int index_, typename type_ , typename value_type_ >
void lite::set (type_ &a, const value_type_ &v)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator< (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator<= (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator== (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator>= (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator> (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator!= (const pack< l_type0_,..., l_typeN_ > &a, const pack< r_type0_,..., r_typeN_ > &b)
template<typename char_type_ , typename traits_type_ , typename type0_ , ... , typename typeN_ >
std::basic_ostream< char_type_,
traits_type_ > & 
lite::operator<< (std::basic_ostream< char_type_, traits_type_ > &os, const pack< type0_,..., typeN_ > &p)
 Prints the pack p to the output stream os.
template<typename char_type_ , typename traits_type_ , typename type0_ , ... , typename typeN_ >
std::basic_istream< char_type_,
traits_type_ > & 
lite::operator>> (std::basic_istream< char_type_, traits_type_ > &is, pack< type0_,..., typeN_ > &p)
 Scans (reads) the pack p from the input stream is.
template<typename left_size_type_ , typename right_size_type_ >
void lite::lite_array_size_check (const left_size_type_ &a, const right_size_type_ &b, const std::string &msg)

Function Documentation

template<int index_, typename type_ >
get_type<index_, type_>::type lite::get ( const type_ &  a  )  [inline]

This can be used to retrieve the elements of a pack type. This is useful if the index of the element is computed as the result of a compile time expression.

Example:
        typedef pack<int, constant<int, 5>, std::string> Pack;

        Pack p(1, 0, "hello");
        get_type<1, Pack>::type& ref = get<1>(p);
        std::cout << ref << std::endl;

The output would be:

        5
    
template<typename left_size_type_ , typename right_size_type_ >
void lite::lite_array_size_check ( const left_size_type_ &  a,
const right_size_type_ &  b,
const std::string &  msg 
) [inline]

This function will throw a lite::size_mismatch_error exception containing the message msg if a != b.

template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator!= ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if !(a == b) . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator< ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if < b . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename char_type_ , typename traits_type_ , typename type0_ , ... , typename typeN_ >
std::basic_ostream<char_type_, traits_type_>& lite::operator<< ( std::basic_ostream< char_type_, traits_type_ > &  os,
const pack< type0_,..., typeN_ > &  p 
) [inline]

Prints the pack p to the output stream os.

If the field width value for os is set, it will be used to set the field width for each of the elements to be printed. Also if the boolalpha flags is set then the output will be surrounded in a matching pair of square brackets.

Example:
        pack<int, constant<int, 5>, int> p(1, 0, 11);
        std::cout << std::boolalpha  << std::setw(2) << p << std::endl;

The output would be:

        [ 1  5 11]
    
template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator<= ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if <= b . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator== ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if == b . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator> ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if > b . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename l_type0_ , ... , typename l_typeN_ , typename r_type0_ , ... , typename r_typeN_ >
bool lite::operator>= ( const pack< l_type0_,..., l_typeN_ > &  a,
const pack< r_type0_,..., r_typeN_ > &  b 
) [inline]

Compares the elements of a and b lexicographically and returns true only if >= b . Note that a and b could be of different pack types but they should contain the same number of elements.

template<typename char_type_ , typename traits_type_ , typename type0_ , ... , typename typeN_ >
std::basic_istream<char_type_, traits_type_>& lite::operator>> ( std::basic_istream< char_type_, traits_type_ > &  is,
pack< type0_,..., typeN_ > &  p 
) [inline]

Scans (reads) the pack p from the input stream is.

The input could be surrounded in a matching pair of square brackets. The constant elements are read from the input stream but their input value will be ignored.

Example:
        pack<int, constant<int, 5>, int> p;
        std::cin >> p;
        std::cout << p << std::endl;

If the input is:

        [1 2 3]
    

The output would be:

        [1 5 3]
    
template<int index_, typename type_ , typename value_type_ >
void lite::set ( type_ &  a,
const value_type_ &  v 
) [inline]

This can be used to set the elements of a pack type. This is useful if the index of the element is computed as the result of a compile time expression or if the element might be a static const. If the element specified by index_ is a static const then this function does nothing.

Example:
        typedef pack<int, constant<int, 5>, std::string> Pack;

        Pack p(1, 0, "hello");
        set<0>(p, 10);
        set<1>(p, 11);      // has no effect
        set<2>(p, "bye");
        std::cout << p << std::endl;

The output would be:

        10 5 bye
    
 All Classes Namespaces Files Functions Variables Typedefs Defines

Generated on Fri Nov 6 02:03:21 2009 for Lite by  doxygen 1.6.0