Generic Image Library: dynamic_at_c.hpp File Reference

Modules | Alphabetical List | Class List | Directories | File List | GIL Home Page

# dynamic_at_c.hpp File Reference

## Detailed Description

Constructs for static-to-dynamic integer convesion.

Author:
  Lubomir Bourdev and Hailin Jin
  Adobe Systems Incorporated

Date:
  2005-2007
  Last updated on May 4, 2006

`#include "../../gil_config.hpp"`
`#include <cassert>`
`#include <stdexcept>`
`#include <boost/mpl/at.hpp>`
`#include <boost/mpl/size.hpp>`

Go to the source code of this file.

## Namespaces

namespace | boost
namespace | boost::gil
namespace | boost::gil::detail
namespace | boost::gil::detail::at_c

## Defines

#define | GIL_AT_C_VALUE(z, N, text) mpl::at_c<IntTypes,S+N>::type::value,
#define | GIL_DYNAMIC_AT_C_LIMIT 226
#define | GIL_AT_C_LOOKUP(z, NUM, text)

## Functions

template<typename IntTypes, typename ValueType>
ValueType | at_c (std::size_t index)
| Given an MPL Random Access Sequence and a dynamic index n, returns the value of the n-th element It constructs a lookup table at compile time.

## Define Documentation

#define GIL_AT_C_LOOKUP | ( | z,
|  | NUM,
|  | text |  | ) |

Value:

    template<std::size_t S>                                             \
        struct at_c_fn<S,NUM> {                                             \
        template <typename IntTypes, typename ValueType> inline           \
            static ValueType apply(std::size_t index) {                    \
                static ValueType table[] = {                               \
                    BOOST_PP_REPEAT(NUM, GIL_AT_C_VALUE, BOOST_PP_EMPTY)    \
                };                                                          \
                return table[index];                                        \
            }                                                               \
        };