Beman Dawes <[EMAIL PROTECTED]> writes:

> In discussions about being able to specify a function to check the
> validity of path element names, a simple function pointer has been
> used:
>
>    typedef bool (*name_check)( const std::string & name );
>
> Alternately, boost::function could be used. The boost::function docs
> mention several advantages over function pointers; the advantage that
> might particularly apply is that:
>
> "Boost.Function allows arbitrary compatible function objects to be
> targets (instead of requiring an exact function signature)."
>
> That can be a really powerful advantage in some applications, but
> usage of name checking in boost::filesystem seems likely to be limited
> to very simple cases where plain function pointers will do just
> fine. I'd also like to avoid the dependency on an additional library,
> since Boost regression test reporting breaks if
> boost::filesystem::path breaks.
>
> So unless someone comes forward with a killer argument, a simple
> function pointer will be used.
>
> Comments?

FWIW, Boost.Function is overkill for many simple cases.  This might
be a case where the FS library should just provide a class with a
virtual function:

        struct checker
        {
             virtual ~checker() {}
             virtual bool operator()( std string const& ) = 0;
         
             shared_ptr<checker> next; // suggested.
        };

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to