Rather than provide a complex inheritable family of classes with super-imposed mixins to represent the varying degrees of generic device functionalities (e.g. source, sink, seekable...) a rather more simpler (and faster) concept based method is used for the devices in ecl's input-output library. The concepts are required to validate the classes for use by higher level structures such as streams.


Include the following at the top of any translation unit for which you are running compile time checks on your blueprint classes.

Since it only uses macros and templatised objects, no linking is required for just this feature.

Concept Definition


An input device class has to satisfy the following conditions:


An output device class has to satisfy the following conditions:


An input-output device class has to satisfy the conditions required by both input and output devices simultaneously.


The three byte device concepts are similar except they add additional read/write capabilities for the other is_byte types (refer to ecl_mpl's type traits). Namely char, signed char and unsigned char.


Generally, you won't need to use these directly. Rather they're embedded in other ecl objects such as streams. However, a simple example of a device function definition and the concept check usage is outlined below.

#include <ecl/concepts/devices.hpp>

using ecl::InputCharDevice;

template <typename Device>
class MyStream {
    MyStream(Device *device) {

Author(s): Daniel Stonier (
autogenerated on Thu Jan 2 2014 11:12:03