|
|
Автор: "Yutaka Leon Suematsu" <yut...@atr.jp>
Дата: Fri, 1 Apr 2005 18:27:23 +0900
Местное время: Пт. 1 апр 2005 12:27
Тема: [Boost-users] about enable_if for member functions
Dear booster,
I have a question related to enable_if. I would like to enable or disable
Here is the code.
template <class T>
};
In class A, I want to define function f1 only if the template parameter is
arithmetic. It works fine except when the parameter is not arithmetic. I have a compile error "error C2039: 'type' : is not a member of 'boost::enable_if<Cond,T>'" (Working with VC7.1, and boost 3.12) Thank you in advance for any suggestions and help.
Sincerely yours,
Yutaka Leon Suematsu
_______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: Jaakko Järvi <jaja...@cs.indiana.edu>
Дата: Fri, 1 Apr 2005 11:25:55 -0600
Местное время: Пт. 1 апр 2005 20:25
Тема: Re: [Boost-users] about enable_if for member functions
Hello Yutaka,
The problem is that T is not a template parameter of you function f1.
enable_if<boost::is_arithmetic<void*>, void>::type
which is
enable_if<false, void>::type
which is an error, since enable_if<false,void> is an empty class.
You can write your code as follows to make enable_if work, but it may class A
};
Also, here you need to explicitly instantiate f1 as
A a;
a.f1<int>();
Best, Jaakko Järvi
On Apr 1, 2005, at 3:27 AM, Yutaka Leon Suematsu wrote:
-- Texas A&M University, Computer Science -- ja...@cs.tamu.edu _______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: "Yutaka Leon Suematsu" <yut...@atr.jp>
Дата: Mon, 4 Apr 2005 21:33:13 +0900
Местное время: Пн. 4 апр 2005 15:33
Тема: [Boost-users] Re: about enable_if for member functions
Hello Jaakko,
Thank you for your reply.
> The problem is that T is not a template parameter of you function f1.
I got it.
> It is a template parameter of the class A. > class A
I tried this way too. Although I wanted to have only one interface, I guess
> { > ... > template <class T> > enable_if< boost::is_arithmetic<T>, void > :: type f1() > { > ... > } > }; > Also, here you need to explicitly instantiate f1 as > A a;
it the best possibility I have now. Thanks a lot,
Yutaka Leon Suematsu
Boost-users mailing list Boost-us...@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: "Jonathan Turkanis" <techn...@kangaroologic.com>
Дата: Mon, 4 Apr 2005 15:39:33 -0600
Местное время: Вт. 5 апр 2005 00:39
Тема: [Boost-users] Re: about enable_if for member functions
Yutaka Leon Suematsu wrote:
The usual way to do this, since enable_if is not applicable, is to implement the
> Dear booster, > I have a question related to enable_if. I would like to enable or
function in an optional base class, and use mpl::if or eval_if to derive from the base only if you want the function enabled. Jonathan
_______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
|
|
Автор: "John Maddock" <j...@johnmaddock.co.uk>
Дата: Fri, 1 Apr 2005 10:58:23 +0100
Местное время: Пт. 1 апр 2005 12:58
Тема: Re: [Boost-users] [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
> I would like to know if it's possible to assign an alias/name to a No that's not supported, but don't forget that you can always use > sub-expression. When using short regex there is no problem nor confusion > but when using a long regex then I get lost looking at the correct index > to use. It would be much easier if I can assign an alias. > So, instead to use a regex like this:
> "\s*(\d+)\s+(\d+)\s+(\d+)\s+"
> I would like to be able to use something like:
> "\s*([$VALUE1]\d+)\s+([$VALUE2]\d+)\s+([$VALUE3]\d+)\s+"
> I don't know if this feature exists in regex but I haven't found it but non-marking parenthesis to avoid throwing out too many fields. John. _______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: jordi <jord...@hotmail.com>
Дата: Tue, 05 Apr 2005 11:00:53 +0200
Местное время: Вт. 5 апр 2005 12:00
Тема: [Boost-users] Re: [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
John Maddock wrote:
I already use non-marking parenthesis but when using a long regex it's >> I would like to know if it's possible to assign an alias/name to a >> sub-expression. When using short regex there is no problem nor > No that's not supported, but don't forget that you can always use > John.
very difficult to decide which is the correct index to define the subexpression to use. Furthermore, when using "conditional expressiones" in the format strings the difficulties are even more obvious... Thanks anyway for your reply,
Jordi
_______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: Stuart Dootson <stuart.doot...@gmail.com>
Дата: Tue, 5 Apr 2005 10:20:00 +0100
Тема: Re: [Boost-users] Re: [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
On Apr 5, 2005 10:00 AM, jordi <jord...@hotmail.com> wrote:
Jordi - something like Regex Coach (http://www.weitz.de/regex-coach/) makes it a lot easier to work out what match indices to use for the different captures in your regular expressions... Stuart Dootson
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: jordi <jord...@hotmail.com>
Дата: Wed, 06 Apr 2005 12:49:46 +0200
Местное время: Ср. 6 апр 2005 13:49
Тема: [Boost-users] Re: [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
> Jordi - something like Regex Coach (http://www.weitz.de/regex-coach/)
I'm already using Regex Coach because someone in this group suggested it > makes it a lot easier to work out what match indices to use for the > different captures in your regular expressions... to check my regex. I think it's a very great tool!. I have just realized there is the option to get the index in the Thanks,
Jordi
_______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: Stuart Dootson <stuart.doot...@gmail.com>
Дата: Wed, 6 Apr 2005 12:37:38 +0100
Местное время: Ср. 6 апр 2005 14:37
Тема: Re: [Boost-users] Re: [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
On Apr 6, 2005 11:49 AM, jordi <jord...@hotmail.com> wrote:
I thinkn that might have been my suggestion :-) Hmmm - 10 captures!!!
The only thing I can suggest for indices > 10 is contacting the tool
Stuart Dootson
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||
Автор: jordi <jord...@hotmail.com>
Дата: Tue, 05 Apr 2005 11:23:26 +0200
Местное время: Вт. 5 апр 2005 12:23
Тема: [Boost-users] Re: [Regex] Is it possible to assign an alias to a subexpression (to use later instead of its index)?
John Maddock wrote:
I already use non-marking parenthesis but when using a long regex it's
>> I would like to know if it's possible to assign an alias/name to a >> sub-expression. When using short regex there is no problem nor > No that's not supported, but don't forget that you can always use > John.
very difficult to decide which is the correct index to define the subexpression to use. Furthermore, when using "conditional expressiones" in the format strings the difficulties are even more obvious... Thanks anyway for your reply,
Jordi
_______________________________________________
Чтобы отправлять сообщения, сначала необходимо Войти.
Чтобы отправлять сообщения, сначала необходимо присоединиться к группе.
Перед отправкой сообщения обновите свой псевдоним на странице Настройки подписки.
У вас нет разрешения на отправку сообщений.
| ||||||||||||||