Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
concepts.h File Reference

Unified header for all C++20 concepts in network_system. More...

Include dependency graph for concepts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  kcenon::network::concepts
 C++20 concepts for compile-time type validation in network_system.
 
namespace  kcenon
 
namespace  kcenon::network
 Main namespace for all Network System components.
 

Detailed Description

Unified header for all C++20 concepts in network_system.

This header provides a single include point for all concepts defined in the network_system library. Including this header gives access to all concept definitions for compile-time type validation.

Available concept categories:

  • Buffer concepts: ByteBuffer, MutableByteBuffer
  • Callback concepts: DataReceiveHandler, ErrorHandler, SessionHandler
  • Component concepts: NetworkClient, NetworkServer, NetworkSession
  • Pipeline concepts: DataTransformer, ReversibleDataTransformer

When KCENON_WITH_COMMON_SYSTEM is defined, this header also provides access to common_system concepts:

  • Result/Optional: Resultable, Unwrappable, Mappable
  • Callable: Invocable, VoidCallable, Predicate

Requirements:

  • C++20 compiler with concepts support
  • GCC 10+, Clang 10+, MSVC 2022+

Example usage:

using namespace kcenon::network::concepts;
template<DataReceiveHandler Handler>
void set_handler(Handler&& handler) {
// Handler will be called with const std::vector<uint8_t>&
}
template<NetworkClient Client>
void send_data(Client& client, std::vector<uint8_t> data) {
if (client.is_connected()) {
client.send_packet(std::move(data));
}
}
Unified header for all C++20 concepts in network_system.
C++20 concepts for compile-time type validation in network_system.

Benefits of using concepts:

  • Clearer error messages: Template errors are displayed as concept violations instead of verbose SFINAE failures
  • Self-documenting code: Concepts express type requirements explicitly
  • Better IDE support: More accurate auto-completion and type hints
See also
network_concepts.h for network-specific concepts
common_system/concepts/concepts.h for common concepts (when available)

Definition in file concepts.h.