GithubHelp home page GithubHelp logo

BaseDetector CreateDetector method should return a std:shared_ptr or std::unique_ptr instead of wild pointer to *BaseDetector about multitarget-tracker HOT 5 CLOSED

smorodov avatar smorodov commented on July 17, 2024
BaseDetector CreateDetector method should return a std:shared_ptr or std::unique_ptr instead of wild pointer to *BaseDetector

from multitarget-tracker.

Comments (5)

Nuzhny007 avatar Nuzhny007 commented on July 17, 2024

Hi!
I know about make_shared and make_unique - they are used in this project. But I don't know what type of smart pointer need a client. CreateDetector is library function and VideoExamples are client code for this library. Shared or unique ptr and Why?

from multitarget-tracker.

isra60 avatar isra60 commented on July 17, 2024

I usually use shared_ptr on my projects. By using shared_ptr on the return of the method you assure better use of the memory and also avoid a new copy of the Detector.

The difference between both is better explained here.

https://stackoverflow.com/questions/6876751/differences-between-unique-ptr-and-shared-ptr

from multitarget-tracker.

Nuzhny007 avatar Nuzhny007 commented on July 17, 2024

Yes. But I think than now libraries user can self select smart pointer type. For VideoExample unique_ptr is the best. For another case shared_ptr may be better. Are you sure than the library must self select pointer type?
What kind of problems you see in case with raw pointer?

from multitarget-tracker.

isra60 avatar isra60 commented on July 17, 2024

I see your point. Maybe I'm worried about make_unique because is on standard c++14 instead of c++11.
Nevertheless...
Close The Issue??

from multitarget-tracker.

Nuzhny007 avatar Nuzhny007 commented on July 17, 2024

This question for Smorodov: he is admin and project owner.

from multitarget-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.