Thread: boost optional

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    boost optional

    Suppose I have:

    Code:
    boost::optional<someobject&>  test = get_someobject();
    
    if (test) {
       someobject &ref = *test;
    }
    How can I assign reference (ref) to someobject object?

    Thanks for help

    Regards

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Through value access:

    inline T& get (optional<T&> &) ;
    inline T const& get (optional<T&> const& ) ;

    If if remember correctly
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Boost Auto-Linking
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 12-30-2007, 06:11 AM
  2. Replies: 2
    Last Post: 12-12-2007, 06:45 AM
  3. Boost and Size
    By CrazyNorman in forum C++ Programming
    Replies: 3
    Last Post: 07-13-2007, 12:07 PM
  4. building boost iostreams
    By l2u in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2007, 02:29 PM
  5. Integrating Boost with STLPort
    By Mario F. in forum Tech Board
    Replies: 1
    Last Post: 11-11-2006, 06:49 AM