You are not logged in. Please login at www.codechef.com to post your questions!

×

Smart Pointer C++

Is there a way to utilize smart pointers from C++ in code chef? I have a binary tree that utilizes smart pointers. It compiles and runs just fine on X-code, mac compiler, but when I tried to run the program on Code Chef, i get this error.

prog.cpp:24:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type

     std::shared_ptr<TreeNode> left;
          ^~~~~~~~~~

It's just a pointer to the left node of the tree.

asked 11 Oct, 06:01

dancin_gordito's gravatar image

2★dancin_gordito
1
accept rate: 0%


Got it. I forgot to include the standard library for it.

#include <memory>

link

answered 13 Oct, 00:24

dancin_gordito's gravatar image

2★dancin_gordito
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×60
×22
×13

question asked: 11 Oct, 06:01

question was seen: 103 times

last updated: 13 Oct, 00:24