Skip to content

Instantly share code, notes, and snippets.

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include<stdio.h>
#include <cstdlib> //std::system
//using namespace boost::interprocess;
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator;
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector;
int main(int argc, char *argv[])
@Daiver
Daiver / 1
Created January 31, 2013 20:30
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator;
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector;
DataVector *myvector;
void init_myvector()
{
struct shm_remove
{
shm_remove() { boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
~shm_remove(){ boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
} remover;
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator;
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector;
DataVector *myvector;
void init_myvector()
{
struct shm_remove
{
shm_remove() { boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
//~shm_remove(){ boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
} remover;
if op == '+':
res = first + second
try:
some()
except:
print(":(")
exit()
class A:
def __init__(self, x, y):
self.x = x
self.y = y
def hi(self):
print(self.x, self.y)
def f(arg1, arg2='default'):
print('arg1', arg1)
print('arg2', arg2)
f('one', 'two')
f('one')
f('one', arg2='two')
f(arg1='one', arg2='two')
cv::Mat res = cv::Mat::zeros(depth_map.rows, depth_map.cols, depth_map.type());
for(int i = 0; i < depth_map.rows; i++)
{
for(int j = 0; j < depth_map.cols; j++)
{
res.at<uchar>(i, j) = depth_map.at<uchar>(i, j);
}
}
cv::Mat res;
cv::StereoBM bm(CV_STEREO_BM_NORMALIZED_RESPONSE);
bm(left, right, res);
//std::cout<<res;
std::cout<<"type "<<res.type()<<"\n";
cv::Mat tmp = cv::Mat::zeros(res.rows, res.cols, res.type());
for(int i = 0; i < res.rows; i++)
{
for(int j = 0; j < res.cols; j++)
{
class Tree:
def __init___(self, value):
self.left = .....
self.right = .....
self.value = value