* add front and back
i'll get the last message in some situations,but have to do like this :
```
multimsg msgs;
auto msg = msgs[msgs.size() - 1];
func(msg.size());
auto *msg = msgs.end() - 1;
```
but, std::queue have some method 'front' and 'back'. so maybe i can simply do this ? :
```
multimsg msgs;
auto msg = msgs.back();
```
* add test for front and back
If libzmq is only available as a shared library and not a static one
then cmake fails with:
-- CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)
-- Found PkgConfig: /home/fabrice/buildroot/output/host/bin/pkg-config (found version "0.28")
CMake Error at CMakeLists.txt:20 (message):
ZeroMQ was not found, neither as a CMake package nor via pkg-config
This is due to the fact that ZeroMQ_FOUND is not set to ON even if
ZEROMQ_LIBRARY is TRUE:
if(ZeroMQ_LIBRARY AND ZeroMQ_STATIC_LIBRARY)
set(ZeroMQ_FOUND ON)
endif()
So change AND by OR as suggested in
https://github.com/zeromq/cppzmq/issues/266Fix#266
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit introduces new socket_type enumeration values as well
as the following supporting functions:
socket_t::join()
socket_t::leave()
message_t::group()
message_t::set_group()
Solution: instead of waiting for fixed amount of time for events, react
as soon as events are triggered.
- Total running time of unittest reduced 10x (from ~300ms to 30ms).
- Reduced code duplication by reusing testutil's constructs.
sudo was required for for pkg-config libzmq build as cppzmq could not
find not installed pkg-config libzmq.
Solution: cppzmq to use cmake prefix paths for pkg config paths as well.
cppzmq does not follow other zeromq projects where draft builds are
enabled by default for git repository.
Solution: revert back code where ENABLE_DRAFTS in set to ON if .git
directory exists
Default build, ./ci_build.sh without any arguments, which causes to run
with draft disabled, does not work properly for git cloned repository and
C++11 compiler.
Two issues:
1. For git cloned repository ENABLE_DRAFTS is ON by default but libzmq
compiled build without drafts .Travis did not catch that because default build
runs on non C++11 compiler.
2. testutil.hpp does not build because of missing draft guards.
Solution 1: Remove check for presence of .git for enabling draft API as it
is confusing to use with ENABLE_DRAFTS flag and there should be only one
explicit way to enable draft build.
Solution 2: add missing draft guards in testutil.hpp for server/client
socket in use there.
Solution 3: add extra Travis build covering C++11 compiler and non
draft enabled build.
It seems to be a problem with cppzmq where FindZeroMQ.cmake is not
found without installing cppzmq.
Solution: install cppzmq for pkg-config build type.