MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / Value

Method Value

AgentBench.old/src/tasks/card_game/logic/src/jsoncpp/jsoncpp.cpp:2824–2851  ·  view source on GitHub ↗

! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */

Source from the content-addressed store, hash-verified

2822 * This optimization is used in ValueInternalMap fast allocator.
2823 */
2824Value::Value(ValueType vtype) {
2825 static char const emptyString[] = "";
2826 initBasic(vtype);
2827 switch (vtype) {
2828 case nullValue:
2829 break;
2830 case intValue:
2831 case uintValue:
2832 value_.int_ = 0;
2833 break;
2834 case realValue:
2835 value_.real_ = 0.0;
2836 break;
2837 case stringValue:
2838 // allocated_ == false, so this is safe.
2839 value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
2840 break;
2841 case arrayValue:
2842 case objectValue:
2843 value_.map_ = new ObjectValues();
2844 break;
2845 case booleanValue:
2846 value_.bool_ = false;
2847 break;
2848 default:
2849 JSON_ASSERT_UNREACHABLE;
2850 }
2851}
2852
2853Value::Value(Int value) {
2854 initBasic(intValue);

Callers 1

summary_valMethod · 0.45

Calls 4

swapFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected