diff --git a/sprout/array/make_array.hpp b/sprout/array/make_array.hpp index ca6b4ffb..1d6fe2c8 100644 --- a/sprout/array/make_array.hpp +++ b/sprout/array/make_array.hpp @@ -25,7 +25,7 @@ namespace sprout { make_array(Types&&... args) { return sprout::array::type, sizeof...(Types)>{{T(sprout::forward(args))...}}; } - // !!! + // !!! OLD: // template // inline SPROUT_CONSTEXPR sprout::array::type, sizeof...(Types)> // make_array(Types&&... args) { diff --git a/sprout/checksum/sha1.hpp b/sprout/checksum/sha1.hpp index 1174e878..887a2cb4 100644 --- a/sprout/checksum/sha1.hpp +++ b/sprout/checksum/sha1.hpp @@ -167,7 +167,7 @@ namespace sprout { 64, bit_count_ + 64 * 8 ) - // !!! + // !!! TEMP: // : process( // h_, // sprout::make_array(args...), @@ -192,7 +192,7 @@ namespace sprout { bit_count_ + sizeof...(Args) * 8 ) : block_byte_index_ + sizeof...(Args) == 64 - // !!! + // !!! TEMP: // ? process( // h_, // sprout::get_internal(sprout::range::fixed::copy(sprout::make_array(args...), sprout::sub(block_, block_byte_index_))), diff --git a/sprout/darkroom/objects/polygon/triangle.hpp b/sprout/darkroom/objects/polygon/triangle.hpp index cf086087..f1d8d7b4 100644 --- a/sprout/darkroom/objects/polygon/triangle.hpp +++ b/sprout/darkroom/objects/polygon/triangle.hpp @@ -72,9 +72,9 @@ namespace sprout { ? sprout::darkroom::rays::point_of_intersection(ray, distance) : position_type(0, 0, 0) , - normal_,//hit_side > 0 ? normal_ : sprout::darkroom::coords::negate(normal_), + normal_,// !!! TEMP: hit_side > 0 ? normal_ : sprout::darkroom::coords::negate(normal_), sprout::darkroom::materials::calculate_material(mat_, unit_type(0), unit_type(0)), // ??? - false // !!! is_from_inside + false // !!! TEMP: is_from_inside ); } template diff --git a/sprout/iterator/const_iterator_cast.hpp b/sprout/iterator/const_iterator_cast.hpp new file mode 100644 index 00000000..ab48fee4 --- /dev/null +++ b/sprout/iterator/const_iterator_cast.hpp @@ -0,0 +1,144 @@ +/*============================================================================= + 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_ITERATOR_CONST_ITERATOR_CAST_HPP +#define SPROUT_ITERATOR_CONST_ITERATOR_CAST_HPP + +#include +#include +#include +#include +#include +#include + +namespace sprout { + // + // is_const_iterator_cast_convertible + // + template + struct is_const_iterator_cast_convertible + : public sprout::false_type + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public sprout::is_const_iterator_cast_convertible + {}; + template + struct is_const_iterator_cast_convertible + : public std::is_same::type, typename std::remove_const::type> + {}; + +// // +// // pointer_add_const +// // +// template +// struct pointer_add_const +// : public std::add_const +// {}; +// template +// struct pointer_add_const +// : public sprout::identity::type*> +// {}; +} // namespace sprout + +namespace sprout_adl { + template + sprout::not_found_via_adl const_iterator_conversion(...); +} // namespace sprout_adl + +namespace sprout { + namespace iterator_detail { + template< + typename T, + typename U, + typename sprout::enabler_if::value>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR T + const_iterator_conversion(U* it) { + return const_cast(it); + } + } // namespace iterator_detail +} // namespace sprout + +namespace sprout_iterator_detail { + template + inline SPROUT_CONSTEXPR To + const_iterator_cast(From const& it) { + using sprout::iterator_detail::const_iterator_conversion; + using sprout_adl::const_iterator_conversion; + return const_iterator_conversion(it); + } +} // namespace sprout_iterator_detail + +namespace sprout { + // + // const_iterator_cast + // + template + inline SPROUT_CONSTEXPR To + const_iterator_cast(From const& it) { + return sprout_iterator_detail::const_iterator_cast(it); + } +} // namespace sprout + +#endif // #ifndef SPROUT_ITERATOR_CONST_ITERATOR_CAST_HPP diff --git a/sprout/iterator/index_iterator.hpp b/sprout/iterator/index_iterator.hpp index 08c2552d..58ce1c3b 100644 --- a/sprout/iterator/index_iterator.hpp +++ b/sprout/iterator/index_iterator.hpp @@ -16,10 +16,13 @@ #include #include #include +#include #include #include #include #include +#include +#include namespace sprout { // @@ -283,6 +286,26 @@ namespace sprout { iterator_prev(sprout::index_iterator const& it) { return it.prev(); } + + // + // is_const_iterator_cast_convertible + // + template + struct is_const_iterator_cast_convertible, sprout::index_iterator > + : public std::is_same::type, typename std::decay::type> + {}; + // + // const_iterator_conversion + // + template< + typename T, + typename Container, bool C, + typename sprout::enabler_if, T>::value>::type = sprout::enabler + > + inline SPROUT_CONSTEXPR T + const_iterator_conversion(sprout::index_iterator const& it) { + return T(const_cast(it.base()), it.index()); + } } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_INDEX_ITERATOR_HPP diff --git a/sprout/math/cos.hpp b/sprout/math/cos.hpp index c1672cdb..cc70a64c 100644 --- a/sprout/math/cos.hpp +++ b/sprout/math/cos.hpp @@ -60,7 +60,7 @@ namespace sprout { ); } - // !!! + // !!! OLD: // template // inline SPROUT_CONSTEXPR T // cos_impl_2(T x) { diff --git a/sprout/optional/optional.hpp b/sprout/optional/optional.hpp index 889ff6d4..f177db9d 100644 --- a/sprout/optional/optional.hpp +++ b/sprout/optional/optional.hpp @@ -120,7 +120,7 @@ namespace sprout { : init(true) , val(v) {} - // !!! for T const& + // !!! TEMP: for T const& // SPROUT_CONSTEXPR optional(T&& v) // : init(true) // , val(sprout::move(v)) @@ -145,7 +145,7 @@ namespace sprout { : init(cond) , val(cond ? holder_type(v) : holder_type()) {} - // !!! for T const& + // !!! TEMP: for T const& // SPROUT_CONSTEXPR optional(bool cond, T&& v) // : init(cond) // , val(cond ? holder_type(sprout::move(v)) : holder_type())