This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdlib.h> | |
#include "include/libplatform/libplatform.h" | |
#include "include/v8.h" | |
using namespace v8; | |
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An arbitrary user class | |
class Animal { | |
public: | |
virtual ~Animal()=default; | |
int i = rand(); | |
string get_type() {return "Cow";} | |
virtual int get_name() {printf("In getname i = %d\n", i); return i;}; | |
virtual string echo(string s){return s;} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdlib.h> | |
#include "include/libplatform/libplatform.h" | |
#include "include/v8.h" | |
using namespace v8; | |
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clang++ -I/Users/xaxxon/v8 -std=c++14 -Wall -Werror bar.cpp -o bar -L/Users/xaxxon/v8/out/x64.debug/ libv8toolkit.a -lv8_base -lv8_libbase -lv8_base -lv8_libplatform -lv8_nosnapshot -licudata -licuuc -licui18n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal { | |
public: | |
virtual ~Animal()=default; | |
string get_type() {return "Cow";} | |
virtual string get_name() {return "This is the c++ get_name";}; | |
virtual string echo(string s){return s;} | |
virtual int add(int i, int j){return i + j;} | |
}; | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/tmp/gcc-explorer-compiler116116-74-1kmjlf1/example.cpp: In function 'int main()': | |
18 : error: no match for call to '(std::_Bind<std::_Mem_fn<void (foo::*)(int)>(std::_Placeholder<1>, int)>) (std::reference_wrapper<foo>&)' | |
b2(rw); | |
^ | |
In file included from /tmp/gcc-explorer-compiler116116-74-1kmjlf1/example.cpp:1:0: | |
/opt/gcc-5.3.0/include/c++/5.3.0/functional:1129:2: note: candidate: template<class ... _Args, class _Result> _Result std::_Bind<_Functor(_Bound_args ...)>::operator()(_Args&& ...) [with _Args = {_Args ...}; _Result = _Result; _Functor = std::_Mem_fn<void (foo::*)(int)>; _Bound_args = {std::_Placeholder<1>, int}] | |
operator()(_Args&&... __args) | |
^ | |
/opt/gcc-5.3.0/include/c++/5.3.0/functional:1129:2: note: template argument deduction/substitution failed: | |
/opt/gcc-5.3.0/include/c++/5.3.0/functional:1125:38: error: call of '(std::_Mem_fn<void (foo::*)(int)>) (std::reference_wrapper<foo>&, int&)' is ambiguous |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <tuple> | |
using namespace std; | |
template<class Tuple, class... Types> | |
struct Devoider; | |
template<class Tuple> | |
struct Devoider<Tuple> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog { | |
void speak() = 0; | |
virtual void chew_bone() = 0; | |
}; | |
class DogImpl : public Dog { | |
int bones = 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// program is to find if the given graph is tree or not. | |
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
vector < int > adj[10048]; | |
// this is the recursion depth the node was processed at or | |
// 0 if it hasn't been processed yet | |
int d[10048]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <unordered_set> | |
#include <stdlib.h> | |
int random(int max){ | |
return rand() % max; | |
} | |
#define SIZE 1000000 |