A C++ Kernel

Output and error streams

std::cout and std::cerr are correctly redirected


In [ ]:
#include <iostream>

std::cout << "some output" << std::endl;

In [ ]:
std::cerr << "some error" << std::endl;

Omitting the ; in the last statement of a cell gives an output


In [ ]:
int j = 5;

In [ ]:
j

In [ ]:
#include <map>

In [ ]:
std::map<std::string, int> map1;
map1["something"] = 69;
map1["anything"] = 199;
map1["that thing"] = 50;

map1

In [ ]:
#include <string>
#include <fstream>

#include "xtl/xbase64.hpp"
#include "xeus/xjson.hpp"

namespace im
{
    struct image
    {   
        inline image(const std::string& filename)
        {
            std::ifstream fin(filename, std::ios::binary);   
            m_buffer << fin.rdbuf();
        }
        
        std::stringstream m_buffer;
    };
    
    xeus::xjson mime_bundle_repr(const image& i)
    {
        auto bundle = xeus::xjson::object();
        bundle["image/png"] = xtl::base64encode(i.m_buffer.str());
        return bundle;
    }
}

In [ ]:
im::image marie("marie.png");
marie

... and also lambda, universal references, decltype, etc ...

Documentation and completion


In [ ]:
?std::vector

In [ ]:
Foo

In [ ]: