[c++] c++ functions similar to container_of macro

container_of and offsetof can't be used for non-pod c++ objects, so
using templates member_offset and member_container

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>