Brief intro to Source Code in Org
Required Setup
;; add support for C++ and Python
(org-babel-do-load-languages
'org-babel-load-languages
'((C . t) (python . t)))
.section .text._Z11extract_fooIeET_N5boost6python3api6objectE,"axG",@progbits,long double extract_foo<long double>(boost::python::api::object),comdat | |
.p2align 4 | |
.weak long double extract_foo<long double>(boost::python::api::object) | |
.type long double extract_foo<long double>(boost::python::api::object), @function | |
long double extract_foo<long double>(boost::python::api::object): | |
.LFB10151: | |
.cfi_startproc | |
.cfi_personality 0x9b,DW.ref.__gxx_personality_v0 | |
.cfi_lsda 0x1b,.LLSDA10151 | |
endbr64 |
(setq lsp-clients-clangd-args | |
(list (concat "--compile-commands-dir=" | |
(projectile-project-root) | |
"build") | |
"--log=verbose" | |
"-j=1" | |
"--debug" | |
"--clang-tidy" | |
"--background-index"))) |
;; add support for C++ and Python
(org-babel-do-load-languages
'org-babel-load-languages
'((C . t) (python . t)))
// std::vector<Eigen::VectorXf> -> Eigen::MatrixXf | |
#include <iostream> | |
#include <vector> | |
#include <Eigen/Dense> | |
int main() { | |
using namespace Eigen; | |
const int cols = 10; | |
const int rows = 10; // or do you get it from the sizes of each entry in *d? | |
std::vector<VectorXf> * d = new std::vector<VectorXf>(cols); |
// demonstrating use of Eigen::Map | |
#include <iostream> | |
#include <vector> | |
#include <Eigen/Dense> | |
int main() { | |
using namespace Eigen; | |
std::vector<float> foo{1.0, 2.0, 3.0, 4.0}; | |
Map<Matrix<float, Dynamic, 1>> foom(foo.data(), foo.size()); | |
IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]"); |
// experimenting with zip iterator and sort | |
#include <vector> | |
#include <iostream> | |
#include <boost/iterator/zip_iterator.hpp> | |
#include <boost/fusion/adapted/std_tuple.hpp> | |
using zip_it = boost::zip_iterator<std::tuple<std::vector<std::size_t>::iterator, | |
std::vector<std::size_t>::iterator, |
#include <iostream> | |
#include <boost/spirit/include/qi.hpp> | |
#include <boost/optional.hpp> | |
#include <boost/optional/optional_io.hpp> | |
int main() { | |
using namespace std; | |
// parsing parentheses that may or may not contain integers | |
string in("(10) () (20)"); |
#include <string> | |
#include <vector> | |
#include <boost/spirit/include/qi.hpp> | |
using string_it_t = std::string::const_iterator; | |
int main() { | |
using namespace boost::spirit; | |
using namespace boost::spirit::qi; |
// To see if a rule whose attribute is sequence-of-sequence can make appends happen somehow | |
#include <string> | |
#include <vector> | |
#include <boost/spirit/include/qi.hpp> | |
#include <boost/fusion/include/adapt_struct.hpp> | |
struct tiny { | |
std::string thing; |