# Reference

## boost::redis::request::push_range

Appends a new command to the end of the request.

### Synopsis

Declared in `<boost/redis/request.hpp>`

    template<class ForwardIterator>
    void
    push_range(
        std::string_view cmd,
        std::string_view key,
        ForwardIterator begin,
        ForwardIterator end,
        std::iterator_traits<ForwardIterator>::value_type* = nullptr);

### Description

This overload is useful for commands that have a key and have a dynamic range of arguments. For example:

    std::map<std::string, std::string> map
       { {"key1", "value1"}
       , {"key2", "value2"}
       , {"key3", "value3"}
       };

    request req;
    req.push_range("HSET", "key", map.cbegin(), map.cend());

Command arguments should either be convertible to `std::string_view` or support the `boost_redis_to_bulk` function. This function is a customization point that must be made available using ADL and must have the following signature:

    void boost_redis_to_bulk(std::string& to, T const& t);

See cpp20_serialization.cpp

### Template Parameters

Name | Description
ForwardIterator | A forward iterator with an element type that is convertible to `std::string_view` or supports `boost_redis_to_bulk`.

### Parameters

Name | Description
cmd | The command to execute. It should be a redis or sentinel command, like `"SET"`.
key | The command key. It will be added as the first argument to the command.
begin | Iterator to the begin of the range.
end | Iterator to the end of the range.

Created with MrDocs