mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix darkroom: fix template operator() member-function call -> calcurate() free-function
This commit is contained in:
parent
3cb882ce91
commit
dfcb6bcf31
25 changed files with 494 additions and 129 deletions
49
sprout/darkroom/materials/calculate.hpp
Normal file
49
sprout/darkroom/materials/calculate.hpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2013 Bolero MURAKAMI
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_DARKROOM_MATERIALS_CALCULATE_HPP
|
||||
#define SPROUT_DARKROOM_MATERIALS_CALCULATE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/identity.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace darkroom {
|
||||
namespace materials {
|
||||
//
|
||||
// calculate_result
|
||||
//
|
||||
template<typename Image, typename Unit>
|
||||
struct calculate_result
|
||||
: public sprout::identity<typename Image::result_type>
|
||||
{};
|
||||
template<typename Image, typename Unit>
|
||||
struct calculate_result<Image const, Unit>
|
||||
: public sprout::darkroom::materials::calculate_result<Image, Unit>
|
||||
{};
|
||||
template<typename Image, typename Unit>
|
||||
struct calculate_result<Image volatile, Unit>
|
||||
: public sprout::darkroom::materials::calculate_result<Image, Unit>
|
||||
{};
|
||||
template<typename Image, typename Unit>
|
||||
struct calculate_result<Image const volatile, Unit>
|
||||
: public sprout::darkroom::materials::calculate_result<Image, Unit>
|
||||
{};
|
||||
|
||||
//
|
||||
// calculate
|
||||
//
|
||||
template<typename Image, typename Unit>
|
||||
inline SPROUT_CONSTEXPR typename sprout::darkroom::materials::calculate_result<Image, Unit>::type
|
||||
calculate(Image const& image, Unit const& u, Unit const& v) {
|
||||
return image(u, v);
|
||||
}
|
||||
} // namespace materials
|
||||
} // namespace darkroom
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_DARKROOM_MATERIALS_CALCULATE_HPP
|
Loading…
Add table
Add a link
Reference in a new issue