Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrappers/cpp/libfreenect.hpp doesn't compile in C++11 mode #339

Closed
OsePedro opened this issue Aug 6, 2013 · 3 comments
Closed

wrappers/cpp/libfreenect.hpp doesn't compile in C++11 mode #339

OsePedro opened this issue Aug 6, 2013 · 3 comments
Milestone

Comments

@OsePedro
Copy link

OsePedro commented Aug 6, 2013

The line m_devices.insert(std::make_pair<int, FreenectDevice*>(_index, device)); in wrappers/cpp/libfreenect.hpp's Freenect::createDevice() function does not compile under the new C++11 definition of std::make_pair(), due to its use of rvalue references. In fact, the whole point of std::make_pair is to allow you to create std::pairs without having to explicitly provide the template parameters. In cases where you want to provide template parameters, you can save 5 characters ("make_") by calling the std::pair constructor directly.

One solution is to replace the line with m_devices.insert(std::make_pair(_index, device));. Alternatively, you could use m_devices[_index]=device;. Both solutions are compatible with earlier versions of C++.

@dankegel
Copy link

We hit this, too.

@macecchi
Copy link

Thanks for the tip! Apparently this hasn't been fixed yet.

@piedar piedar closed this as completed in cf316e0 Jan 19, 2014
yarikoptic added a commit to yarikoptic/libfreenect that referenced this issue Feb 14, 2015
libfreenect v0.3.0 Nucleus

* tag 'v0.3.0':
  Update CMakeLists.txt for v0.3.0
  OpenNI2-FreenectDriver: update README.md
  OpenNI2-FreenectDriver: OFF by default; pass -DBUILD_OPENNI2_DRIVER=ON to cmake to enable
  OpenNI2-FreenectDriver: support ONI_STREAM_PROPERTY_AUTO_WHITE_BALANCE and ONI_STREAM_PROPERTY_AUTO_EXPOSURE
  OpenNI2-FreenectDriver: reduce compiler warnings
  Added chunk processing callbacks for depth and video streams - fixes OpenKinect#351
  Fix missing semicolon in fakenect/record.c
  wrappers/cpp: Remove pureness from virtual callbacks - fixes OpenKinect#286
  Update CMakeLists.txt for v0.2.1
  wrappers/cpp: replace std::make_pair with and more compatible assignment - fixes OpenKinect#339
  wrappers/cpp: Stop loop before clearing devices (prevents hang on exit) - fixes OpenKinect#295
  OpenNI2-FreenectDriver: initial commit
  fakenect: Fix memory leaks - fixes OpenKinect#205
  csharp: Update Enumerations.cs - fixes OpenKinect#285
  Tweaks to freenect_flag commit
  Fix include of libusb.h in wrappers/cpp/libfreenect.hpp
  Make freenect_flags an actual flag enum
  Added Gentoo Linux ebuilds
  Added error reporting for failed subdevice initialization.
  Added a feature to use accelerometer data to rotate camera view in software when the camera is physically rotated such that the view on the screen is always upright even when the camera is upside down. Enabling it, and disabling it is done with the "r" key. Not on by default. I enabled several things that were disabled in the last patch, but only when rotation mode is toggled on.
@maxrafiandy
Copy link

Thanks. you save my day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants