Questions tagged [boost-ref]

Boost Ref library is a small library that is useful for passing references to function templates (algorithms) that would usually take copies of their arguments

Boost Ref Library defines:

  • the class template boost::reference_wrapper<T>
  • two functions boost::ref and boost::cref that return instances of boost::reference_wrapper<T>
  • a function boost::unwrap_ref that unwraps a boost::reference_wrapper<T> or returns a reference to any other type of object
  • two traits classes boost::is_reference_wrapper<T> and boost::unwrap_reference`.

Further details:

9 questions
6
votes
2 answers

No matching call error occuring for boost::ref but not with std::ref

I've written some code which counts the number of elements of vector using a functor and the ref and bind templates from boost:: or std:: (for C++11) namespaces. I'm using a #define to switch between boost:: and std:: namespaces. I'm using boost…
mkm
  • 673
  • 5
  • 21
4
votes
2 answers

boost::ref and boost::asio completion handlers, pass-by-reference

m_io_service.post(boost::ref(i)); I have this call in a section of code, the underlying type i is definetly a callable (because removing the boost::ref leads to pass by value, which works fine), however clang tells me that…
Hassan Syed
  • 20,075
  • 11
  • 87
  • 171
4
votes
1 answer

Why can't std::ref be used to pass objects into Boost.Python modules?

Environment: Boost 1.61.0 compiled with Python 3.5 The following C++ code outputs 12: class A { public: int func() { return 12; } }; BOOST_PYTHON_MODULE(bridge) { using namespace boost::python; class_("A", no_init) …
Henricus V.
  • 898
  • 1
  • 8
  • 29
4
votes
1 answer

use of boost::ref for passing reference to functions that take values

I am confused about the use of boost::ref. I dont understand why any one would want to do the following - void f(int x) { cout << x<
Rohit
  • 371
  • 4
  • 18
3
votes
2 answers

why is this program using boost::ref

The Ref library is a small library that is useful for passing references to function templates (algorithms) that would usually take copies of their arguments. from…
user494461
1
vote
1 answer

How to use boost::ref with Boost.Parameter library when passing arguments?

I use the Boost.Parameter library for providing named parameters to a constructor. BOOST_PARAMETER_NAME(windowFunction) namespace detail { struct ClassAImpl { template ClassAImpl(ArgumentPack const& args) :…
Hannah S.
  • 3,081
  • 3
  • 20
  • 27
0
votes
1 answer

Can we use std::function and std::ref to replace boost::function and boost::ref, respectively?

Currently, I am removing Boost dependencies from a project. I have replaced boost::function and boost::ref with std::function and std::ref, respectively. I was able to build the project, but in case of executing it catch through an exception and…
pesala
  • 21
  • 4
0
votes
0 answers

BOOTSTRAP NAVBAR AND CAROUSEL

I have a problem when using Boostrap's navbar and carousel since in PC view it hides the image behind the navbar and when you put mobile view it hides the carousel images even more. some help? Thanks for the support! enter image description here
0
votes
1 answer

Deleting an object in boost wrapper in C++

I have a class which has an element std::list > m_children; When an object is created out of this class, i store all the children of that object as reference in this variable. What I wanted to do is, when the…
navderm
  • 799
  • 2
  • 11
  • 33