Move Maybe template into v8.h so it can be used by SetResourceConstraints

BUG=
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/23767009

Patch from Ross McIlroy <rmcilroy@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16607 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dcc93c91
......@@ -817,6 +817,21 @@ class V8_EXPORT HandleScope {
};
/**
* A simple Maybe type, representing an object which may or may not have a
* value.
*/
template<class T>
struct Maybe {
Maybe() : has_value(false) {}
explicit Maybe(T t) : has_value(true), value(t) {}
Maybe(bool has, T t) : has_value(has), value(t) {}
bool has_value;
T value;
};
// --- Special objects ---
......
......@@ -393,18 +393,6 @@ enum LanguageMode {
};
// A simple Maybe type, that can be passed by value.
template<class T>
struct Maybe {
Maybe() : has_value(false) {}
explicit Maybe(T t) : has_value(true), value(t) {}
Maybe(bool has, T t) : has_value(has), value(t) {}
bool has_value;
T value;
};
// The Strict Mode (ECMA-262 5th edition, 4.2.2).
//
// This flag is used in the backend to represent the language mode. So far
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment