User Profile

Collapse

Profile Sidebar

Collapse
varnie
varnie
Last Activity: Oct 11 '08, 01:49 PM
Joined: Jun 28 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • varnie
    started a topic boost::pool_allocator: can't find my errors
    in C

    boost::pool_allocator: can't find my errors

    hell-o !~

    i faced weird problem during usage boost::pool_all ocator.
    after i've changed:
    Code:
    typedef boost::shared_ptr< param > ParamPtr;
    typedef std::vector< ParamPtr > ParamPtrVector;
    with:
    Code:
    typedef boost::shared_ptr< param > ParamPtr;
    typedef std::vector< ParamPtr, [b]boost::pool_allocator<ParamPtr>[/b] > ParamPtrVector;
    smth goes wrong:...
    See more | Go to post

  • varnie
    replied to functors holding shared_ptr &
    in C
    thanx for clarification. that is exactly what i have expected to hear.
    See more | Go to post

    Leave a comment:


  • varnie
    started a topic functors holding shared_ptr &
    in C

    functors holding shared_ptr &

    good day~

    is it okay to make smth like:
    Code:
    class Foo
    typedef boost::shared_ptr<Foo> FooPtr;
    class MyFunctor{
    const FooPtr [b]&[/b]_pFooPtr;
    public:
      MyFunctor(const FooPtr &p) : _pFooPtr(p) {}
      bool operator()(const FooPtr &other){
        //bla bla
      } 
    };
    or & makes no sense/useless in this case?
    thanks.
    See more | Go to post

  • i figured it out. here's solution:
    Code:
    bool CList::hasKey(const Key &key) const {
        boost::shared_ptr<CList const> pCurList(shared_from_this()); 
        bool res = false;
        do{
            res = _data.find(key) != data.end();
            pCurList = pCurList->getParent();
        } while (!res && pCurList);
       return res;
    }
    See more | Go to post

    Leave a comment:


  • varnie
    replied to time the code
    in C
    you can use, for example, Boost Timer Library. more info here:
    http://www.boost.org/doc/libs/1_35_0/libs/timer/timer.htm
    See more | Go to post

    Leave a comment:


  • varnie
    started a topic how to make current member-function const: a problem
    in C

    how to make current member-function const: a problem

    good day.

    suppose i have:
    Code:
    class Key;
    class Value;
    class CList : public boost::enable_shared_from_this<CList>
    {
      std::map<Key, Value> _data;
      std::shared_ptr<CList> _pParentPtr;
    public:
        //...
        bool hasKey(const Key &key) const;
        std::shared_ptr<CList> getParent() const{
            return _pParentPtr;
        }
    ...
    See more | Go to post
No activity results to display
Show More
Working...