2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2016-02-25 09:48:28 +00:00
|
|
|
Copyright (c) 2011-2016 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2011-11-26 06:20:35 +00:00
|
|
|
#ifndef SPROUT_DARKROOM_ACCESS_ACCESS_HPP
|
|
|
|
#define SPROUT_DARKROOM_ACCESS_ACCESS_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2014-04-30 07:30:26 +00:00
|
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
2011-11-26 06:20:35 +00:00
|
|
|
#include <sprout/tuple/tuple.hpp>
|
|
|
|
#include <sprout/utility/forward.hpp>
|
2013-09-24 06:08:36 +00:00
|
|
|
#include <sprout/darkroom/access/traits.hpp>
|
2011-11-26 06:20:35 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace darkroom {
|
|
|
|
namespace access {
|
|
|
|
//
|
|
|
|
// element
|
|
|
|
//
|
|
|
|
template<std::size_t I, typename T>
|
|
|
|
struct element
|
|
|
|
: public sprout::tuples::tuple_element<I, T>
|
|
|
|
{};
|
|
|
|
//
|
|
|
|
// size
|
|
|
|
//
|
|
|
|
template<typename T>
|
|
|
|
struct size
|
|
|
|
: public sprout::tuples::tuple_size<T>
|
|
|
|
{};
|
|
|
|
//
|
|
|
|
// unit
|
|
|
|
//
|
|
|
|
template<typename T>
|
|
|
|
struct unit
|
|
|
|
: public sprout::darkroom::access::element<0, T>
|
|
|
|
{};
|
|
|
|
//
|
|
|
|
// get
|
|
|
|
//
|
|
|
|
template<std::size_t I, typename T>
|
2012-10-05 15:58:56 +00:00
|
|
|
inline SPROUT_CONSTEXPR auto
|
|
|
|
get(T&& t)
|
2014-08-14 13:55:49 +00:00
|
|
|
SPROUT_NOEXCEPT_IF_EXPR(sprout::tuples::get<I>(SPROUT_FORWARD(T, t)))
|
2014-02-22 07:32:51 +00:00
|
|
|
-> decltype(sprout::tuples::get<I>(SPROUT_FORWARD(T, t)))
|
2011-11-26 06:20:35 +00:00
|
|
|
{
|
2014-02-22 07:32:51 +00:00
|
|
|
return sprout::tuples::get<I>(SPROUT_FORWARD(T, t));
|
2011-11-26 06:20:35 +00:00
|
|
|
}
|
|
|
|
} // namespace access
|
|
|
|
} // namespace darkroom
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DARKROOM_ACCESS_ACCESS_HPP
|