fill.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*!
  2. @file
  3. Forward declares `boost::hana::fill`.
  4. @copyright Louis Dionne 2013-2017
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_FWD_FILL_HPP
  9. #define BOOST_HANA_FWD_FILL_HPP
  10. #include <boost/hana/config.hpp>
  11. #include <boost/hana/core/when.hpp>
  12. BOOST_HANA_NAMESPACE_BEGIN
  13. //! Replace all the elements of a structure with a fixed value.
  14. //! @ingroup group-Functor
  15. //!
  16. //!
  17. //! Signature
  18. //! ---------
  19. //! Given `F` a Functor, the signature is
  20. //! \f$
  21. //! \mathtt{fill} : F(T) \times U \to F(U)
  22. //! \f$
  23. //!
  24. //! @param xs
  25. //! The structure to fill with a `value`.
  26. //!
  27. //! @param value
  28. //! A value by which every element `x` of the structure is replaced,
  29. //! unconditionally.
  30. //!
  31. //!
  32. //! Example
  33. //! -------
  34. //! @include example/fill.cpp
  35. #ifdef BOOST_HANA_DOXYGEN_INVOKED
  36. constexpr auto fill = [](auto&& xs, auto&& value) {
  37. return tag-dispatched;
  38. };
  39. #else
  40. template <typename Xs, typename = void>
  41. struct fill_impl : fill_impl<Xs, when<true>> { };
  42. struct fill_t {
  43. template <typename Xs, typename Value>
  44. constexpr auto operator()(Xs&& xs, Value&& value) const;
  45. };
  46. constexpr fill_t fill{};
  47. #endif
  48. BOOST_HANA_NAMESPACE_END
  49. #endif // !BOOST_HANA_FWD_FILL_HPP