Skip to content

Commit 90bcd62

Browse files
committed
Including only necessary headers.
1 parent fd96720 commit 90bcd62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+221
-183
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ void boost_redis_from_bulk(mystruct& obj, char const* p, std::size_t size, boost
527527

528528
These functions are accessed over ADL and therefore they must be
529529
imported in the global namespace by the user. In the
530-
[Examples](#Examples) section the reader can find examples showing how
530+
[Examples](#examples) section the reader can find examples showing how
531531
to serialize using json and [protobuf](https://protobuf.dev/).
532532

533533
<a name="examples"></a>

examples/cpp17_intro.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
#include <iostream>
8-
#include <boost/asio.hpp>
98
#include <boost/redis.hpp>
109
#include <boost/redis/src.hpp>
1110

examples/cpp17_intro_sync.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7+
#include <boost/redis/operation.hpp>
8+
#include <boost/redis/request.hpp>
9+
#include <boost/redis/check_health.hpp>
10+
#include <boost/redis/run.hpp>
11+
#include <boost/asio/deferred.hpp>
12+
#include <boost/asio/use_future.hpp>
713
#include <tuple>
814
#include <string>
915
#include <chrono>
1016
#include <thread>
1117
#include <iostream>
12-
#include <boost/asio.hpp>
13-
#include <boost/redis.hpp>
14-
#include <boost/redis/check_health.hpp>
1518

1619
// Include this in no more than one .cpp file.
1720
#include <boost/redis/src.hpp>

examples/cpp20_chat_room.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/asio.hpp>
8-
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
9-
#include <iostream>
10-
namespace net = boost::asio;
11-
#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
12-
#include <boost/asio/experimental/awaitable_operators.hpp>
13-
#include <boost/redis.hpp>
7+
#include <boost/redis/run.hpp>
148
#include <boost/redis/check_health.hpp>
9+
#include <boost/asio/use_awaitable.hpp>
10+
#include <boost/asio/signal_set.hpp>
11+
#include <boost/asio/posix/stream_descriptor.hpp>
12+
#include <boost/asio/experimental/awaitable_operators.hpp>
1513
#include <unistd.h>
14+
#include <iostream>
15+
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
16+
#if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
1617

18+
namespace net = boost::asio;
1719
using namespace net::experimental::awaitable_operators;
1820
using stream_descriptor = net::use_awaitable_t<>::as_default_on_t<net::posix::stream_descriptor>;
1921
using signal_set = net::use_awaitable_t<>::as_default_on_t<net::signal_set>;
2022
using boost::redis::request;
2123
using boost::redis::generic_response;
2224
using boost::redis::async_check_health;
2325
using boost::redis::async_run;
24-
using connection = boost::asio::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
26+
using connection = net::use_awaitable_t<>::as_default_on_t<boost::redis::connection>;
2527

2628
// Chat over Redis pubsub. To test, run this program from multiple
2729
// terminals and type messages to stdin.

examples/cpp20_containers.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/asio.hpp>
8-
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
9-
#include <boost/redis.hpp>
7+
#include <boost/redis/run.hpp>
8+
#include <boost/asio/use_awaitable.hpp>
9+
#include <boost/asio/detached.hpp>
10+
#include <boost/asio/co_spawn.hpp>
1011
#include <map>
1112
#include <vector>
1213
#include <iostream>
1314

15+
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
16+
1417
namespace net = boost::asio;
1518
namespace redis = boost::redis;
1619
using boost::redis::request;

examples/cpp20_echo_server.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/asio.hpp>
8-
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
9-
#include <boost/asio/experimental/awaitable_operators.hpp>
10-
#include <boost/redis.hpp>
7+
#include <boost/redis/run.hpp>
118
#include <boost/redis/check_health.hpp>
9+
#include <boost/asio/use_awaitable.hpp>
10+
#include <boost/asio/signal_set.hpp>
11+
#include <boost/asio/detached.hpp>
12+
#include <boost/asio/experimental/awaitable_operators.hpp>
13+
14+
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
1215

1316
namespace net = boost::asio;
1417
using namespace net::experimental::awaitable_operators;

examples/cpp20_intro.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/asio.hpp>
8-
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
9-
#include <boost/redis.hpp>
7+
#include <boost/redis/run.hpp>
8+
#include <boost/asio/use_awaitable.hpp>
9+
#include <boost/asio/co_spawn.hpp>
10+
#include <boost/asio/detached.hpp>
1011
#include <iostream>
1112

13+
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
14+
1215
namespace net = boost::asio;
1316
using boost::redis::request;
1417
using boost::redis::response;

examples/cpp20_intro_awaitable_ops.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7+
#include <boost/redis/run.hpp>
8+
#include <boost/asio/use_awaitable.hpp>
9+
#include <boost/asio/experimental/awaitable_operators.hpp>
710
#include <iostream>
8-
#include <boost/asio.hpp>
911
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
10-
#include <boost/asio/experimental/awaitable_operators.hpp>
11-
#include <boost/redis.hpp>
1212

1313
namespace net = boost::asio;
1414
using namespace net::experimental::awaitable_operators;

examples/cpp20_intro_tls.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7+
#include <boost/redis/ssl/connection.hpp>
8+
#include <boost/redis/ssl/connection.hpp>
9+
#include <boost/asio/use_awaitable.hpp>
10+
#include <boost/asio/experimental/awaitable_operators.hpp>
11+
#include <boost/asio/ssl.hpp>
12+
#include <boost/asio/connect.hpp>
713
#include <tuple>
814
#include <string>
915
#include <iostream>
1016

11-
#include <boost/asio.hpp>
1217
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
13-
#include <boost/asio/experimental/awaitable_operators.hpp>
14-
#include <boost/asio/ssl.hpp>
15-
16-
#include <boost/redis.hpp>
17-
#include <boost/redis/ssl/connection.hpp>
1818

1919
namespace net = boost::asio;
2020
namespace redis = boost::redis;

examples/cpp20_json.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/asio.hpp>
8-
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
9-
#define BOOST_JSON_NO_LIB
10-
#define BOOST_CONTAINER_NO_LIB
11-
#include <boost/redis.hpp>
7+
#include <boost/redis/run.hpp>
8+
#include <boost/asio/use_awaitable.hpp>
9+
#include <boost/asio/detached.hpp>
10+
#include <boost/asio/co_spawn.hpp>
1211
#include <boost/describe.hpp>
1312
#include <string>
1413
#include <iostream>
1514
#include "json.hpp"
15+
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
1616

1717
// Include this in no more than one .cpp file.
18+
#define BOOST_JSON_NO_LIB
19+
#define BOOST_CONTAINER_NO_LIB
1820
#include <boost/json/src.hpp>
1921

2022
namespace net = boost::asio;

0 commit comments

Comments
 (0)